Move PiP windows to fullscreen spaces on Mac to display over fullscreen windows
Minor
Commit Hash:
af7cb90545814c1bf40860168cd326fd00e1ee79
Commit Time: 2026-02-26 20:48:04
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This commit adds logic to move picture-in-picture (PiP) windows into fullscreen spaces on macOS. While PiP windows are set to display on all workspaces, they don't always appear on workspaces with fullscreen windows on macOS. Changes include: a new MoveToActiveFullscreenSpace() Mojo interface in NativeWidgetNSWindow.mojom; implementation in NativeWidgetNSWindowBridge that temporarily modifies NSWindow's collectionBehavior (removing CanJoinAllSpaces and adding MoveToActiveSpace), calls orderFrontRegardless to move the window to the active fullscreen space, then asynchronously restores the original collectionBehavior; a new RestoreCollectionBehavior() helper and collection_behavior_to_restore_ member; corresponding platform interfaces in NativeWidgetMac and NativeWidgetPrivate; Chrome browser layer PiP window manager and BrowserFrameViewMac call the new interface.
🎯 Impact Analysis
This change has minor direct impact on WebView2Mac. The new MoveToActiveFullscreenSpace Mojo interface is added to NativeWidgetNSWindow.mojom, and Edge downstream's HostingNSWindowBridge inherits from NativeWidgetNSWindowBridge. Since MoveToActiveFullscreenSpace is a newly added method with no downstream override, WebView2Mac will inherit the upstream base class implementation. The feature is primarily driven by Chrome browser layer PiP window management (chrome/browser/picture_in_picture/), and WebView2Mac as an embedded control typically does not involve PiP window management. Note that the method temporarily modifies NSWindow's collectionBehavior (removing CanJoinAllSpaces), which could potentially interact with the downstream HostingNSWindowBridge's manual collectionBehavior setting (hosting_ns_window_bridge.mm line 122). However, since MoveToActiveFullscreenSpace asynchronously restores the original behavior and the PiP path is unlikely to be triggered in WebView2Mac, the actual risk is very low. No downstream patch is needed.
Impacted Classes:
remote_cocoa::NativeWidgetNSWindowBridge
remote_cocoa::mojom::NativeWidgetNSWindow
views::NativeWidgetMac
embedded_browser_webview::HostingNSWindowBridge