Add window user manual resize event callback

提交: d19d7dfd | 2025-03-17 16:16:17+00:00

← 返回列表

Add window user manual resize event callback

Minor
提交哈希: d19d7dfdf7e131bd08dfc070736ebddf8e52c9e2
提交时间: 2025-03-17 16:16:17+00:00
影响等级: Minor
生成工具: webview2-upstream-sentry
上游审核链接: 查看上游审核 🔗

📋 摘要

This submission adds two event callbacks, OnWidgetUserResizeStarted() and OnWidgetUserResizeEnded(), to the WidgetObserver of the views framework on the macOS platform. It also introduces corresponding notification chains for the start and end of user-initiated window resizing (live resize) in remote_cocoa-related NativeWidgetNSWindowBridge, ViewsNSWindowDelegate, and their Mojo Host interfaces. Specifically, OnWindowWillStartLiveResize and OnWindowDidEndLiveResize methods are added to native_widget_ns_window_bridge.h/.mm, triggered by the NSWindowDelegate’s windowWillStartLiveResize/windowDidEndLiveResize events; meanwhile, OnWindowWillStartLiveResize/OnWindowDidEndLiveResize Mojo interface methods are added to native_widget_ns_window_host.mojom. These changes lay the groundwork for more refined state management and event handling during user-initiated window resizing in the future.

🎯 影响分析

This change adds awareness and callback capabilities for window user manual resize (live resize) events to remote_cocoa’s NativeWidgetNSWindowBridge and its related Mojo Host interfaces. For WebView2Mac, if downstream HostingNSWindowBridge inherits from NativeWidgetNSWindowBridge and implements the relevant callbacks (such as for synchronizing window state, optimizing rendering, or interacting with the host application), these new events can be used to achieve more fine-grained window resize responses (for example, pausing/resuming certain operations or optimizing performance when the user drags the window edge). However, this submission does not alter the compatibility of existing interfaces, nor does it remove or modify existing methods, so there is no destructive impact on current WebView2Mac functionality. If downstream does not actively adapt to these new events, there is no direct impact. If downstream wishes to leverage this capability, a better window resize experience can be achieved by overriding the relevant methods.

受影响的类:

remote_cocoa::NativeWidgetNSWindowBridge remote_cocoa::mojom::NativeWidgetNSWindowHost ViewsNSWindowDelegate