mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
This change adds a full implementation of pinch zoom, including center-aware zooming. Before this kind of pinch zooming was only enabled on OpenHarmony. Now all pinch zooms must come with a focal point, which determines the center point of the zoom. This enables full pinch zoom on Android and has OpenHarmony use the same system for pinch zoom. Every WebView now has a `PinchZoom` which describes the viewport of the pinch zoom and handles panning with proper chaining of zoom viewport panning to scroll layer scrolling. In addition, the collection of touch actions is simplified by storing an array and turning each into a ScrollZoomEvent when appropriate. Caveats: - We've noticed some hard to diagnose bugs with clamping the panning viewport, but we'll tackle those later once we figure out how to reliably reproduce them. - Keyboard scroll events currently do not properly pan the pinch zoom viewport. This will be handled in a followup. Testing: There are currently no tests for this kind of touch interaction as there's no way to read the pinch zoom from a WebView. It's processed asynchronously. Once that API is added, we should be able to add some simple tests, but many things are still unaccessible such as the pan position in the pinch zoom viewport. Fixes #4224. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>