[Webkit-unassigned] [Bug 246100] Text is slightly misaligned at specific font sizes or container widths

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 6 12:01:03 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=246100

--- Comment #6 from zalan <zalan at apple.com> ---
This seems to be caused by the lack of inline content (horizontal) pixelsnapping (the visual glitch shows up when the block painting produces a pixelsnapped (position/size) block box while the inline painting stays on a non-snapped position. On a 2x display, it's most visible at 0.25 and 0.75 where the block box get pixelsnapped to 0.5, 1, while the inline content is still painted at 0.25 and 0.75 (touching border).

the following snippet fixes the test case (it surely needs some more work though).

diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 6f46a2aaf2ae..0141ac14dfff 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -3486,13 +3486,14 @@ void RenderBlockFlow::paintInlineChildren(PaintInfo& paintInfo, const LayoutPoin
 {
     ASSERT(childrenInline());

+    auto adjustedPaintOffset = LayoutPoint { roundPointToDevicePixels(paintOffset, document().deviceScaleFactor()) };
     if (modernLineLayout()) {
-        modernLineLayout()->paint(paintInfo, paintOffset);
+        modernLineLayout()->paint(paintInfo, adjustedPaintOffset);
         return;
     }

     if (legacyLineLayout())
-        legacyLineLayout()->lineBoxes().paint(this, paintInfo, paintOffset);
+        legacyLineLayout()->lineBoxes().paint(this, paintInfo, adjustedPaintOffset);
 }

 bool RenderBlockFlow::relayoutForPagination()

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221006/e1ea927d/attachment.htm>


More information about the webkit-unassigned mailing list