Revert macOS main window content area click-through functionality

Commit: bbaf3c3c | 2025-09-24 21:11:10+00:00

← Back to List

Revert macOS main window content area click-through functionality

Moderate
Commit Hash: bbaf3c3c91d9f553a5ba81755a9fcee98cf5aa63
Commit Time: 2025-09-24 21:11:10+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission reverts the previously implemented macOS main window content area click-through functionality. The original implementation added complex logic in the acceptsFirstMouse: method, determining whether to accept the first mouse click based on different enumerated values of acceptsMouseEventsOption (kWhenInActiveWindow, kWhenInActiveApp, kAlways). The reverted version simplifies the logic: click-through is only enabled when mouse clicks are accepted in inactive windows (i.e., acceptsMouseEventsOption > AcceptMouseEvents::kWhenInActiveWindow). This rollback was made because the original functionality unintentionally enabled click-through for all content areas (bug crbug.com/446925535).

🎯 Impact Analysis

This change has a positive impact on WebView2Mac. The previous complex click-through logic could lead to inconsistent mouse event handling behavior in WebView2Mac, especially during window activation state transitions. The simplified logic after rollback is more predictable and stable:
1. **Consistency in mouse event handling**: Simplifies the mouse event handling logic under window activated/inactivated states, reducing potential event handling conflicts.
2. **Fixes unintended enabled click-through**: Resolves the issue where all content areas were unintentionally enabled for click-through, which could affect normal interactions with embedded web pages in WebView2Mac.
3. **More stable user interaction**: Avoids the issue where double-clicking was required to interact with the page when the find bar or other auxiliary UI was active.
4. **Improved compatibility**: The new simplified logic is more compatible with WebView2Mac’s window management model, as WebView2Mac manages windows through the host application rather than relying on Edge browser’s window management.

Impacted Classes:

RenderWidgetHostViewCocoa AcceptMouseEvents (枚举)