Restore window scope limitation change for macOS event monitoring
Moderate
Commit Hash:
7c8a1666e5cd120f5176c07dfc76c57474105eae
Commit Time: 2025-09-30 19:13:38+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission is a rollback of a previous patch that fixed the issue of download bubble closure in macOS fullscreen windows. The original patch modified the EventMonitor implementation for macOS to monitor events for the target window and all its child windows, rather than just the target window itself. However, this change caused functional issues with the translation bubble, so it has been reverted. The main changes include: 1) Restoring the event monitoring logic in remote_cocoa, changing the parameter target_is_this_window_or_descendant back to target_is_this_window; 2) Removing the code logic for traversing and checking parent windows; 3) Updating the relevant Mojo interface definitions and method signatures in all implementation classes; 4) Deleting the related unit tests. This rollback affects multiple modules, including event dispatching, window monitoring, and menu handling.
🎯 Impact Analysis
The impact of this rollback on WebView2Mac is moderate. The main effects are reflected in the following aspects: 1) DispatchMonitorEvent Mojo interface change: the parameter of the remote_cocoa::mojom::NativeWidgetNSWindowHost::DispatchMonitorEvent method has been changed from target_is_this_window_or_descendant to target_is_this_window, which will affect the HostingNSWindowBridge class in WebView2Mac that inherits from remote_cocoa::NativeWidgetNSWindowBridge. This class needs to adapt to the new parameter name and semantics. 2) Change in event monitoring scope: event monitoring now targets only the specific window, no longer including its child or descendant windows. This may affect the cross-window event handling logic in WebView2Mac. 3) NativeWidgetMacEventMonitor::Client interface change: all classes implementing this interface (including related classes possibly used by WebView2Mac) need to update their method signatures. 4) Since WebView2Mac deeply relies on the event dispatch mechanism of remote_cocoa, especially in handling user input and window interactions, these changes may require WebView2Mac to correspondingly adjust its event handling logic to maintain compatibility.
Impacted Classes:
remote_cocoa::mojom::NativeWidgetNSWindowHost
remote_cocoa::NativeWidgetNSWindowBridge
views::NativeWidgetMacEventMonitor::Client
views::EventMonitorRemoteCocoa
views::MenuPreTargetHandlerMac
ui::EventMonitor