Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dab9e9d6d6f03bae4f252f04e3eb90d7c4f620c5
https://github.com/WebKit/WebKit/commit/dab9e9d6d6f03bae4f252f04e3eb90d7c4f620c5
Author: Brent Fulgham <[email protected]>
Date: 2026-09-09 (Wed, 09 Sep 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-not-scrollable-fractional-zoom-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-not-scrollable-fractional-zoom.html
M Source/WebCore/dom/Element.cpp
Log Message:
-----------
scrollWidth and clientWidth are inconsistent when zoomed in/out due to
rounding issues
https://bugs.webkit.org/show_bug.cgi?id=268275
rdar://121879134
Reviewed by Simon Fraser.
Element::clientWidth/offsetWidth and Element::scrollWidth/scrollHeight use
slightly
different computations on the same layout content, resulting in small
differences caused
by rounding.
Element::clientWidth and Element::offsetWidth take the padding-box integer out
of the zoomed layout space with Style::unapplyingZoom<LayoutUnit> and round the
quotient to nearest integer. Element::scrollWidth and Element::scrollHeight
take the
same measurement through the Style::unapplyingZoom<int>, which increments the
value before truncating when the zoom factor is above one. The two operators
disagree by a pixel whenever the quotient lands near a half.
This creates problems with page detection of scrollability, since web authors
often use
elm.scrollWidth !== elm.clientWidth for this purpose. The rounding errors
described
above can cause the page to believe the region is scrollable (e.g., on Shopify
content).
This patch makes scrollWidth and scrollHeight consistent with the conversion
used in
clientWidth and clientHeight already use.
Test:
imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-not-scrollable-fractional-zoom.html
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-not-scrollable-fractional-zoom-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-not-scrollable-fractional-zoom.html:
Added.
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::scrollWidth):
(WebCore::Element::scrollHeight):
Canonical link: https://commits.webkit.org/320773@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications