| Summary: | Text is slightly misaligned at specific font sizes or container widths | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Roel Nieskens <webkitbugzilla> | ||||||||||||
| Component: | Text | Assignee: | zalan <zalan> | ||||||||||||
| Status: | NEW --- | ||||||||||||||
| Severity: | Normal | CC: | changseok, esprehn+autocc, ews-watchlist, glenn, karlcow, kondapallykalyan, mmaxfield, pdr, webkit-bug-importer, webkitbugzilla, zalan | ||||||||||||
| Priority: | P2 | Keywords: | BrowserCompat, InRadar | ||||||||||||
| Version: | Safari 15 | ||||||||||||||
| Hardware: | Mac (Intel) | ||||||||||||||
| OS: | macOS 12 | ||||||||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=261212 | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Roel Nieskens
2022-10-05 12:06:39 PDT
> Curiously, it does happen in Windows.
Sorry, this should read:
Curiously, it does happen in the Opera browser.
I really should've had more coffee before writing this, apologies for the noise.
> Change the font size to 64px, and the icon is suddenly not centered.
Should read:
Change the font size to 68px, and the icon is suddenly not centered.
Created attachment 462839 [details]
Test reduction
Created attachment 462840 [details]
Test without flex (simple out-of-flow positioning)
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()
Created attachment 462844 [details]
Fix with screenrecording
Created attachment 462857 [details]
Patch
let's see what EWS has to say about it. Created attachment 465952 [details]
Patch
There are quite a few (~25) subpixel diff type of failures. This is blocked by integral rounding in IFC (planning on removing it). |