Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f77c54c24879e2f2311420175ff5a01d0493ca7e
https://github.com/WebKit/WebKit/commit/f77c54c24879e2f2311420175ff5a01d0493ca7e
Author: Henrik Hørlück Berg <[email protected]>
Date: 2026-05-26 (Tue, 26 May 2026)
Changed paths:
A
LayoutTests/svg/in-html/hidpi-legacy-svg-root-fractional-clip-expected.html
A LayoutTests/svg/in-html/hidpi-legacy-svg-root-fractional-clip.html
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp
Log Message:
-----------
Regression(307371@main): SVG overflows edge when offset by fraction
https://bugs.webkit.org/show_bug.cgi?id=314825
Reviewed by Alan Baradlay.
When a SVG is offset by between 0.25 and 0.75 pixels, there is a
a mismatch between the overflow clip and the paintOffset, leading to slight
clipping around the edge.
Regression from https://commits.webkit.org/307371@main, which made
`adjustedPaintOffset` use subpixel snapping, but did not also update
`clipRect` to do the same.
Example: content is calculated to be in [0 + offset, 100 + offset],
For an offset between 0.5 and 0.75, which snaps to 0.5, so the content
is at [0.5, 100.5], the overflow clip is rounded up to [1, 101],
which clips at the start.
With a offset between 0.25 and 0.5, the content still clips to [0.5, 100.5]
but the clip is rounded down to [0, 100], clipping the end.
This fix is to make `clipRect` snap to device pixels, such that the
overflow clip in both cases ends up as the expected [0.5, 100.5],
and the circle does not overflow.
Test by asserting that `overflow: hidden` has no effect, as the SVGs
should not be overflowing.
GPT 5.5 was used both in generating the test-cases and bug fix.
Test: svg/in-html/hidpi-legacy-svg-root-fractional-clip.html
* LayoutTests/svg/in-html/hidpi-legacy-svg-root-fractional-clip-expected.html:
Added.
* LayoutTests/svg/in-html/hidpi-legacy-svg-root-fractional-clip.html: Added.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp:
(WebCore::LegacyRenderSVGRoot::paintReplaced):
Canonical link: https://commits.webkit.org/313886@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications