Skip to content

Commit e58569c

Browse files
committed
fix: fixed size should not handle writing-mode
1 parent 429cb0a commit e58569c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ pub fn aspect_ratio_in_block_width_fixed() {
310310
let child = as_ref(Node::new_ptr());
311311
child.set_width(DefLength::Points(Len::from_f32(100.)));
312312
child.set_height(DefLength::Auto);
313-
child.set_aspect_ratio(Some(1. / 1.));
313+
child.set_aspect_ratio(Some(2. / 1.));
314314
container.append_child(convert_node_ref_to_ptr(child));
315315

316316
root.layout(
@@ -319,7 +319,7 @@ pub fn aspect_ratio_in_block_width_fixed() {
319319
);
320320

321321
assert_eq!(child.layout_position().width, 100.);
322-
assert_eq!(child.layout_position().height, 100.);
322+
assert_eq!(child.layout_position().height, 50.);
323323
}
324324
}
325325

@@ -335,15 +335,15 @@ pub fn aspect_ratio_in_block_height_fixed() {
335335
let child = as_ref(Node::new_ptr());
336336
child.set_width(DefLength::Auto);
337337
child.set_height(DefLength::Points(Len::from_f32(100.)));
338-
child.set_aspect_ratio(Some(1. / 1.));
338+
child.set_aspect_ratio(Some(2. / 1.));
339339
container.append_child(convert_node_ref_to_ptr(child));
340340

341341
root.layout(
342342
OptionSize::new(OptionNum::some(Len::from_f32(400.)), OptionNum::none()),
343343
Size::new(Len::from_f32(0.), Len::from_f32(0.)),
344344
);
345345

346-
assert_eq!(child.layout_position().width, 100.);
346+
assert_eq!(child.layout_position().width, 200.);
347347
assert_eq!(child.layout_position().height, 100.);
348348
}
349349
}

float-pigment-layout/src/algo/flow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
366366
if css_size.width.is_none() ^ css_size.height.is_none() && has_aspect_ratio {
367367
if css_size.height.is_none() {
368368
css_size.height = OptionNum::some(resolve_block_size_from_aspect_ratio(
369-
axis_info.dir,
369+
AxisDirection::Vertical,
370370
child_border,
371371
child_padding_border,
372372
aspect_ratio.unwrap(),
@@ -375,7 +375,7 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
375375
))
376376
} else {
377377
css_size.width = OptionNum::some(resolve_block_size_from_aspect_ratio(
378-
axis_info.dir,
378+
AxisDirection::Horizontal,
379379
child_border,
380380
child_padding_border,
381381
aspect_ratio.unwrap(),

0 commit comments

Comments
 (0)