Move PiP windows to fullscreen spaces on Mac to display over fullscreen windows

提交: af7cb905 | 2026-02-26 20:48:04

← 返回列表

Move PiP windows to fullscreen spaces on Mac to display over fullscreen windows

Minor
提交哈希: af7cb90545814c1bf40860168cd326fd00e1ee79
提交时间: 2026-02-26 20:48:04
影响等级: Minor
生成工具: webview2-upstream-sentry
上游审核链接: 查看上游审核 🔗

📋 摘要

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.

🎯 影响分析

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.

受影响的类:

remote_cocoa::NativeWidgetNSWindowBridge remote_cocoa::mojom::NativeWidgetNSWindow views::NativeWidgetMac embedded_browser_webview::HostingNSWindowBridge