Fix overlay window position issue on macOS 26
Moderate
Commit Hash:
cd7ba50aff3b5a5fbf35348fbe9a447986c2db7a
Commit Time: 2025-09-10 12:38:20+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission fixes a system compatibility issue in macOS 26.0. In macOS 26.0, when the main window enters fullscreen mode, the system automatically adjusts the position of overlay sub-windows to below the menu bar (even if the menu bar is hidden). This change overrides the constrainFrameRect:toScreen: method of the NativeWidgetMacOverlayNSWindow class to return the original frameRect value on macOS 26.0 and above, instead of the system-adjusted position, thereby maintaining the correct position of the overlay window. Additionally, the base/mac/mac_util.h header file reference was added to support macOS version checking.
🎯 Impact Analysis
The impact of this change on WebView2Mac is moderate. If WebView2Mac uses the immersive fullscreen mode feature (via ImmersiveModeControllerCocoa and related overlay windows), then this fix is very important for WebView2Mac, as it ensures that overlay UI elements (such as toolbars, control buttons, etc.) are correctly displayed in the expected positions on macOS 26, rather than being erroneously shifted below the menu bar by the system. Without this fix, WebView2Mac applications running on macOS 26 in fullscreen mode may encounter UI layout errors, affecting user experience. However, if WebView2Mac does not use immersive fullscreen functionality or overlay windows, this change will not have a direct impact.
Impacted Classes:
NativeWidgetMacOverlayNSWindow
ImmersiveModeControllerCocoa
ImmersiveModeTabbedControllerCocoa