mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibWeb: Improve graphical list item marker positioning
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.
This commit is contained in:
parent
ada198bee0
commit
115e5f42af
Notes:
github-actions[bot]
2025-07-17 08:36:21 +00:00
Author: https://github.com/gmta
Commit: 115e5f42af
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5475
Reviewed-by: https://github.com/AtkinsSJ ✅
21 changed files with 187 additions and 171 deletions
|
@ -27,6 +27,8 @@ public:
|
|||
CSS::ListStyleType const& list_style_type() const { return m_list_style_type; }
|
||||
CSS::ListStylePosition list_style_position() const { return m_list_style_position; }
|
||||
|
||||
CSSPixels relative_size() const;
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue