Remove the kFullscreenPermanentThinController feature flag; dynamically determine thin controller strategy based on macOS version

Commit: a87264e5 | 2025-03-05 15:23:44+00:00

← Back to List

Remove the kFullscreenPermanentThinController feature flag; dynamically determine thin controller strategy based on macOS version

Moderate
Commit Hash: a87264e590b58daa9d63703c4b5b674f986c51fa
Commit Time: 2025-03-05 15:23:44+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission mainly changes the enabling method of the "permanent thin controller" strategy from a feature flag switch to directly determining based on the macOS version (always enabled on macOS 13 and above, dynamically attached/detached on lower versions as needed). Specifically, it includes:
1. Removed the remote_cocoa::features::kFullscreenPermanentThinController feature declaration and related code.
2. In browser_native_widget_window_mac.mm and immersive_mode_controller_cocoa.mm, the logic for determining whether to enable the permanent thin controller is changed from using a feature flag to directly checking base::mac::MacOSMajorVersion() >= 13.
3. Updated the comments in immersive_mode_controller_cocoa.h to clarify the management approach for the thin controller on different macOS versions.
4. Updated related unit tests to ensure that the thin controller always exists on macOS 13+, and is dynamically attached/detached on lower versions as needed.

🎯 Impact Analysis

The impact of this change on WebView2Mac is mainly reflected in the window fullscreen and titlebar accessory management mechanisms of remote_cocoa. If downstream WebView2Mac code relies on the upstream thin controller behavior (such as the timing of titlebar accessory attachment/detachment during window fullscreen), then on macOS 13+ the behavior will change to “always present,” while on lower versions it will retain the original “on-demand attachment/detachment” logic. Since WebView2Mac primarily manages windows by inheriting NativeWidgetNSWindowBridge and related window bridging classes, if downstream code has custom thin controller management logic or relies on feature flags, it will need to be adapted accordingly. Overall, the change does not break interface compatibility, but it will affect the lifecycle management of the titlebar accessory during window fullscreen, so attention should be paid to changes in downstream window behavior and visual appearance, especially in compatibility testing across different macOS versions.

Impacted Classes:

remote_cocoa::ImmersiveModeControllerCocoa remote_cocoa::features(已移除 kFullscreenPermanentThinController) BrowserNativeWidgetWindow(ObjC 类,窗口实现相关) NSTitlebarAccessoryViewController(ObjC,thin controller 相关)