[webkit-changes] [WebKit/WebKit] 5cbe64: [visionOS] theverge.com: ~3-4 second web process h...
Wenson Hsieh
noreply at github.com
Fri Jan 17 07:31:19 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5cbe6491f0bba142645bbb5e56173faf6b50c0ca
https://github.com/WebKit/WebKit/commit/5cbe6491f0bba142645bbb5e56173faf6b50c0ca
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2025-01-17 (Fri, 17 Jan 2025)
Changed paths:
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm
Log Message:
-----------
[visionOS] theverge.com: ~3-4 second web process hangs when focusing search field in More+ menu
https://bugs.webkit.org/show_bug.cgi?id=286111
rdar://142576418
Reviewed by Abrar Rahman Protyasha.
After some recent changes in UIKit, WebKit is now asked to provide document editing contexts for
spatial requests that cover the entire viewport (via `SpatialAndCurrentSelection`), while the user
types. This causes a very long (multi-second) hang after focusing the search field on the front page
of theverge.com, underneath logic to compute and send document editing contexts that encompass
(nearly) the entire document.
This happens because the logic that attempts to clamp the `rangeOfInterest` to the first/last
positions of the current editable root (which contains the selection) fails in the case where the
original `rangeOfInterest.end` is before the first position in the editable root, or the original
`rangeOfInterest.start` is after the last position (in other words, we currently make the assumption
that `rangeOfInterest` may encompass the editable container, and don't account for the range being
entirely outside of it).
On theverge.com, the editable container is in the shadow DOM of an input field that's fixed-
positioned, which produces a `rangeOfInterest` that includes content outside of the UA shadow DOM
altogether. To fix this, we simply clamp *both* endpoints of `rangeOfInterest` to the first and last
positions in the editable root.
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestDocumentEditingContext):
See above.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
(TEST(DocumentEditingContext, SpatialAndCurrentSelectionRequest_LimitContextToEditableRoot)):
Augment an existing API test to exercise this change.
Canonical link: https://commits.webkit.org/289055@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list