Simplify RenderWidgetHostViewCocoa Gesture Handling Logic

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

← 返回列表

Simplify RenderWidgetHostViewCocoa Gesture Handling Logic

Moderate
提交哈希: 3e5f1d81b48e21242357af4a5a443fb53cebadf7
提交时间: 2025-06-04 17:12:31+00:00
影响等级: Moderate
生成工具: webview2-upstream-sentry
上游审核链接: 查看上游审核 🔗

📋 摘要

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.

🎯 影响分析

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.

受影响的类:

RenderWidgetHostViewCocoa RenderWidgetHostNSViewHostHelper RenderWidgetHostViewMac RenderWidgetHostNSViewHost RenderWidgetHostNSView