Fix tab bar height and right-click issues in macOS 26 full screen mode
Moderate
提交哈希:
a679ed946e3b96a7c72fb75fcc8e5d9762badb7f
提交时间: 2025-08-12 21:03:46+00:00
影响等级: Moderate
生成工具: webview2-upstream-sentry
上游审核链接:
查看上游审核 🔗
📋 摘要
This commit fixes two issues in macOS 26 full-screen mode: 1) The tab bar area was too tall, resulting in a horizontal white gap. This is resolved by ensuring the main window’s toolbar style is UnifiedCompact, allowing AppKit to respect the fullScreenMinHeight of the title bar accessory; 2) The context menu could not be triggered by right-clicking the tab bar. This is addressed by swizzling the private method _hitTestForEvent: of NSToolbarView to resolve the issue where NSToolbarView intercepts right mouse events. Added swizzle_ns_toolbar_view_hit_test.h/.mm files, and invoked related functions in immersive_mode_tabbed_controller_cocoa.mm.
🎯 影响分析
This change has potentially significant impact on WebView2Mac. Although the modification mainly targets the browser’s fullscreen mode and tab bar management, it involves core components of Remote Cocoa, especially the ImmersiveModeTabbedControllerCocoa class, which may be the window management mechanism that WebView2Mac relies on. The newly added NSToolbarView swizzling mechanism may affect event handling in WebView2Mac, particularly the routing of right-click events. If WebView2Mac uses similar toolbar or title bar accessory features in fullscreen mode, it may be affected by these changes. In addition, method swizzling is a runtime modification that may have a global impact on event handling throughout the application, so it is necessary to ensure that WebView2Mac’s event handling mechanism is compatible with these changes.
受影响的类:
ImmersiveModeTabbedControllerCocoa
NSToolbarView
remote_cocoa::SwizzleNSToolbarViewHitTest