1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

LibWeb: Make Layout::TextNode::text_for_rendering() lazily computed

As it turns out, Layout::TreeBuilder never managed to wrap text within
table boxes in anonymous wrapper boxes, since it relied on checking
text_for_rendering(), and that was never initialized during that early
stage of tree building.

This patch fixes the issue by making text_for_rendering() compute the
(potentially collapsed) text lazily when called.

Note that the test included with this patch is still totally wrong,
but that is now a TFC problem rather than a TreeBuilder problem. :^)
This commit is contained in:
Andreas Kling 2023-07-03 10:29:30 +02:00
parent 5cdb394400
commit b918ce4022
5 changed files with 69 additions and 7 deletions

View file

@ -0,0 +1,18 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x216 [BFC] children: not-inline
TableWrapper <(anonymous)> at (9,9) content-size 300x200 [BFC] children: not-inline
Box <body.table> at (10,10) content-size 298x198 table-box [TFC] children: not-inline
Box <div.bottom> at (10,10) content-size 298x0 table-footer-group children: inline
Box <(anonymous)> at (10,10) content-size 298x0 table-row children: inline
BlockContainer <(anonymous)> at (10,10) content-size 298x0 table-cell [BFC] children: inline
line 0 width: 56.109375, height: 0, bottom: 0, baseline: 4.796875
frag 0 from TextNode start: 0, length: 6, rect: [10,10 56.109375x0]
"bottom"
TextNode <#text>
Box <div.top> at (10,10) content-size 298x0 table-header-group children: inline
Box <(anonymous)> at (10,10) content-size 298x0 table-row children: inline
BlockContainer <(anonymous)> at (10,10) content-size 298x0 table-cell [BFC] children: inline
line 0 width: 26.640625, height: 0, bottom: 0, baseline: 4.796875
frag 0 from TextNode start: 0, length: 3, rect: [10,10 26.640625x0]
"top"
TextNode <#text>