Files
rust_browser/tests/goldens/expected/045-mixed-headings-para.layout.txt
Zachary D. Rowitsch 20e241bd03
All checks were successful
ci / fast (linux) (push) Successful in 6m52s
Implement margin collapsing through empty elements (CSS 2.1 §8.3.1)
Self-collapsing elements (zero height, no padding/border, no BFC, no line
boxes) now have their top and bottom margins collapse together, and child
margins propagate through parents with auto height and no bottom
padding/border. This replaces the pairwise collapse_margins() function
with a MarginSet accumulator that tracks max positive and min negative
margins separately, correctly resolving chains of 4+ margins.

Key changes:
- Add is_self_collapsing() post-layout predicate and gather_all_margins()
- Add gather_margin_bottom() for bottom margin propagation with a guard
  against propagation when max-height constrains the parent
- Replace prev_margin_bottom with MarginSet-based pending_margins in the
  sibling layout loop
- Handle clearance + self-collapsing interaction correctly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 01:04:53 -05:00

76 lines
3.3 KiB
Plaintext

LayoutBox node=#1 tag=html box=block
content: (0, 0, 800, 228.32)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#3 tag=body box=block
content: (8, 8, 784, 204.32)
padding: 0 0 0 0
border: 0 0 0 0
margin: 8 8 8 8
LayoutBox node=#5 tag=h1 box=block
content: (8, 29.44, 784, 38.4)
padding: 0 0 0 0
border: 0 0 0 0
margin: 21.44 0 21.44 0
inline_context: 1 lines, height=38.4, max_width=116.44053
line[0]: rect=(8, 29.44, 116.44053, 38.4) fragments=2
frag[0]: rect=(8, 32.64, 58.525696, 32) text="Main" start=false end=false
frag[1]: rect=(72.63436, 32.64, 51.806168, 32) text="Title" start=false end=false
LayoutBox node=#6 tag=anonymous box=anon
content: (0, 0, 116.44052, 32)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Main Title"
LayoutBox node=#8 tag=p box=block
content: (8, 89.28001, 784, 19.200005)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
inline_context: 1 lines, height=19.200005, max_width=216.04701
line[0]: rect=(8, 89.28001, 216.04701, 19.2) fragments=5
frag[0]: rect=(8, 90.880005, 69.75624, 16) text="Introductory" start=false end=false
frag[1]: rect=(80.81057, 90.880005, 58.408222, 16) text="paragraph" start=false end=false
frag[2]: rect=(142.27313, 90.880005, 33.221733, 16) text="under" start=false end=false
frag[3]: rect=(178.54921, 90.880005, 18.126286, 16) text="the" start=false end=false
frag[4]: rect=(199.72983, 90.880005, 24.31718, 16) text="title." start=false end=false
LayoutBox node=#9 tag=anonymous box=anon
content: (0, 0, 216.04704, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Introductory paragra..."
LayoutBox node=#11 tag=h2 box=block
content: (8, 128.40001, 784, 28.800003)
padding: 0 0 0 0
border: 0 0 0 0
margin: 19.92 0 19.92 0
inline_context: 1 lines, height=28.800003, max_width=108.14096
line[0]: rect=(8, 128.40001, 108.14096, 28.800001) fragments=2
frag[0]: rect=(8, 130.8, 64.70484, 24) text="Section" start=false end=false
frag[1]: rect=(77.28634, 130.8, 38.85462, 24) text="Title" start=false end=false
LayoutBox node=#12 tag=anonymous box=anon
content: (0, 0, 108.14095, 24)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Section Title"
LayoutBox node=#14 tag=p box=block
content: (8, 177.12001, 784, 19.199997)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
inline_context: 1 lines, height=19.199997, max_width=150.39061
line[0]: rect=(8, 177.12001, 150.39061, 19.2) fragments=4
frag[0]: rect=(8, 178.72002, 44.15859, 16) text="Content" start=false end=false
frag[1]: rect=(55.21292, 178.72002, 33.221733, 16) text="under" start=false end=false
frag[2]: rect=(91.48898, 178.72002, 39.5301, 16) text="section" start=false end=false
frag[3]: rect=(134.07343, 178.72002, 24.31718, 16) text="title." start=false end=false
LayoutBox node=#15 tag=anonymous box=anon
content: (0, 0, 150.3906, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Content under sectio..."