Add window user manual resize event callback

Commit: d19d7dfd | 2025-03-17 16:16:17+00:00

← Back to List

Add window user manual resize event callback

Minor
Commit Hash: d19d7dfdf7e131bd08dfc070736ebddf8e52c9e2
Commit Time: 2025-03-17 16:16:17+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

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.

🎯 Impact Analysis

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.

Impacted Classes:

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