Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a2ccf3506fc2a4ae4a5c8e6d0b7a752a0341068d
https://github.com/WebKit/WebKit/commit/a2ccf3506fc2a4ae4a5c8e6d0b7a752a0341068d
Author: Jessica Cheung <[email protected]>
Date: 2026-08-27 (Thu, 27 Aug 2026)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
A Tools/TestWebKitAPI/Resources/cocoa/InteractiveWidgetViewportUnits.html
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/InteractiveWidget.mm
Log Message:
-----------
[interactive-widget] lvh and svh do not respect resizes-content value
https://bugs.webkit.org/show_bug.cgi?id=322531
rdar://185827264
Reviewed by Wenson Hsieh.
Currently, lvh and svh do not work with resizes-content. Based on the
spec, when resizing the layout viewport, the CSS viewport units should
reflect such changes.
So, implement support for lvh and svh to respect resizes-content while
also respecting override layout parameters. Key changes include:
- _sizeResizedByInteractiveWidget: takes in the size passed and if
resizes-content, will clamp to keyboard top (old logic in
_dispatchSetViewLayoutSize which is now extracted to this function)
- _dispatchSetMinimumUnobscuredSize and others: replaces
setMinimumUnobscuredSize
and alike by still calling setMinimumUnobscuredSize, but uses the size of what
is passed in, and the clamp if it exists. This takes into account override
layout
parameters, will only clamp for resizes-content, and if override layout
parameters
are present with resizes-content, the clamp value only wins if the keyboard is
up.
- _dispatchSetActiveUnobscuredSizes: is called if interactiveWidgetValueChanged
or
if keyboardShouldResizeContent, where it will re-push override layout
parameters if
they exist, and then calls the dispatch functions (taking account of the
resizes-content
clamping if it exists).
Additionally, add API tests for these cases:
- overlays-content viewport units
- resizes-content viewport units
- override layout parameters with resizes-content viewport units
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView
_recalculateViewportSizesWithMinimumViewportInset:maximumViewportInset:throwOnInvalidInput:]):
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _didCommitLayerTree:mainFrameData:pageData:transactionID:]):
(-[WKWebView _sizeResizedByInteractiveWidget:]):
(-[WKWebView _dispatchSetViewLayoutSize:]):
(-[WKWebView _dispatchSetMinimumUnobscuredSize:]):
(-[WKWebView _dispatchSetMaximumUnobscuredSize:]):
(-[WKWebView _dispatchSetDefaultUnobscuredSize:]):
(-[WKWebView _dispatchSetActiveUnobscuredSizes]):
(-[WKWebView _frameOrBoundsMayHaveChanged]):
(-[WKWebView _didStopDeferringGeometryUpdates]):
(-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
(-[WKWebView
_overrideLayoutParametersWithMinimumLayoutSize:minimumUnobscuredSizeOverride:maximumUnobscuredSizeOverride:]):
* Tools/TestWebKitAPI/Resources/cocoa/InteractiveWidgetViewportUnits.html:
Added.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/InteractiveWidget.mm: Added.
(viewportUnitLength):
(setInteractiveWidget):
(simulateKeyboardOfHeight):
(focusInput):
(TEST(InteractiveWidget, ViewportUnitsOverlaysContent)):
(TEST(InteractiveWidget, ViewportUnitsResizesContent)):
(TEST(InteractiveWidget,
ViewportUnitsResizesContentWithOverriddenLayoutParameters)):
Canonical link: https://commits.webkit.org/319997@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications