Skip to content

Commit c445d4d

Browse files
committed
Revert "fix: text-slot bug in testing framework"
This reverts commit f217333.
1 parent f217333 commit c445d4d

File tree

6 files changed

+9
-56
lines changed

6 files changed

+9
-56
lines changed

float-pigment-css/src/property.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ property_list! (PropertyValueWithGlobal, {
166166
0xa3 TextDecorationThickness: TextDecorationThicknessType as Initial default TextDecorationThickness::Auto;
167167
0xa4 FontFeatureSettings: FontFeatureSettingsType as Inherit default FontFeatureSettings::Normal;
168168

169-
// grid
170-
0xa5 GridTemplateRows: GridTemplateRowsType as Initial default GridTemplateRows::None;
171-
172169
0xd0 ListStyleType: ListStyleTypeType as Inherit default ListStyleType::Disc;
173170
0xd1 ListStyleImage: ListStyleImageType as Inherit default ListStyleImage::None;
174171
0xd2 ListStylePosition: ListStylePositionType as Inherit default ListStylePosition::Outside;
@@ -1660,12 +1657,6 @@ property_value_format! (PropertyValueWithGlobal, {
16601657
)
16611658
};
16621659
}};
1663-
1664-
// grid_template_rows: {{ GridTemplateRows
1665-
// = "none" => GridTemplateRows::None
1666-
// | <track_list>
1667-
// | <auto_track_list>
1668-
// }};
16691660
});
16701661

16711662
pub(crate) fn split_hv<T: Clone>(x: Vec<T>) -> (T, T) {

float-pigment-css/src/typing.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub enum Color {
134134
Specified(u8, u8, u8, u8),
135135
}
136136

137-
/// A length value or an expression that evaluates to a length value.
137+
/// A length value or an expression that evaluates to a langth value.
138138
#[allow(missing_docs)]
139139
#[repr(C)]
140140
#[property_value_type(PropertyValueWithGlobal for LengthType)]
@@ -1796,14 +1796,3 @@ pub enum Gap {
17961796
#[resolve_font_size(Length::resolve_em)]
17971797
Length(Length),
17981798
}
1799-
1800-
/// The `grid-template-rows` property defines the line names and track sizing functions of the grid rows.
1801-
#[allow(missing_docs)]
1802-
#[repr(C)]
1803-
#[property_value_type(PropertyValueWithGlobal for GridTemplateRowsType)]
1804-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1805-
#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1806-
pub enum GridTemplateRows {
1807-
/// A keyword meaning that there is no explicit grid
1808-
None,
1809-
}

float-pigment-css/src/typing_stringify.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,11 +2336,3 @@ impl fmt::Display for Gap {
23362336
}
23372337
}
23382338
}
2339-
2340-
impl fmt::Display for GridTemplateRows {
2341-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2342-
match self {
2343-
GridTemplateRows::None => write!(f, "none"),
2344-
}
2345-
}
2346-
}

float-pigment-forest/src/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ impl Node {
315315
pub(crate) unsafe fn baseline_func(&self) -> Option<&BaselineFn<Len>> {
316316
(*self.baseline_func.get()).as_deref()
317317
}
318-
pub fn set_baseline_func(&self, baseline_func: Option<Box<BaselineFn<Len>>>) {
318+
pub unsafe fn set_baseline_func(&self, baseline_func: Option<Box<BaselineFn<Len>>>) {
319319
drop(std::mem::replace(
320-
unsafe { &mut *self.baseline_func.get() },
320+
&mut *self.baseline_func.get(),
321321
baseline_func,
322322
));
323323
}

float-pigment-forest/tests/custom/css_margin.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -365,20 +365,6 @@ fn margin_collapse_between_sibling_and_empty_block_4() {
365365
)
366366
}
367367

368-
#[test]
369-
fn margin_collapse_between_sibling_and_empty_block_5() {
370-
assert_xml!(
371-
r#"
372-
<div style="height: 300px;">
373-
<div style="height: 30px; margin-bottom: 50px" expect_height="30" expect_top="0"></div>
374-
<text-slot len="0"></text-slot>
375-
<div style="height: 30px; margin-top: 100px" expect_height="30" expect_top="130"></div>
376-
</div>
377-
"#,
378-
true
379-
)
380-
}
381-
382368
#[test]
383369
fn margin_collapse_between_parent_and_empty_block_1() {
384370
assert_xml!(

float-pigment-forest/tests/mod.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ impl TextInfo {
125125
max_content_height: Len,
126126
) -> Size<Len> {
127127
let text_len = self.text_len;
128-
if text_len == 0 {
129-
println!(
130-
"text_info: {self:?}, width: {min_width:?} ~ {max_width:?}, height: {min_height:?} ~ {max_height:?}, max_content_width: {max_content_width:?}, max_content_height: {max_content_height:?}, measured_width: 0, measured_height: 0",
131-
);
132-
return Size::new(Len::zero(), Len::zero());
133-
}
134128
let text_width = self.font_size * text_len as f32;
135129
let max_w = max_width.min(max_content_width);
136130
let max_h = max_height.min(max_content_height);
@@ -194,11 +188,6 @@ fn convert_font_size_to_px(font_size: float_pigment_css::typing::Length) -> f32
194188
#[inline(always)]
195189
fn prepare_measure_node(node: *mut Node, text_info: TextInfo) {
196190
let node = unsafe { &mut *node };
197-
unsafe {
198-
node.set_display(Display::Inline);
199-
node.set_node_type(float_pigment_forest::NodeType::Text);
200-
}
201-
node.set_baseline_func(Some(Box::new(|_, _, _| Len::from_f32(16.))));
202191
node.set_measure_func(Some(Box::new(
203192
move |_,
204193
max_width,
@@ -219,6 +208,11 @@ fn prepare_measure_node(node: *mut Node, text_info: TextInfo) {
219208
)
220209
},
221210
)));
211+
unsafe {
212+
node.set_display(Display::Inline);
213+
node.set_baseline_func(Some(Box::new(|_, _, _| Len::from_f32(16.))));
214+
node.set_node_type(float_pigment_forest::NodeType::Text);
215+
}
222216
}
223217

224218
impl TestCtx {
@@ -391,6 +385,7 @@ impl TestCtx {
391385
self.set_expect_layout_pos(node, e.attributes());
392386

393387
if is_measure_text_slot(e.tag()) {
388+
let node = Node::new_ptr();
394389
let text_len = e
395390
.attributes()
396391
.get("len")

0 commit comments

Comments
 (0)