mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-05 16:14:38 +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.
34 lines
2.0 KiB
Plaintext
34 lines
2.0 KiB
Plaintext
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|
BlockContainer <html> at (0,0) content-size 800x616 [BFC] children: not-inline
|
|
BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <body> at (8,8) content-size 784x600 children: not-inline
|
|
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
TableWrapper <(anonymous)> at (8,8) content-size 1200x600 [BFC] children: not-inline
|
|
Box <div.aligncenter.block-image> at (8,8) content-size 1200x600 table-box [TFC] children: inline
|
|
Box <(anonymous)> at (8,8) content-size 1200x600 table-row children: inline
|
|
BlockContainer <(anonymous)> at (8,8) content-size 1200x600 table-cell [BFC] children: inline
|
|
TextNode <#text>
|
|
InlineNode <a>
|
|
frag 0 from ImageBox start: 0, length: 0, rect: [8,8 1200x600] baseline: 600
|
|
TextNode <#text>
|
|
ImageBox <img> at (8,8) content-size 1200x600 children: not-inline
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,608) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
|
|
ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 1208x616]
|
|
PaintableWithLines (BlockContainer<HTML>) [0,0 800x616] overflow: [0,0 1208x616]
|
|
PaintableWithLines (BlockContainer(anonymous)) [0,0 800x0]
|
|
PaintableWithLines (BlockContainer<BODY>) [8,8 784x600] overflow: [8,8 1200x600]
|
|
PaintableWithLines (BlockContainer(anonymous)) [8,8 784x0]
|
|
PaintableWithLines (TableWrapper(anonymous)) [8,8 1200x600]
|
|
PaintableBox (Box<DIV>.aligncenter.block-image) [8,8 1200x600]
|
|
PaintableBox (Box(anonymous)) [8,8 1200x600]
|
|
PaintableWithLines (BlockContainer(anonymous)) [8,8 1200x600]
|
|
PaintableWithLines (InlineNode<A>)
|
|
ImagePaintable (ImageBox<IMG>) [8,8 1200x600]
|
|
PaintableWithLines (BlockContainer(anonymous)) [8,608 784x0]
|