diff options
author | Andreas Kling <kling@serenityos.org> | 2022-10-03 01:16:07 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-10-03 17:22:08 +0200 |
commit | f260afedb15b9c326229733d1dc62956a4b066e7 (patch) | |
tree | ea1fc3476c48c9923c466d629837b5f0f2495a01 /Userland/Libraries/LibWeb/Layout | |
parent | ffbf5596cd8e2d0e44451034b2e508d06df4c77b (diff) | |
download | serenity-f260afedb15b9c326229733d1dc62956a4b066e7.zip |
LibWeb: Don't add half-leading twice to inline block boxes
Inline-level blocks already have the half-leading applied internally,
so by adding it twice, we were offsetting their baseline by the
half-leading of the line.
This fixes an issue where inline-blocks were vertically offset from
the line they're supposed to sit on.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/LineBuilder.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp index f1eab830f8..90326aeec8 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp @@ -214,14 +214,12 @@ void LineBuilder::update_last_line() float fragment_baseline = 0; if (fragment.layout_node().is_text_node()) { - fragment_baseline = font_metrics.ascent; + fragment_baseline = font_metrics.ascent + half_leading; } else { auto const& box = verify_cast<Layout::Box>(fragment.layout_node()); fragment_baseline = box_baseline(m_layout_state, box); } - fragment_baseline += half_leading; - // Remember the baseline used for this fragment. This will be used when painting the fragment. fragment.set_baseline(fragment_baseline); |