diff --git a/crates/obscura-render/tests/layout_test.rs b/crates/obscura-render/tests/layout_test.rs index c3f8102..d72496b 100644 --- a/crates/obscura-render/tests/layout_test.rs +++ b/crates/obscura-render/tests/layout_test.rs @@ -521,6 +521,55 @@ fn float_flow_zone_preserves_blocks_inline_runs_and_clearance() { ); } +#[test] +fn float_exclusion_continues_through_non_bfc_block_wrappers() { + let tree = parse_html(include_str!( + "../../../render-repros/float-bfc-continuation.html" + )); + let layout = layout_dom(&tree, (900.0, 1000.0)); + let rect = |name| layout.rects[&tree.get_element_by_id(name).unwrap()]; + let float = rect("intro-float"); + let lead = rect("lead"); + let heading = rect("heading"); + let beside = rect("beside"); + let after = rect("after"); + assert!( + (float.x - 650.0).abs() < 0.01 + && (float.y - 0.0).abs() < 0.01 + && (float.width - 250.0).abs() < 0.01 + && (float.height - 400.0).abs() < 0.01, + "float: {float:?}" + ); + assert!( + (lead.x - 0.0).abs() < 0.01 + && (lead.y - 0.0).abs() < 0.01 + && (lead.width - 650.0).abs() < 0.01 + && (lead.height - 250.0).abs() < 0.01, + "lead: {lead:?}" + ); + assert!( + (heading.x - 0.0).abs() < 0.01 + && (heading.y - 250.0).abs() < 0.01 + && (heading.width - 650.0).abs() < 0.01 + && (heading.height - 50.0).abs() < 0.01, + "heading: {heading:?}" + ); + assert!( + (beside.x - 0.0).abs() < 0.01 + && (beside.y - 300.0).abs() < 0.01 + && (beside.width - 650.0).abs() < 0.01 + && (beside.height - 100.0).abs() < 0.01, + "beside: {beside:?}" + ); + assert!( + (after.x - 0.0).abs() < 0.01 + && (after.y - 400.0).abs() < 0.01 + && (after.width - 900.0).abs() < 0.01 + && (after.height - 70.0).abs() < 0.01, + "after: {after:?}" + ); +} + #[test] fn replaced_image_contributes_intrinsic_size_in_ordered_grid() { let tree = parse_html(include_str!("../../../render-repros/replaced-grid-order.html")); diff --git a/render-repros/checks.json b/render-repros/checks.json index 85e0ea9..8540034 100644 --- a/render-repros/checks.json +++ b/render-repros/checks.json @@ -72,6 +72,13 @@ {"name": "later block remains in float band", "color": "#1098ad", "x": 0, "y": 230, "width": 650, "height": 70}, {"name": "clear moves below float bottom", "color": "#a61e4d", "x": 0, "y": 400, "width": 900, "height": 50} ], + "float-bfc-continuation": [ + {"name": "float keeps its BFC band across wrappers", "color": "#1971c2", "x": 650, "y": 0, "width": 250, "height": 400}, + {"name": "direct flow uses the first available band", "color": "#087f5b", "x": 0, "y": 0, "width": 650, "height": 250}, + {"name": "later wrapper heading remains beside float", "color": "#e8590c", "x": 0, "y": 250, "width": 650, "height": 50}, + {"name": "later wrapper block remains beside float", "color": "#7048e8", "x": 0, "y": 300, "width": 650, "height": 100}, + {"name": "band widens after float bottom", "color": "#a61e4d", "x": 0, "y": 400, "width": 900, "height": 70} + ], "grid-auto-repeat": [ {"name": "auto-fill creates all fitting tracks", "color": "#087f5b", "width": 210, "height": 60, "count": 4}, {"name": "auto-fit collapses empty tracks", "color": "#1971c2", "width": 287, "height": 60, "count": 3} diff --git a/render-repros/float-bfc-continuation.html b/render-repros/float-bfc-continuation.html new file mode 100644 index 0000000..1ef89e9 --- /dev/null +++ b/render-repros/float-bfc-continuation.html @@ -0,0 +1,47 @@ + + + + + float continuation through block wrappers + + + +
+
+ +
+
+
+

+
+
+
+
+ +