Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: aa1f6fdb951f6911cfd79a363ddce8c4340edc71
https://github.com/WebKit/WebKit/commit/aa1f6fdb951f6911cfd79a363ddce8c4340edc71
Author: Wenson Hsieh <[email protected]>
Date: 2024-11-18 (Mon, 18 Nov 2024)
Changed paths:
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
M Source/WebKit/UIProcess/WebPageProxyInternals.h
M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
M Tools/TestWebKitAPI/Tests/mac/MouseEventTests.mm
Log Message:
-----------
[macOS] Mitigate sync IPC hangs underneath -[WKWebView
shouldDelayWindowOrderingForEvent:]
https://bugs.webkit.org/show_bug.cgi?id=283212
rdar://138094916
Reviewed by Abrar Rahman Protyasha.
Further mitigate sync IPC hangs underneath `-shouldDelayWindowOrderingForEvent:`
1. If the web content process is not currently responsive, avoid sync IPC.
2. If the mouse location is not over the selection bounding rect (in
`WKWebView` coordinates),
avoid sync IPC.
See below for more details.
Test: MouseEventTests.ShouldDelayWindowOrderingForEvent
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setHasFocusedElementWithUserInteraction):
(WebKit::WebPageProxy::updateEditorState):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
(WebKit::WebPageProxy::mainFrameScrollPosition const):
Add a helper method to return the current main frame scroll position, by
consulting the async
scrolling coordinator.
(WebKit::WebPageProxy::setHasHadSelectionChangesFromUserInteraction): Deleted.
Rename this to `setHasFocusedElementWithUserInteraction` (along with the
associated member variable)
to better reflect the intent of this code.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
Add `scrollPositionDuringLastEditorStateUpdate`, so that we can adjust the last
selection bounding
rect to account for any main frame scrolling since the selection was made. Note
that on iOS, this
isn't necessary since the "root view coordinate space" refers to
`WKContentView` which is already in
content coordinates; however, on macOS, the root view is the web view itself.
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::selectionBoundingRectInRootViewCoordinates const):
Make this (previously-iOS-specific) helper method available for all Cocoa, and
add an implementation
on macOS that uses the editor state's post-layout data (adjusting for any main
frame scrolling since
the editor state update).
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::shouldDelayWindowOrderingForEvent):
See comments above.
(WebKit::WebViewImpl::showWritingTools):
Drive-by fix: deploy `selectionBoundingRectInRootViewCoordinates()` here as
well, to fix an issue
where selecting text in Mail compose, scrolling, and then showing the writing
tools popup through
Mail's toolbar would cause the popup to show up docked to a stale rect.
(WebKit::WebViewImpl::updateTouchBar):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didStartPageTransition):
(WebKit::WebPage::didChangeSelection):
Set `UserInteractionFlag::SelectedRange` if we're both handling user
interaction, and the selection
is a range.
(WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
Refactor `m_hasEverFocusedElementDueToUserInteractionSincePageTransition` so
that it's now an
`OptionSet`, `m_userInteractionsSincePageTransition`. The intent here is to
propagate editor state
updates to the UI process in the case where the user has either manually
selected text, or focused
an editable element. This is needed in order to ensure that we have the
requisite post-layout data
cached in the UI process, to return early from
`-shouldDelayWindowOrderingForEvent:` without
consulting the web process in the case where the mouse location isn't in the
selection.
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::shouldAvoidComputingPostLayoutDataForEditorState const):
* Tools/TestWebKitAPI/Tests/mac/MouseEventTests.mm:
(TestWebKitAPI::TEST(MouseEventTests, ShouldDelayWindowOrderingForEvent)):
Write a simple API test to verify that (1) window ordering is correctly delayed
when clicking over a
text selection in an inactive window, and (2) window ordering is not only not
delayed when clicking
over the unselected content. We also verify that we can make this determination
even if the web
content process is permanently hanging and IPC timeouts are disabled.
Canonical link: https://commits.webkit.org/286746@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes