diff --git a/crates/obscura-render/tests/layout_test.rs b/crates/obscura-render/tests/layout_test.rs index ab34617..bcc57d5 100644 --- a/crates/obscura-render/tests/layout_test.rs +++ b/crates/obscura-render/tests/layout_test.rs @@ -332,3 +332,30 @@ fn percentage_flex_overlay_uses_auto_width_parent_content_box() { assert!((sidebar.x - 16.0).abs() < 0.01, "sidebar: {sidebar:?}"); assert!((sidebar.width - 320.0).abs() < 0.01, "sidebar: {sidebar:?}"); } + +#[test] +fn float_flow_zone_preserves_blocks_inline_runs_and_clearance() { + let tree = parse_html(include_str!("../../../render-repros/float-flow-bands.html")); + let layout = layout_dom(&tree, (900.0, 1000.0)); + let rect = |id| layout.rects[&tree.get_element_by_id(id).unwrap()]; + let float = rect("float"); + let intro = rect("intro"); + let release = rect("release"); + let download = rect("download"); + let archive = rect("archive"); + let sponsors = rect("sponsors"); + let logos = rect("logos"); + let cleared = rect("cleared"); + assert!((float.x - 650.0).abs() < 0.01 && (float.height - 400.0).abs() < 0.01, "float: {float:?}"); + assert!((intro.x - 0.0).abs() < 0.01 && (intro.width - 650.0).abs() < 0.01, "intro: {intro:?}"); + assert!((release.y - 100.0).abs() < 0.01 && (release.width - 650.0).abs() < 0.01, "release: {release:?}"); + assert!((download.x - 0.0).abs() < 0.01 && (download.y - 150.0).abs() < 0.01, "download: {download:?}"); + assert!((archive.x - 60.0).abs() < 0.01 && (archive.y - 150.0).abs() < 0.01, "archive: {archive:?}"); + assert!((sponsors.y - 180.0).abs() < 0.01, "sponsors: {sponsors:?}"); + assert!((logos.y - 230.0).abs() < 0.01, "logos: {logos:?}"); + assert!((cleared.y - 400.0).abs() < 0.01 && (cleared.width - 900.0).abs() < 0.01, "cleared: {cleared:?}"); + assert!( + !layout.rects.contains_key(&tree.get_element_by_id("mobile-duplicate").unwrap()), + "display:none duplicate generated a box" + ); +} diff --git a/render-repros/checks.json b/render-repros/checks.json index ae11772..9010b36 100644 --- a/render-repros/checks.json +++ b/render-repros/checks.json @@ -48,6 +48,16 @@ {"name": "display contents flex sidebar starts at container edge", "color": "#7048e8", "x": 0, "y": 260, "width": 150, "height": 140}, {"name": "display contents flex body keeps its intended inset", "color": "#c2255c", "x": 150, "y": 260, "width": 450, "height": 160} ], + "float-flow-bands": [ + {"name": "right float occupies its band", "color": "#1971c2", "x": 650, "y": 0, "width": 250, "height": 400}, + {"name": "float-avoiding intro uses available band", "color": "#087f5b", "x": 0, "y": 0, "width": 650, "height": 100}, + {"name": "heading remains beside float", "color": "#e8590c", "x": 0, "y": 100, "width": 650, "height": 50}, + {"name": "first inline atomic box shares one line", "color": "#c2255c", "x": 0, "y": 150, "width": 60, "height": 30}, + {"name": "second inline atomic box shares one line", "color": "#7048e8", "x": 60, "y": 150, "width": 90, "height": 30}, + {"name": "hidden duplicate consumes no flow height", "color": "#f08c00", "x": 0, "y": 180, "width": 650, "height": 50}, + {"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} + ], "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-flow-bands.html b/render-repros/float-flow-bands.html new file mode 100644 index 0000000..b685a0d --- /dev/null +++ b/render-repros/float-flow-bands.html @@ -0,0 +1,55 @@ + + +
+ +