Add parent-first-child top and parent-last-child bottom margin collapsing using a two-level approach (Level A shifts child inside parent, Level B adjusts grandparent for effective collapsed margin). Fix pre-existing bug in shift_subtree_x that incorrectly skipped absolute/fixed children. Extract shared MARGIN_EPSILON constant, add 9 unit tests and 4 golden tests (209-212), promote 31 WPT tests to pass. Includes code review fixes: pub(crate) visibility for is_root_element, known-limitation docs, and inline-content shift test coverage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
101 lines
4.2 KiB
Plaintext
101 lines
4.2 KiB
Plaintext
LayoutBox node=#1 tag=html box=block
|
|
content: (0, 0, 800, 318.8544)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#3 tag=body box=block
|
|
content: (8, 21.44, 784, 272.4368)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 8 8 8 8
|
|
LayoutBox node=#5 tag=h1 box=block
|
|
content: (8, 21.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=117.61528
|
|
line[0]: rect=(8, 21.44, 117.61528, 38.4) fragments=2
|
|
frag[0]: rect=(8, 24.64, 98.06755, 32) text="Heading" start=false end=false
|
|
frag[1]: rect=(112.176216, 24.64, 13.43906, 32) text="1" start=false end=false
|
|
LayoutBox node=#6 tag=anonymous box=anon
|
|
content: (0, -8, 117.61528, 32)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Heading 1"
|
|
LayoutBox node=#8 tag=h2 box=block
|
|
content: (8, 81.28001, 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=88.21145
|
|
line[0]: rect=(8, 81.28001, 88.21145, 28.800001) fragments=2
|
|
frag[0]: rect=(8, 83.68001, 73.55066, 24) text="Heading" start=false end=false
|
|
frag[1]: rect=(86.13216, 83.68001, 10.079295, 24) text="2" start=false end=false
|
|
LayoutBox node=#9 tag=anonymous box=anon
|
|
content: (0, 13.440001, 88.21145, 24)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Heading 2"
|
|
LayoutBox node=#11 tag=h3 box=block
|
|
content: (8, 130, 784, 22.463997)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 18.72 0 18.72 0
|
|
inline_context: 1 lines, height=22.463997, max_width=68.80493
|
|
line[0]: rect=(8, 130, 68.80493, 22.464003) fragments=2
|
|
frag[0]: rect=(8, 131.87201, 57.369514, 18.72) text="Heading" start=false end=false
|
|
frag[1]: rect=(68.943085, 131.87201, 7.86185, 18.72) text="3" start=false end=false
|
|
LayoutBox node=#12 tag=anonymous box=anon
|
|
content: (0, 13.440001, 68.80493, 18.72)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Heading 3"
|
|
LayoutBox node=#14 tag=h4 box=block
|
|
content: (8, 173.744, 784, 19.199997)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 21.28 0 21.28 0
|
|
inline_context: 1 lines, height=19.199997, max_width=58.80764
|
|
line[0]: rect=(8, 173.744, 58.80764, 19.2) fragments=2
|
|
frag[0]: rect=(8, 175.34401, 49.033775, 16) text="Heading" start=false end=false
|
|
frag[1]: rect=(60.088108, 175.34401, 6.71953, 16) text="4" start=false end=false
|
|
LayoutBox node=#15 tag=anonymous box=anon
|
|
content: (0, 13.440001, 58.80764, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Heading 4"
|
|
LayoutBox node=#17 tag=h5 box=block
|
|
content: (8, 215.1216, 784, 15.936005)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 22.177599 0 22.177599 0
|
|
inline_context: 1 lines, height=15.936005, max_width=48.810337
|
|
line[0]: rect=(8, 215.1216, 48.810337, 15.936) fragments=2
|
|
frag[0]: rect=(8, 216.4496, 40.698032, 13.28) text="Heading" start=false end=false
|
|
frag[1]: rect=(51.233128, 216.4496, 5.57721, 13.28) text="5" start=false end=false
|
|
LayoutBox node=#18 tag=anonymous box=anon
|
|
content: (0, 13.440001, 48.810337, 13.28)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Heading 5"
|
|
LayoutBox node=#20 tag=h6 box=block
|
|
content: (8, 256.0352, 784, 12.863998)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 24.9776 0 24.9776 0
|
|
inline_context: 1 lines, height=12.863998, max_width=39.401115
|
|
line[0]: rect=(8, 256.0352, 39.401115, 12.864001) fragments=2
|
|
frag[0]: rect=(8, 257.1072, 32.852627, 10.72) text="Heading" start=false end=false
|
|
frag[1]: rect=(42.89903, 257.1072, 4.502085, 10.72) text="6" start=false end=false
|
|
LayoutBox node=#21 tag=anonymous box=anon
|
|
content: (0, 13.440001, 39.401115, 10.72)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Heading 6"
|