The headless browser for AI agents and web scraping
test: gate BFC float continuation
SGavrle90ea7eacced
diff --git a/crates/obscura-render/tests/layout_test.rs b/crates/obscura-render/tests/layout_test.rsindex c3f81029..d72496be 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.jsonindex 85e0ea92..85400342 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.htmlnew file mode 100644index 00000000..1ef89e91--- /dev/null+++ b/render-repros/float-bfc-continuation.html@@ -0,0 +1,47 @@+<!doctype html>+<html>+<head>+ <meta charset="utf-8">+ <title>float continuation through block wrappers</title>+ <style>+ html, body { margin: 0; }+ #bfc { width: 900px; display: flow-root; }+ #intro-float {+ float: right;+ width: 250px;+ height: 400px;+ background: #1971c2;+ }+ #lead {+ height: 250px;+ background: #087f5b;+ }+ #heading {+ margin: 0;+ height: 50px;+ background: #e8590c;+ }+ #beside {+ height: 100px;+ background: #7048e8;+ }+ #after {+ height: 70px;+ background: #a61e4d;+ }+ </style>+</head>+<body>+ <main id="bfc">+ <section id="intro">+ <aside id="intro-float"></aside>+ <div id="lead"></div>+ </section>+ <section id="following">+ <h2 id="heading"></h2>+ <div id="beside"></div>+ <div id="after"></div>+ </section>+ </main>+</body>+</html>