mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +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:
@@ -229,12 +229,13 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
|
||||
auto& line_box = block.line_boxes()[line_box_index];
|
||||
for (size_t i = 0; i < indent; ++i)
|
||||
builder.append(" ");
|
||||
builder.appendff(" {}line {}{} width: {}, bottom: {}\n",
|
||||
builder.appendff(" {}line {}{} width: {}, bottom: {}, baseline: {}\n",
|
||||
line_box_color_on,
|
||||
line_box_index,
|
||||
color_off,
|
||||
line_box.width(),
|
||||
line_box.bottom());
|
||||
line_box.bottom(),
|
||||
line_box.baseline());
|
||||
for (size_t fragment_index = 0; fragment_index < line_box.fragments().size(); ++fragment_index) {
|
||||
auto& fragment = line_box.fragments()[fragment_index];
|
||||
for (size_t i = 0; i < indent; ++i)
|
||||
|
||||
Reference in New Issue
Block a user