Fix the behavior of top-level windows displayed in Mission Control
Moderate
Commit Hash:
e6a4e7712deaa87d79a2ad66aba323433a08ee2e
Commit Time: 2025-02-23 04:26:06+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission fixes an issue in the NativeWidgetNSWindowBridge::SetParent() method where the NSWindowCollectionBehaviorTransient flag was not properly removed when setting a window as a top-level window. Previously, when a window switched from a child window to a top-level window, the transient collection behavior was not cleared, resulting in abnormal behavior in Mission Control. This change ensures that when a window becomes a top-level window, its collection behavior is restored to managed, allowing it to display correctly in Mission Control.
🎯 Impact Analysis
This change directly affects the logic for setting the collectionBehavior of windows, ensuring that top-level windows do not incorrectly carry the transient flag. WebView2Mac inherits and extensively reuses the window management logic of NativeWidgetNSWindowBridge through HostingNSWindowBridge; therefore, this fix will synchronously improve the performance of the WebView2Mac control in macOS system-level window management scenarios such as Mission Control and window switching. Specifically, when the WebView2Mac host window switches parent-child relationships or restores from a child window to a top-level window, it will be correctly displayed in the Mission Control view, avoiding window loss or abnormal grouping. This fix does not affect the functional APIs of the window, but enhances the usability and consistency of windows in the macOS desktop environment. There is no negative impact on performance.
Impacted Classes:
NativeWidgetNSWindowBridge
HostingNSWindowBridge(下游继承类,间接受影响)