mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-22 16:09:23 +00:00
While 788d5368a7
took care of better text
marker positioning, this improves graphical marker positioning instead.
By looking at how Firefox and Chrome render markers, it's clear that
there are three parts to positioning a graphical marker:
* The containing space that the marker resides in;
* The marker dimensions;
* The distance between the marker and the start of the list item.
The space that the marker can be contained in, is the area to the left
of the list item with a height of the marker's line-height. The marker
dimensions are relative to the marker's font's pixel size: most of them
are a square at 35% of the font size, but the disclosure markers are
sized at 50% instead. Finally, the marker distance is always gauged at
50% of the font size.
So for example, a list item with `list-style-type: disc` and `font-size:
20px`, has 10px between its start and the right side of the marker, and
the marker's dimensions are 7x7.
The percentages I've chosen closely resemble how Firefox lays out its
list item markers.
66 lines
3.9 KiB
Text
66 lines
3.9 KiB
Text
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|
BlockContainer <html> at (0,0) content-size 800x104 [BFC] children: not-inline
|
|
BlockContainer <body> at (8,16) content-size 784x72 children: not-inline
|
|
BlockContainer <(anonymous)> at (8,16) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <ol> at (48,16) content-size 744x72 children: not-inline
|
|
BlockContainer <(anonymous)> at (48,16) content-size 744x0 children: inline
|
|
TextNode <#text>
|
|
ListItemBox <li> at (48,16) content-size 744x18 children: inline
|
|
frag 0 from TextNode start: 0, length: 5, rect: [48,16 47.21875x18] baseline: 13.796875
|
|
"Seven"
|
|
ListItemMarkerBox <(anonymous)> at (27,17) content-size 21.0625x16 children: not-inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (48,34) content-size 744x0 children: inline
|
|
TextNode <#text>
|
|
ListItemBox <li> at (48,34) content-size 744x18 children: inline
|
|
frag 0 from TextNode start: 0, length: 28, rect: [48,34 242.4375x18] baseline: 13.796875
|
|
"Minus one hundred and twelve"
|
|
ListItemMarkerBox <(anonymous)> at (8,35) content-size 40.328125x16 children: not-inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (48,52) content-size 744x0 children: inline
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
ListItemBox <li> at (48,52) content-size 744x18 children: inline
|
|
frag 0 from TextNode start: 0, length: 23, rect: [48,52 206.5x18] baseline: 13.796875
|
|
"Two to the power of ten"
|
|
ListItemMarkerBox <(anonymous)> at (3,53) content-size 44.84375x16 children: not-inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (48,70) content-size 744x0 children: inline
|
|
TextNode <#text>
|
|
ListItemBox <li> at (48,70) content-size 744x18 children: inline
|
|
frag 0 from TextNode start: 0, length: 6, rect: [48,70 51.34375x18] baseline: 13.796875
|
|
"Eleven"
|
|
ListItemMarkerBox <(anonymous)> at (23,71) content-size 25.03125x16 children: not-inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (48,88) content-size 744x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,104) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
|
|
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
|
PaintableWithLines (BlockContainer<HTML>) [0,0 800x104]
|
|
PaintableWithLines (BlockContainer<BODY>) [8,16 784x72]
|
|
PaintableWithLines (BlockContainer(anonymous)) [8,16 784x0]
|
|
PaintableWithLines (BlockContainer<OL>) [8,16 784x72]
|
|
PaintableWithLines (BlockContainer(anonymous)) [48,16 744x0]
|
|
PaintableWithLines (ListItemBox<LI>) [48,16 744x18]
|
|
MarkerPaintable (ListItemMarkerBox(anonymous)) [27,17 21.0625x16]
|
|
TextPaintable (TextNode<#text>)
|
|
PaintableWithLines (BlockContainer(anonymous)) [48,34 744x0]
|
|
PaintableWithLines (ListItemBox<LI>) [48,34 744x18]
|
|
MarkerPaintable (ListItemMarkerBox(anonymous)) [8,35 40.328125x16]
|
|
TextPaintable (TextNode<#text>)
|
|
PaintableWithLines (BlockContainer(anonymous)) [48,52 744x0]
|
|
PaintableWithLines (ListItemBox<LI>) [48,52 744x18]
|
|
MarkerPaintable (ListItemMarkerBox(anonymous)) [3,53 44.84375x16]
|
|
TextPaintable (TextNode<#text>)
|
|
PaintableWithLines (BlockContainer(anonymous)) [48,70 744x0]
|
|
PaintableWithLines (ListItemBox<LI>) [48,70 744x18]
|
|
MarkerPaintable (ListItemMarkerBox(anonymous)) [23,71 25.03125x16]
|
|
TextPaintable (TextNode<#text>)
|
|
PaintableWithLines (BlockContainer(anonymous)) [48,88 744x0]
|
|
PaintableWithLines (BlockContainer(anonymous)) [8,104 784x0]
|
|
|
|
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)
|
|
SC for BlockContainer<HTML> [0,0 800x104] [children: 0] (z-index: auto)
|