mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
LibWeb: Align actual baselines, not just bottoms
Until now, we've been treating the bottom of every line box fragment as its baseline, and just aligning all the bottoms to the bottom of the line box. That gave decent results in many cases, but was not correct. This patch starts moving towards actual baseline calculations as specified by CSS2. Note that once layout is finished with a line box, we also store the baseline of the line box in LineBox::m_baseline. This allows us to align the real baseline of display:inline-block elements with other inline content on the same line.
This commit is contained in:
parent
1d6cf3a43f
commit
7dae895704
5 changed files with 62 additions and 32 deletions
|
@ -17,6 +17,7 @@ public:
|
|||
|
||||
float width() const { return m_width; }
|
||||
float bottom() const { return m_bottom; }
|
||||
float baseline() const { return m_baseline; }
|
||||
|
||||
void add_fragment(Node const& layout_node, int start, int length, float leading_size, float trailing_size, float content_width, float content_height, float border_box_top, float border_box_bottom, LineBoxFragment::Type = LineBoxFragment::Type::Normal);
|
||||
|
||||
|
@ -36,6 +37,7 @@ private:
|
|||
Vector<LineBoxFragment> m_fragments;
|
||||
float m_width { 0 };
|
||||
float m_bottom { 0 };
|
||||
float m_baseline { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue