Revert "Don't allow NSWindow to steal focus from modal window on scrim click"

提交: 15632b7d | 2026-05-18 17:51:59

← 返回列表

Revert "Don't allow NSWindow to steal focus from modal window on scrim click"

Moderate
提交哈希: 15632b7d9d9d832e220f1e221bfb2c214fe3001c
提交时间: 2026-05-18 17:51:59
影响等级: Moderate
生成工具: chromium-watcher
上游审核链接: 查看上游审核 🔗

📋 摘要

This commit reverts 03549f10a1c37ca13adbaf1c8d1195ad302cb88a because the original fix caused a bug blocking M149 (crbug.com/514188393).
The reverted feature intercepted left mouse down events in NativeWidgetMacNSWindow's sendEvent: method. When a visible child modal window existed, it swallowed clicks on the web contents area and explicitly made the child modal the key window.
The revert removes the modal_type() public accessor from NativeWidgetNSWindowBridge, the topmostVisibleChildModalWindow method from NativeWidgetMacNSWindow, and the left-mouse-down interception logic in sendEvent:.

🎯 影响分析

This revert has moderate impact on WebView2Mac for the following reasons:
1. The modal_type() public accessor is removed from NativeWidgetNSWindowBridge. The downstream Edge code (Q:/Edge/src/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h:214) still has this method, causing a merge conflict when syncing upstream.
2. The downstream native_widget_mac_nswindow.mm still contains the topmostVisibleChildModalWindow method and the left-mouse-down interception logic in sendEvent: (lines 157, 460, 681), requiring conflict resolution during upstream sync.
3. NativeWidgetNSWindowBridge is a high-risk dependency for WebView2Mac; public interface changes directly affect downstream Bridge subclasses like HostingNSWindowBridge.
4. Changes to mouse event handling in sendEvent: may affect focus behavior for child modal windows in WebView2Mac (e.g., JavaScript alert/confirm dialogs).
Recommendation: When syncing this revert downstream, evaluate whether the child-modal focus behavior needs to be preserved for WebView2 scenarios or addressed with an alternative fix.

受影响的类:

remote_cocoa::NativeWidgetNSWindowBridge NativeWidgetMacNSWindow