Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 049bb0acc54f10a21aa3b139e2ec9804893894ee
https://github.com/WebKit/WebKit/commit/049bb0acc54f10a21aa3b139e2ec9804893894ee
Author: Wenson Hsieh <[email protected]>
Date: 2025-12-10 (Wed, 10 Dec 2025)
Changed paths:
A
LayoutTests/fast/viewport/ios/scale-after-changing-horizontal-obscured-insets-expected.txt
A
LayoutTests/fast/viewport/ios/scale-after-changing-horizontal-obscured-insets.html
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Log Message:
-----------
REGRESSION (iPadOS 26): Closing the sidebar or resizing the window
unnecessarily zooms the page
https://bugs.webkit.org/show_bug.cgi?id=303968
rdar://157676989
Reviewed by Aditya Keerthi.
When manually adjusting the scale (e.g. pinching in and then out) with the
sidebar open on iPad and
then closing the sidebar, the page will become zoomed in. This happens because:
1. When closing the sidebar, the leading obscured inset is decreased to zero,
which increases the
viewport layout width (unobscured content width) of the page.
2. When recomputing the new target scale due to changing viewport
configuration, we compute the
minimum scale to be *greater than 1*, because we haven't performed layout
yet (and so the
content width is still the same as it was when the sidebar was open, with a
nonzero obscured
inset). As such, we fit the old content width to the new viewport width
(sans sidebar), and
attempt to zoom in (let's suppose the scale is set to 1.3, in this example).
3. Later, after the next layout, we update the viewport configuration's
content size to reflect
the new viewport width. Here, the minimum scale is computed to be equal to
1, but because the
scale of 1.3 fits within the min/max scale. As a result, we're now stuck at
1.3 scale.
To fix this, we adjust the target scale computation heuristic so that if we're
already at or near
minimum scale and the minimum scale changes as a result of the viewport
configuration changing,
we'll automatically target the new minimum scale instead of remaining at the
current scale.
Test: fast/viewport/ios/scale-after-changing-horizontal-obscured-insets.html
*
LayoutTests/fast/viewport/ios/scale-after-changing-horizontal-obscured-insets-expected.txt:
Added.
*
LayoutTests/fast/viewport/ios/scale-after-changing-horizontal-obscured-insets.html:
Added.
Add a layout test that exercises this bug by simulating opening and closing the
sidebar (by setting
and then unsetting a left obscured inset). Verify that the final scale is equal
to 1.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::viewportConfigurationChanged):
See above for more details.
Canonical link: https://commits.webkit.org/304277@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications