mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
Previously, we were collapsing whitespace in Layout::TextNode and then
passed the resulting string for further processing through ChunkIterator
-> InlineLevelIterator -> InlineFormattingContext -> LineBuilder ->
LineBoxFragment -> PaintableFragment. Our painting tree is where we deal
with things like range offsets into the underlying text nodes, but since
we modified the original string, the offsets were wrong.
This changes the way we generate fragments:
* Layout::TextNode no longer collapses whitespace as part of its
stored "text for rendering", but moves this logic to ChunkIterator
which splits up this text into separate views whenever whitespace
needs to be collapsed.
* Layout::LineBox now only extends the last fragment if its end offset
is equal to the new fragment's start offset. Otherwise, there's a
gap caused by collapsing whitespace and we need to generate a
separate fragment for that in order to have a correct start offset.
Some tests need new baselines because of the fixed start offsets.
Fixes #566.
57 lines
4.3 KiB
Plaintext
57 lines
4.3 KiB
Plaintext
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] children: not-inline
|
|
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 304 0+0+0] [BFC] children: not-inline
|
|
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 288 0+0+8] children: not-inline
|
|
BlockContainer <div.margin-left> at [243.1875,8] [235.1875+0+0 548.8125 0+0+0] [0+0+0 162 0+0+0] children: inline
|
|
frag 0 from TextNode start: 2, length: 62, rect: [243.1875,8 515.390625x18] baseline: 13.796875
|
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce"
|
|
frag 1 from TextNode start: 65, length: 68, rect: [243.1875,26 543.484375x18] baseline: 13.796875
|
|
"cursus est eget nisl porta, id vulputate velit imperdiet. Vestibulum"
|
|
frag 2 from TextNode start: 134, length: 69, rect: [243.1875,44 533.765625x18] baseline: 13.796875
|
|
"mollis ligula sit amet ligula aliquam, vitae vulputate magna iaculis."
|
|
frag 3 from TextNode start: 204, length: 68, rect: [243.1875,62 533.015625x18] baseline: 13.796875
|
|
"Nulla et augue fringilla, molestie nulla blandit, condimentum risus."
|
|
frag 4 from TextNode start: 273, length: 58, rect: [243.1875,80 488.140625x18] baseline: 13.796875
|
|
"Suspendisse lectus augue, sodales vitae metus ac, interdum"
|
|
frag 5 from TextNode start: 332, length: 63, rect: [243.1875,98 526.546875x18] baseline: 13.796875
|
|
"volutpat arcu. Aenean eu placerat risus, at dictum lectus. Nunc"
|
|
frag 6 from TextNode start: 396, length: 64, rect: [243.1875,116 524.5x18] baseline: 13.796875
|
|
"maximus est eu risus porta tincidunt. Cras nec felis tellus. Sed"
|
|
frag 7 from TextNode start: 461, length: 66, rect: [243.1875,134 523.078125x18] baseline: 13.796875
|
|
"euismod ultricies ipsum, eget ultricies nisl dignissim nec. Mauris"
|
|
frag 8 from TextNode start: 528, length: 21, rect: [243.1875,152 178.53125x18] baseline: 13.796875
|
|
"aliquet rhoncus urna."
|
|
TextNode <#text> (not painted)
|
|
BlockContainer <(anonymous)> at [8,170] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
|
|
TextNode <#text> (not painted)
|
|
BlockContainer <div.margin-right> at [8,170] [0+0+0 548.8125 0+0+235.1875] [0+0+0 126 0+0+0] children: inline
|
|
frag 0 from TextNode start: 1, length: 63, rect: [8,170 531.765625x18] baseline: 13.796875
|
|
"Pellentesque quis vulputate urna. Mauris semper elementum velit"
|
|
frag 1 from TextNode start: 65, length: 62, rect: [8,188 529.640625x18] baseline: 13.796875
|
|
"vitae accumsan. Fusce aliquam nunc non suscipit laoreet. Etiam"
|
|
frag 2 from TextNode start: 128, length: 66, rect: [8,206 532.9375x18] baseline: 13.796875
|
|
"hendrerit sollicitudin nisl non placerat. Cras vulputate, nunc non"
|
|
frag 3 from TextNode start: 195, length: 64, rect: [8,224 515.765625x18] baseline: 13.796875
|
|
"fringilla dapibus, nisl eros volutpat enim, eget consequat lacus"
|
|
frag 4 from TextNode start: 260, length: 62, rect: [8,242 513.421875x18] baseline: 13.796875
|
|
"turpis imperdiet mi. Aenean vitae consequat tellus, eu sodales"
|
|
frag 5 from TextNode start: 323, length: 57, rect: [8,260 481.359375x18] baseline: 13.796875
|
|
"tortor. Duis euismod, odio auctor varius auctor, mi augue"
|
|
frag 6 from TextNode start: 381, length: 56, rect: [8,278 469.453125x18] baseline: 13.796875
|
|
"faucibus erat, non euismod turpis metus sit amet turpis."
|
|
TextNode <#text> (not painted)
|
|
BlockContainer <(anonymous)> at [8,296] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
|
|
TextNode <#text> (not painted)
|
|
|
|
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
|
PaintableWithLines (BlockContainer<HTML>) [0,0 800x304]
|
|
PaintableWithLines (BlockContainer<BODY>) [8,8 784x288]
|
|
PaintableWithLines (BlockContainer<DIV>.margin-left) [243.1875,8 548.8125x162]
|
|
TextPaintable (TextNode<#text>)
|
|
PaintableWithLines (BlockContainer(anonymous)) [8,170 784x0]
|
|
PaintableWithLines (BlockContainer<DIV>.margin-right) [8,170 548.8125x126]
|
|
TextPaintable (TextNode<#text>)
|
|
PaintableWithLines (BlockContainer(anonymous)) [8,296 784x0]
|
|
|
|
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)
|
|
SC for BlockContainer<HTML> [0,0 800x304] [children: 0] (z-index: auto)
|