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>
146 lines
6.3 KiB
Plaintext
146 lines
6.3 KiB
Plaintext
LayoutBox node=#1 tag=html box=block
|
|
content: (0, 0, 800, 100.8)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#6 tag=body box=block
|
|
content: (8, 8, 784, 84.8)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 8 8 8 8
|
|
LayoutBox node=#8 tag=table box=table
|
|
content: (8, 8, 110.998535, 84.8)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#10 tag=caption box=table-caption
|
|
content: (8, 8, 110.998535, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.2, max_width=68.95741
|
|
line[0]: rect=(29.020561, 8, 68.95741, 19.2) fragments=2
|
|
frag[0]: rect=(29.020561, 9.6, 23.024963, 16) text="Test" start=false end=false
|
|
frag[1]: rect=(55.099857, 9.6, 42.87812, 16) text="Caption" start=false end=false
|
|
LayoutBox node=#11 tag=anonymous box=anon
|
|
content: (0, 0, 68.95742, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Test Caption"
|
|
LayoutBox node=#13 tag=thead box=table-row-group
|
|
content: (8, 29.2, 110.998535, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#14 tag=tr box=table-row
|
|
content: (8, 29.2, 110.998535, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#15 tag=th box=table-cell
|
|
content: (10, 29.2, 52.499268, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.2, max_width=52.499268
|
|
line[0]: rect=(10, 29.2, 52.499268, 19.2) fragments=2
|
|
frag[0]: rect=(10, 29.2, 42.725403, 16) text="Header" start=false end=false
|
|
frag[1]: rect=(55.779736, 29.2, 6.71953, 16) text="1" start=false end=false
|
|
LayoutBox node=#16 tag=anonymous box=anon
|
|
content: (0, 29.2, 52.499268, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Header 1"
|
|
LayoutBox node=#17 tag=th box=table-cell
|
|
content: (64.49927, 29.2, 52.499268, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.2, max_width=52.49926
|
|
line[0]: rect=(64.49927, 29.2, 52.49926, 19.2) fragments=2
|
|
frag[0]: rect=(64.49927, 29.2, 42.725403, 16) text="Header" start=false end=false
|
|
frag[1]: rect=(110.279, 29.2, 6.71953, 16) text="2" start=false end=false
|
|
LayoutBox node=#18 tag=anonymous box=anon
|
|
content: (0, 29.2, 52.499268, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Header 2"
|
|
LayoutBox node=#20 tag=tbody box=table-row-group
|
|
content: (8, 50.4, 110.998535, 40.4)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#22 tag=tr box=table-row
|
|
content: (8, 50.4, 110.998535, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#23 tag=td box=table-cell
|
|
content: (10, 50.4, 52.499268, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.2, max_width=30.672543
|
|
line[0]: rect=(10, 50.4, 30.672543, 19.2) fragments=2
|
|
frag[0]: rect=(10, 50.4, 20.111603, 16) text="Cell" start=false end=false
|
|
frag[1]: rect=(33.165936, 50.4, 7.506608, 16) text="A" start=false end=false
|
|
LayoutBox node=#24 tag=anonymous box=anon
|
|
content: (0, 50.4, 30.672543, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Cell A"
|
|
LayoutBox node=#25 tag=td box=table-cell
|
|
content: (64.49927, 50.4, 52.499268, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.2, max_width=30.801758
|
|
line[0]: rect=(64.49927, 50.4, 30.801758, 19.2) fragments=2
|
|
frag[0]: rect=(64.49927, 50.4, 20.111603, 16) text="Cell" start=false end=false
|
|
frag[1]: rect=(87.6652, 50.4, 7.6358294, 16) text="B" start=false end=false
|
|
LayoutBox node=#26 tag=anonymous box=anon
|
|
content: (0, 50.4, 30.801765, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Cell B"
|
|
LayoutBox node=#28 tag=tr box=table-row
|
|
content: (8, 71.600006, 110.998535, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#29 tag=td box=table-cell
|
|
content: (10, 71.600006, 52.499268, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.2, max_width=30.590313
|
|
line[0]: rect=(10, 71.600006, 30.590313, 19.2) fragments=2
|
|
frag[0]: rect=(10, 71.600006, 20.111603, 16) text="Cell" start=false end=false
|
|
frag[1]: rect=(33.165936, 71.600006, 7.424376, 16) text="C" start=false end=false
|
|
LayoutBox node=#30 tag=anonymous box=anon
|
|
content: (0, 71.600006, 30.590311, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Cell C"
|
|
LayoutBox node=#31 tag=td box=table-cell
|
|
content: (64.49927, 71.600006, 52.499268, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.2, max_width=31.741554
|
|
line[0]: rect=(64.49927, 71.600006, 31.741554, 19.2) fragments=2
|
|
frag[0]: rect=(64.49927, 71.600006, 20.111603, 16) text="Cell" start=false end=false
|
|
frag[1]: rect=(87.6652, 71.600006, 8.5756235, 16) text="D" start=false end=false
|
|
LayoutBox node=#32 tag=anonymous box=anon
|
|
content: (0, 71.600006, 31.741558, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Cell D"
|