mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 07:32:52 +00:00
InlinePaintable was an ad-hoc paintable type required to support the fragmentation of inline nodes across multiple lines. It existed because there was no way to associate multiple paintables with a single layout node. This resulted in a lot of duplicated code between PaintableBox and InlinePaintable. For example, most of the CSS properties like background, border, shadows, etc. and hit-testing are almost identical for both of them. However, the code had to be duplicated to account for the fact that InlinePaintable creates a box for each line. And we had quite many places that operate on paintables with a code like: ``` if (box.is_paintable_box()) { // do something } else (box.is_inline_paintable()) { // do exactly the same as for paintable box but using InlinePaintable } ``` This change replaces the usage of `InlinePaintable` with `PaintableWithLines` created for each line, which is now possible because we support having multiple paintables per layout node. By doing that, we remove lots of duplicated code and bring our implementation closer to the spec.
19 lines
1.1 KiB
Text
19 lines
1.1 KiB
Text
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|
BlockContainer <html> at (0,0) content-size 800x63 [BFC] children: not-inline
|
|
BlockContainer <body> at (8,8) content-size 784x47 children: not-inline
|
|
BlockContainer <main> at (8,8) content-size 784x47 children: inline
|
|
frag 0 from BlockContainer start: 0, length: 0, rect: [23,23 343.96875x17] baseline: 28.296875
|
|
BlockContainer <div> at (23,23) content-size 343.96875x17 inline-block [BFC] children: inline
|
|
InlineNode <span>
|
|
frag 0 from TextNode start: 0, length: 42, rect: [23,23 343.96875x17] baseline: 13.296875
|
|
"hello :host and :host(<compound-selector>)"
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
|
|
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
|
PaintableWithLines (BlockContainer<HTML>) [0,0 800x63]
|
|
PaintableWithLines (BlockContainer<BODY>) [8,8 784x47]
|
|
PaintableWithLines (BlockContainer<MAIN>) [8,8 784x47]
|
|
PaintableWithLines (BlockContainer<DIV>) [8,8 373.96875x47]
|
|
PaintableWithLines (InlineNode<SPAN>)
|
|
TextPaintable (TextNode<#text>)
|