浏览代码

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.
Andreas Kling 2 年之前
父节点
当前提交
f260afedb1
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      Userland/Libraries/LibWeb/Layout/LineBuilder.cpp

+ 1 - 3
Userland/Libraries/LibWeb/Layout/LineBuilder.cpp

@@ -214,14 +214,12 @@ void LineBuilder::update_last_line()
 
 
             float fragment_baseline = 0;
             float fragment_baseline = 0;
             if (fragment.layout_node().is_text_node()) {
             if (fragment.layout_node().is_text_node()) {
-                fragment_baseline = font_metrics.ascent;
+                fragment_baseline = font_metrics.ascent + half_leading;
             } else {
             } else {
                 auto const& box = verify_cast<Layout::Box>(fragment.layout_node());
                 auto const& box = verify_cast<Layout::Box>(fragment.layout_node());
                 fragment_baseline = box_baseline(m_layout_state, box);
                 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.
             // Remember the baseline used for this fragment. This will be used when painting the fragment.
             fragment.set_baseline(fragment_baseline);
             fragment.set_baseline(fragment_baseline);