Files
rust_browser/tests/goldens/expected/276-insertion-mode-transitions.layout.txt
Zachary D. Rowitsch d5234cf546 Implement HTML5 tree builder insertion modes with code review fixes (§13.2.6)
Refactor tree_builder.rs into module directory with 7 files implementing all
23 insertion modes per WHATWG HTML §13.2.6.4 as an explicit state machine.
Includes active formatting elements list with Noah's Ark clause, scope
checking for all 5 scope types, context-sensitive fragment parsing, and
iterative token reprocessing via ProcessResult enum.

Code review fixes: fix formatting element end tag truncation bug (save
node_id before truncate), replace manual element creation in catch-all
StartTag with insert_element_maybe_self_closing, add skip_next_newline for
pre/listing/textarea per spec, add QuirksMode to Document with basic DOCTYPE
detection, refactor all 23 handlers from Token to &Token to eliminate clone
per dispatch, fix self_closing handling for pre/listing/textarea/plaintext,
improve golden test 276 fixture coverage and foster-parent test assertion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:12:19 -04:00

335 lines
14 KiB
Plaintext

LayoutBox node=#1 tag=html box=block
content: (0, 0, 800, 530.0001)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#11 tag=body box=block
content: (8, 8, 784, 506.00012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 8 8 8 8
LayoutBox node=#13 tag=h1 box=block
content: (8, 8, 784, 38.4)
padding: 0 0 0 0
border: 0 0 0 0
margin: 4 0 4 0
inline_context: 1 lines, height=38.4, max_width=51.806168
line[0]: rect=(8, 8, 51.806168, 38.4) fragments=1
frag[0]: rect=(8, 11.200001, 51.806168, 32) text="Title" start=false end=false
LayoutBox node=#14 tag=anonymous box=anon
content: (0, -4, 51.806168, 32)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Title"
LayoutBox node=#15 tag=h2 box=block
content: (8, 50.4, 784, 28.800003)
padding: 0 0 0 0
border: 0 0 0 0
margin: 4 0 4 0
inline_context: 1 lines, height=28.800003, max_width=68.63435
line[0]: rect=(8, 50.4, 68.63435, 28.800001) fragments=1
frag[0]: rect=(8, 52.800003, 68.63435, 24) text="Subtitle" start=false end=false
LayoutBox node=#16 tag=anonymous box=anon
content: (0, 0, 68.63435, 24)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Subtitle"
LayoutBox node=#18 tag=p box=block
content: (8, 95.200005, 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=67.65345
line[0]: rect=(8, 95.200005, 67.65345, 19.2) fragments=2
frag[0]: rect=(8, 96.8, 36.88693, 16) text="Before" start=false end=false
frag[1]: rect=(47.94126, 96.8, 27.71219, 16) text="table" start=false end=false
LayoutBox node=#19 tag=anonymous box=anon
content: (0, 0, 67.65345, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Before table"
LayoutBox node=#21 tag=table box=table
content: (9, 131.40001, 94.61087, 112.8)
padding: 0 0 0 0
border: 1 1 1 1
margin: 0 0 0 0
LayoutBox node=#23 tag=caption box=table-caption
content: (9, 131.40001, 94.61087, 19.199997)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.199997, max_width=75.935394
line[0]: rect=(18.337738, 131.40001, 75.935394, 19.2) fragments=2
frag[0]: rect=(18.337738, 133.00002, 30.00294, 16) text="Table" start=false end=false
frag[1]: rect=(51.395008, 133.00002, 42.87812, 16) text="Caption" start=false end=false
LayoutBox node=#24 tag=anonymous box=anon
content: (0, 0, 75.935394, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Table Caption"
LayoutBox node=#29 tag=thead box=table-row-group
content: (9, 152.6, 94.61087, 27.199997)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#30 tag=tr box=table-row
content: (9, 152.6, 94.61087, 27.2)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#31 tag=th box=table-cell
content: (15, 156.6, 42.725403, 19.2)
padding: 4 4 4 4
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.2, max_width=42.725403
line[0]: rect=(15, 156.6, 42.725403, 19.2) fragments=1
frag[0]: rect=(15, 156.6, 42.725403, 16) text="Header" start=false end=false
LayoutBox node=#32 tag=anonymous box=anon
content: (0, 156.6, 42.725403, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Header"
LayoutBox node=#34 tag=tbody box=table-row-group
content: (9, 181.8, 94.61087, 27.199997)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#35 tag=tr box=table-row
content: (9, 181.8, 94.61087, 27.2)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#36 tag=td box=table-cell
content: (15, 185.8, 42.725403, 19.2)
padding: 4 4 4 4
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.2, max_width=29.885468
line[0]: rect=(15, 185.8, 29.885468, 19.2) fragments=2
frag[0]: rect=(15, 185.8, 20.111603, 16) text="Cell" start=false end=false
frag[1]: rect=(38.165936, 185.8, 6.71953, 16) text="1" start=false end=false
LayoutBox node=#37 tag=anonymous box=anon
content: (0, 185.8, 29.885466, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Cell 1"
LayoutBox node=#38 tag=td box=table-cell
content: (67.7254, 185.8, 29.885468, 19.2)
padding: 4 4 4 4
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.2, max_width=29.88546
line[0]: rect=(67.7254, 185.8, 29.88546, 19.2) fragments=2
frag[0]: rect=(67.7254, 185.8, 20.111603, 16) text="Cell" start=false end=false
frag[1]: rect=(90.891335, 185.8, 6.71953, 16) text="2" start=false end=false
LayoutBox node=#39 tag=anonymous box=anon
content: (0, 185.8, 29.885466, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Cell 2"
LayoutBox node=#41 tag=tbody box=table-row-group
content: (9, 211, 94.61087, 31.199997)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#42 tag=tr box=table-row
content: (9, 211, 94.61087, 31.2)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#43 tag=td box=table-cell
content: (15, 215, 42.725403, 23.2)
padding: 4 4 4 4
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=23.2, max_width=11.506607
line[0]: rect=(15, 215, 11.506607, 23.2) fragments=1
frag[0]: rect=(15, 215, 11.506608, 23.2) text=(none) start=false end=false
LayoutBox node=#44 tag=select box=inline-block
content: (17, 217, 7.506608, 19.2)
padding: 1 1 1 1
border: 1 1 1 1
margin: 0 0 0 0
inline_context: 1 lines, height=19.2, max_width=7.506607
line[0]: rect=(17, 217, 7.506607, 19.2) fragments=1
frag[0]: rect=(17, 218.6, 7.506608, 16) text="A" start=false end=false
LayoutBox node=#44 tag=anonymous box=anon
content: (0, 215, 0, 0)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "A"
LayoutBox node=#49 tag=td box=table-cell
content: (67.7254, 215, 29.885468, 23.2)
padding: 4 4 4 4
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.2, max_width=27.019089
line[0]: rect=(67.7254, 215, 27.019089, 19.2) fragments=1
frag[0]: rect=(67.7254, 215, 27.01909, 16) text="Plain" start=false end=false
LayoutBox node=#50 tag=anonymous box=anon
content: (0, 215, 27.01909, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Plain"
LayoutBox node=#53 tag=p box=block
content: (8, 261.2, 784, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
inline_context: 1 lines, height=19.200012, max_width=58.29075
line[0]: rect=(8, 261.2, 58.29075, 19.2) fragments=1
frag[0]: rect=(8, 262.80002, 58.29075, 16) text="Paragraph" start=false end=false
LayoutBox node=#54 tag=anonymous box=anon
content: (0, 0, 58.29075, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Paragraph"
LayoutBox node=#55 tag=div box=block
content: (8, 296.40002, 784, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.200012, max_width=122.98384
line[0]: rect=(8, 296.40002, 122.98384, 19.2) fragments=3
frag[0]: rect=(8, 298.00003, 29.685757, 16) text="Block" start=false end=false
frag[1]: rect=(40.74009, 298.00003, 28.781204, 16) text="splits" start=false end=false
frag[2]: rect=(72.57562, 298.00003, 58.408222, 16) text="paragraph" start=false end=false
LayoutBox node=#56 tag=anonymous box=anon
content: (0, 0, 122.98386, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Block splits paragra..."
LayoutBox node=#57 tag=p box=block
content: (8, 331.60004, 784, 0)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
inline_context: 0 lines, height=0, max_width=0
LayoutBox node=#59 tag=dl box=block
content: (8, 331.60004, 784, 76.80005)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
LayoutBox node=#60 tag=dt box=block
content: (8, 331.60004, 784, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.200012, max_width=28.992657
line[0]: rect=(8, 331.60004, 28.992657, 19.2) fragments=1
frag[0]: rect=(8, 333.20004, 28.992657, 16) text="Term" start=false end=false
LayoutBox node=#61 tag=anonymous box=anon
content: (0, 0, 28.992657, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Term"
LayoutBox node=#62 tag=dd box=block
content: (48, 350.80005, 744, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 40
inline_context: 1 lines, height=19.200012, max_width=54.202644
line[0]: rect=(48, 350.80005, 54.202644, 19.2) fragments=1
frag[0]: rect=(48, 352.40005, 54.202644, 16) text="Definition" start=false end=false
LayoutBox node=#63 tag=anonymous box=anon
content: (0, 0, 54.202644, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Definition"
LayoutBox node=#64 tag=dt box=block
content: (8, 370.00006, 784, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 1 lines, height=19.200012, max_width=38.766518
line[0]: rect=(8, 370.00006, 38.766518, 19.2) fragments=2
frag[0]: rect=(8, 371.60007, 28.992657, 16) text="Term" start=false end=false
frag[1]: rect=(40.04699, 371.60007, 6.71953, 16) text="2" start=false end=false
LayoutBox node=#65 tag=anonymous box=anon
content: (0, 0, 38.766518, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Term 2"
LayoutBox node=#66 tag=dd box=block
content: (48, 389.20007, 744, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 40
inline_context: 1 lines, height=19.200012, max_width=29.016151
line[0]: rect=(48, 389.20007, 29.016151, 19.2) fragments=2
frag[0]: rect=(48, 390.80008, 19.24229, 16) text="Def" start=false end=false
frag[1]: rect=(70.29662, 390.80008, 6.71953, 16) text="2" start=false end=false
LayoutBox node=#67 tag=anonymous box=anon
content: (0, 0, 29.016153, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Def 2"
LayoutBox node=#69 tag=ul box=block
content: (48, 424.4001, 744, 38.400024)
padding: 0 0 0 40
border: 0 0 0 0
margin: 16 0 16 0
LayoutBox node=#70 tag=li box=block
content: (48, 424.4001, 744, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
marker: "•"
inline_context: 1 lines, height=19.200012, max_width=35.606453
line[0]: rect=(48, 424.4001, 35.606453, 19.2) fragments=2
frag[0]: rect=(48, 426.0001, 25.832598, 16) text="Item" start=false end=false
frag[1]: rect=(76.886925, 426.0001, 6.71953, 16) text="1" start=false end=false
LayoutBox node=#71 tag=anonymous box=anon
content: (0, 0, 35.60646, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Item 1"
LayoutBox node=#72 tag=li box=block
content: (48, 443.6001, 744, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
marker: "•"
inline_context: 1 lines, height=19.200012, max_width=35.606453
line[0]: rect=(48, 443.6001, 35.606453, 19.2) fragments=2
frag[0]: rect=(48, 445.2001, 25.832598, 16) text="Item" start=false end=false
frag[1]: rect=(76.886925, 445.2001, 6.71953, 16) text="2" start=false end=false
LayoutBox node=#73 tag=anonymous box=anon
content: (0, 0, 35.60646, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "Item 2"
LayoutBox node=#75 tag=p box=block
content: (8, 478.8001, 784, 19.200012)
padding: 0 0 0 0
border: 0 0 0 0
margin: 16 0 16 0
inline_context: 1 lines, height=19.200012, max_width=58.03231
line[0]: rect=(8, 478.8001, 58.03231, 19.2) fragments=2
frag[0]: rect=(8, 480.40012, 27.265785, 16) text="After" start=false end=false
frag[1]: rect=(38.320118, 480.40012, 27.71219, 16) text="table" start=false end=false
LayoutBox node=#76 tag=anonymous box=anon
content: (0, 0, 58.032307, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "After table"