Files
rust_browser/tests/goldens/expected/149-float-right-with-block-children.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

98 lines
5.1 KiB
Plaintext

LayoutBox node=#1 tag=html box=block
content: (0, 0, 800, 110.4)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#9 tag=body box=block
content: (8, 8, 784, 86.4)
padding: 0 0 0 0
border: 0 0 0 0
margin: 8 8 8 8
LayoutBox node=#11 tag=aside box=block
content: (540.8, 9, 235.20001, 96.96001)
padding: 0 15 0 15
border: 1 1 1 1
margin: 0 0 0 15
LayoutBox node=#13 tag=h4 box=block
content: (540.8, 30.28, 235.20001, 19.200003)
padding: 0 0 0 0
border: 0 0 0 0
margin: 21.28 0 21.28 0
inline_context: 1 lines, height=19.200003, max_width=87.953
line[0]: rect=(540.8, 30.28, 87.953, 19.2) fragments=4
frag[0]: rect=(540.8, 31.880001, 23.823788, 16) text="This" start=false end=false
frag[1]: rect=(567.6781, 31.880001, 9.409692, 16) text="is" start=false end=false
frag[2]: rect=(580.14215, 31.880001, 14.672541, 16) text="an" start=false end=false
frag[3]: rect=(597.869, 31.880001, 30.883995, 16) text="aside" start=false end=false
LayoutBox node=#14 tag=anonymous box=anon
content: (501.8, 0, 87.95301, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "This is an aside"
LayoutBox node=#16 tag=p box=block
content: (540.8, 70.76, 235.20001, 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=107.00734
line[0]: rect=(540.8, 70.76, 107.00734, 19.2) fragments=3
frag[0]: rect=(540.8, 72.36, 30.014685, 16) text="Aside" start=false end=false
frag[1]: rect=(573.869, 72.36, 42.372982, 16) text="content" start=false end=false
frag[2]: rect=(619.2963, 72.36, 28.511015, 16) text="here." start=false end=false
LayoutBox node=#17 tag=anonymous box=anon
content: (501.8, 0, 107.00733, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Aside content here."
LayoutBox node=#20 tag=p box=block
content: (8, 24, 784, 19.2)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
inline_context: 1 lines, height=19.2, max_width=405.79138
line[0]: rect=(8, 24, 405.79138, 19.2) fragments=13
frag[0]: rect=(8, 25.6, 27.535978, 16) text="Main" start=false end=false
frag[1]: rect=(38.590313, 25.6, 42.372982, 16) text="content" start=false end=false
frag[2]: rect=(84.017624, 25.6, 22.331863, 16) text="that" start=false end=false
frag[3]: rect=(109.40382, 25.6, 29.039646, 16) text="flows" start=false end=false
frag[4]: rect=(141.4978, 25.6, 40.293686, 16) text="around" start=false end=false
frag[5]: rect=(184.84583, 25.6, 18.126286, 16) text="the" start=false end=false
frag[6]: rect=(206.02644, 25.6, 38.860497, 16) text="floated" start=false end=false
frag[7]: rect=(247.94127, 25.6, 29.098385, 16) text="aside" start=false end=false
frag[8]: rect=(280.09396, 25.6, 45.392067, 16) text="element" start=false end=false
frag[9]: rect=(328.54034, 25.6, 14.367107, 16) text="on" start=false end=false
frag[10]: rect=(345.96176, 25.6, 18.126286, 16) text="the" start=false end=false
frag[11]: rect=(367.14236, 25.6, 17.938326, 16) text="left" start=false end=false
frag[12]: rect=(388.135, 25.6, 25.656387, 16) text="side." start=false end=false
LayoutBox node=#21 tag=anonymous box=anon
content: (0, 0, 405.79138, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Main content that fl..."
LayoutBox node=#23 tag=p box=block
content: (8, 59.2, 784, 19.2)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
inline_context: 1 lines, height=19.2, max_width=389.14536
line[0]: rect=(8, 59.2, 389.14536, 19.2) fragments=10
frag[0]: rect=(8, 60.800003, 40.305435, 16) text="Second" start=false end=false
frag[1]: rect=(51.359768, 60.800003, 58.408222, 16) text="paragraph" start=false end=false
frag[2]: rect=(112.82232, 60.800003, 11.148312, 16) text="of" start=false end=false
frag[3]: rect=(127.024956, 60.800003, 27.864904, 16) text="main" start=false end=false
frag[4]: rect=(157.9442, 60.800003, 42.372982, 16) text="content" start=false end=false
frag[5]: rect=(203.37152, 60.800003, 54.049923, 16) text="continues" start=false end=false
frag[6]: rect=(260.47577, 60.800003, 40.928047, 16) text="flowing" start=false end=false
frag[7]: rect=(304.45813, 60.800003, 40.293686, 16) text="around" start=false end=false
frag[8]: rect=(347.80615, 60.800003, 18.126286, 16) text="the" start=false end=false
frag[9]: rect=(368.98676, 60.800003, 28.158588, 16) text="float." start=false end=false
LayoutBox node=#24 tag=anonymous box=anon
content: (0, 0, 389.1454, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Second paragraph of ..."