Simplify RenderWidgetHostViewCocoa Gesture Handling Logic

Commit: 3e5f1d81 | 2025-06-04 17:12:31+00:00

← Back to List

Simplify RenderWidgetHostViewCocoa Gesture Handling Logic

Moderate
Commit Hash: 3e5f1d81b48e21242357af4a5a443fb53cebadf7
Commit Time: 2025-06-04 17:12:31+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission removes the gesture event compatibility code for early macOS versions (OS X 10.10), simplifying the gesture handling logic in RenderWidgetHostViewCocoa. The main changes include: 1) deleting the gesture begin/end event handling methods (handleBeginGestureWithEvent and handleEndGestureWithEvent) for early macOS versions; 2) merging the scattered gesture handling methods (GestureBegin, GestureUpdate, GestureEnd) into a unified PinchEvent method; 3) removing state variables such as gesture_begin_event_ and gesture_begin_pinch_sent_; 4) simplifying the zoom threshold checking logic; 5) updating related mojo interfaces, replacing GestureBegin/GestureUpdate/GestureEnd with PinchEvent; 6) unifying the interface naming for SmartMagnify event handling.

🎯 Impact Analysis

This change has the following potential impacts on WebView2Mac: 1) Interface change impact: Due to significant changes in the mojo interfaces of Remote Cocoa (GestureBegin/GestureUpdate/GestureEnd merged into PinchEvent, SmartMagnify renamed to SmartMagnifyEvent), if WebView2Mac uses these interfaces, the code needs to be updated accordingly to maintain compatibility; 2) Gesture handling logic change: The complex gesture state management and staged processing logic have been removed and replaced with unified PinchEvent handling, which may affect the handling behavior of zoom gestures in WebView2Mac; 3) Threshold check simplification: The simplification of zoom threshold checking logic may impact the mechanism in WebView2Mac that prevents accidental zooming; 4) Backward compatibility: The removal of compatibility code for earlier macOS versions means that if WebView2Mac needs to support older macOS versions, it may need to handle related compatibility issues independently. Overall, these changes mainly affect gesture input handling, especially zoom-related functionality.

Impacted Classes:

RenderWidgetHostViewCocoa RenderWidgetHostNSViewHostHelper RenderWidgetHostViewMac RenderWidgetHostNSViewHost RenderWidgetHostNSView