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>
98 lines
4.6 KiB
Plaintext
98 lines
4.6 KiB
Plaintext
LayoutBox node=#1 tag=html box=block
|
|
content: (0, 0, 800, 92.8)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#8 tag=body box=block
|
|
content: (8, 8, 784, 76.8)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 8 8 8 8
|
|
LayoutBox node=#10 tag=div box=block
|
|
content: (8, 8, 784, 76.8)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#12 tag=div box=block
|
|
content: (8, 8, 784, 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=153.91483
|
|
line[0]: rect=(8, 8, 153.91483, 19.2) fragments=5
|
|
frag[0]: rect=(8, 9.6, 32.963287, 16) text="Direct" start=false end=false
|
|
frag[1]: rect=(44.01762, 9.6, 26.18502, 16) text="child" start=false end=false
|
|
frag[2]: rect=(73.256966, 9.6, 41.033775, 16) text="(should" start=false end=false
|
|
frag[3]: rect=(117.34507, 9.6, 13.85022, 16) text="be" start=false end=false
|
|
frag[4]: rect=(134.24962, 9.6, 27.6652, 16) text="blue)" start=false end=false
|
|
LayoutBox node=#13 tag=anonymous box=anon
|
|
content: (0, 0, 153.91483, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Direct child (should..."
|
|
LayoutBox node=#15 tag=div box=block
|
|
content: (8, 27.2, 784, 19.2)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#17 tag=div box=block
|
|
content: (8, 27.2, 784, 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=207.04846
|
|
line[0]: rect=(8, 27.2, 207.04846, 19.2) fragments=8
|
|
frag[0]: rect=(8, 28.800001, 24.634361, 16) text="NOT" start=false end=false
|
|
frag[1]: rect=(35.688694, 28.800001, 6.590308, 16) text="a" start=false end=false
|
|
frag[2]: rect=(45.333336, 28.800001, 31.612335, 16) text="direct" start=false end=false
|
|
frag[3]: rect=(80, 28.800001, 26.18502, 16) text="child" start=false end=false
|
|
frag[4]: rect=(109.23935, 28.800001, 11.148312, 16) text="of" start=false end=false
|
|
frag[5]: rect=(123.44199, 28.800001, 39.94126, 16) text=".parent" start=false end=false
|
|
frag[6]: rect=(166.43759, 28.800001, 17.891336, 16) text="(no" start=false end=false
|
|
frag[7]: rect=(187.38327, 28.800001, 27.6652, 16) text="blue)" start=false end=false
|
|
LayoutBox node=#18 tag=anonymous box=anon
|
|
content: (0, 0, 207.04848, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "NOT a direct child o..."
|
|
LayoutBox node=#21 tag=div box=block
|
|
content: (8, 46.4, 784, 19.200005)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
inline_context: 1 lines, height=19.200005, max_width=143.02496
|
|
line[0]: rect=(8, 46.4, 143.02496, 19.2) fragments=3
|
|
frag[0]: rect=(8, 48, 32.963287, 16) text="Direct" start=false end=false
|
|
frag[1]: rect=(44.01762, 48, 64.317184, 16) text="descendant" start=false end=false
|
|
frag[2]: rect=(111.38914, 48, 39.635826, 16) text="(green)" start=false end=false
|
|
LayoutBox node=#22 tag=anonymous box=anon
|
|
content: (0, 0, 143.02496, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Direct descendant (g..."
|
|
LayoutBox node=#24 tag=div box=block
|
|
content: (8, 65.600006, 784, 19.199997)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
LayoutBox node=#26 tag=div box=block
|
|
content: (8, 65.600006, 784, 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=174.74303
|
|
line[0]: rect=(8, 65.600006, 174.74303, 19.2) fragments=4
|
|
frag[0]: rect=(8, 67.200005, 39.27166, 16) text="Nested" start=false end=false
|
|
frag[1]: rect=(50.325993, 67.200005, 64.317184, 16) text="descendant" start=false end=false
|
|
frag[2]: rect=(117.6975, 67.200005, 25.879587, 16) text="(also" start=false end=false
|
|
frag[3]: rect=(146.63142, 67.200005, 36.111603, 16) text="green)" start=false end=false
|
|
LayoutBox node=#27 tag=anonymous box=anon
|
|
content: (0, 0, 174.74303, 16)
|
|
padding: 0 0 0 0
|
|
border: 0 0 0 0
|
|
margin: 0 0 0 0
|
|
text: "Nested descendant (a..."
|