Only force key window status when entering fullscreen

提交: e520040c | 2026-04-28 20:29:04

← 返回列表

Only force key window status when entering fullscreen

Minor
提交哈希: e520040cc67ec7ed32a8219d4ea100b606c2c3fb
提交时间: 2026-04-28 20:29:04
影响等级: Minor
生成工具: chromium-watcher
上游审核链接: 查看上游审核 🔗

📋 摘要

This commit modifies NativeWidgetNSWindowBridge::FullscreenControllerToggleFullscreen() to add a condition check ([window_ styleMask] & NSWindowStyleMaskFullScreen) before calling makeKeyAndOrderFront:, restricting it to fullscreen entry only. Calling makeKeyAndOrderFront: when exiting fullscreen was breaking the AppKit transition animation by reordering windows mid-transition, and could leave a non-interactive "snapshot" image on the user's screen.

🎯 影响分析

This change has minor impact on WebView2Mac. Although the modified class NativeWidgetNSWindowBridge is a core dependency in WebView2Mac's Bridge/Host architecture, WebView2Mac uses the "Fullscreen Within Tab" pattern — when web content requests fullscreen, the browser window does NOT enter native macOS fullscreen. Instead, it notifies the host app via OnContainsFullScreenElementChanged, leaving window-level fullscreen to the host app's discretion. Therefore, FullscreenControllerToggleFullscreen() is not triggered in WebView2Mac scenarios. This change involves no Mojo interface modifications, no virtual function signature changes, and no API changes — it is purely a behavioral condition refinement. The Edge downstream still has the old unconditional code and will pick up this fix automatically during upstream merge.

受影响的类:

remote_cocoa::NativeWidgetNSWindowBridge