Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 67fc22ee94fb75cf572cb11d84271e8f1e912226
https://github.com/WebKit/WebKit/commit/67fc22ee94fb75cf572cb11d84271e8f1e912226
Author: Dana Estra <[email protected]>
Date: 2026-04-28 (Tue, 28 Apr 2026)
Changed paths:
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.h
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/MouseEventTests.mm
Log Message:
-----------
WKMouseTrackingObserver should do a hit test before forwarding mouse event
https://bugs.webkit.org/show_bug.cgi?id=312923
rdar://175269276
Reviewed by Abrar Rahman Protyasha.
WKMouseTrackingObserver should only forward a mouse move event to WebViewImpl
if the
web view is the topmost view at the event's mouse location. This is the first
step
to eventually deprecate the _ignoresMouseMoveEvents SPI. Clients will not need
to ask a web view to ignore mouse events because the mouse events will not
be forwarded in the first place if the web view is not the topmost view.
Inside -[mouseMoved:event] and -[mouseEntered:event], WKMouseTrackingObserver
should
update _viewIsTopmostAtLastMouseLocation. We need to keep track of whether this
was
the topmost view at the last known mouse location in order to determine whether
to
forward mouseExited in the future. The mouseExited event only tells us the new
location,
which is necessarily outside of the view, therefore we must keep track of
whether the
view was previously topmost.
Added API tests OverlappingWebViewsTopViewReceivesMouseMove,
OverlappingWebViewsBottomViewReceivesMouseMove,
OverlappingWebViewsTopViewReceivesMouseEnterAndMouseExit,
OverlappingWebViewsBottomViewReceivesMouseEnterAndMouseExit,
OverlappingWebViewsTopAndBottomViewsReceiveMouseEnterAndMouseExit,
and MouseMoveNotForwardedWhenCoveredByOverlay.
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(-[WKMouseTrackingObserver updateViewIsTopmostAtMouseLocation:]):
(-[WKMouseTrackingObserver mouseMoved:]):
(-[WKMouseTrackingObserver mouseEntered:]):
(-[WKMouseTrackingObserver mouseExited:]):
* Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/MouseEventTests.mm:
(TestWebKitAPI::setupOverlappingWebViews):
(TestWebKitAPI::checkMouseEventCounts):
(TestWebKitAPI::TEST(MouseEventTests,
OverlappingWebViewsTopViewReceivesMouseMove)):
(TestWebKitAPI::TEST(MouseEventTests,
OverlappingWebViewsBottomViewReceivesMouseMove)):
(TestWebKitAPI::TEST(MouseEventTests,
OverlappingWebViewsTopViewReceivesMouseEnterAndMouseExit)):
(TestWebKitAPI::TEST(MouseEventTests,
OverlappingWebViewsBottomViewReceivesMouseEnterAndMouseExit)):
(TestWebKitAPI::TEST(MouseEventTests,
OverlappingWebViewsTopAndBottomViewsReceiveMouseEnterAndMouseExit)):
(TestWebKitAPI::TEST(MouseEventTests,
MouseMoveNotForwardedWhenCoveredByOverlay)):
Canonical link: https://commits.webkit.org/312201@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications