PWA Transparent Area Event Penetration Fix and Window Controls Overlay Related Code Cleanup

提交: 7a87e1fe | 2025-06-03 18:35:57+00:00

← 返回列表

PWA Transparent Area Event Penetration Fix and Window Controls Overlay Related Code Cleanup

Moderate
提交哈希: 7a87e1fed2fc5f81b993babb70180680536d8367
提交时间: 2025-06-03 18:35:57+00:00
影响等级: Moderate
生成工具: webview2-upstream-sentry
上游审核链接: 查看上游审核 🔗

📋 摘要

This submission fixes a regression issue on macOS where, after enabling the Window Controls Overlay (WCO) feature for PWAs, mouse events could not correctly reach the web content in the transparent title bar area. This change refactors the event target determination logic in TopContainerView so that it only becomes the event target within the WebAppFrameToolbarView area, allowing events in the transparent area to correctly pass through to the underlying web content. Additionally, it removes the now-unnecessary WCO region cache and related hitTest logic, including the removal of the updateWindowControlsOverlay method and associated transparent area hit testing code from WebContentsViewCocoa, as well as cleaning up the UpdateWindowControlsOverlay interface from the WebContentsView base class across all platforms.

🎯 影响分析

The impact of this change on WebView2Mac is mainly reflected in the modification of the event handling mechanism at the Remote Cocoa layer. Specific impacts include: 1) Removal of the UpdateWindowControlsOverlay interface and its implementation in Remote Cocoa, which means that if downstream WebView2Mac code relies on this interface to handle similar transparent region overlay functionality, it may be affected; 2) Deletion of the custom hitTest method and _windowControlsOverlayRect cache in WebContentsViewCocoa, altering the event routing mechanism, which may impact similar transparent region event handling logic in WebView2Mac; 3) Removal of the UpdateWindowControlsOverlay mojo interface in WebContentsNSViewBridge, so if WebView2Mac uses a similar inter-process communication mechanism to manage transparent overlay regions, alternative solutions will be needed. However, since these changes are mainly targeted at the Window Controls Overlay feature for PWAs, and WebView2Mac, as an embedded web control, typically does not need to handle window control button overlay scenarios, the impact on core functionality is relatively limited. Nevertheless, if downstream implementations have custom transparent region or event penetration requirements, relevant adjustments may be necessary.

受影响的类:

WebContentsViewCocoa WebContentsNSViewBridge TopContainerView WebContentsView