[webkit-changes] [WebKit/WebKit] 2cf765: [UnifiedPDF] Zoom origin is unstable when zooming

Simon Fraser noreply at github.com
Fri Mar 15 15:48:12 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2cf765d13bb88672dd9f14d8077a656a33f19a99
      https://github.com/WebKit/WebKit/commit/2cf765d13bb88672dd9f14d8077a656a33f19a99
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-03-15 (Fri, 15 Mar 2024)

  Changed paths:
    M Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] Zoom origin is unstable when zooming
https://bugs.webkit.org/show_bug.cgi?id=271077
rdar://124709631

Reviewed by Tim Horton.

There were two issues that caused zooming to feel wonky, especially when zooming fast.

First, the origin was off by top content inset, because the origin passed in to
`UnifiedPDFPlugin::setScaleFactor()` is not in root view coordinates;
`ViewGestureController::handleMagnificationGestureEvent()` subtracts out top content inset,
so put it back.

Second, because scrolling is asynchronous, computing scroll deltas for each zoom increment
doesn't work because the old scroll offset can reflect state from further in the past.
Fix this by computing each new scroll position directly from the zoom origin in content
coordinates, and in plugin coordinates. Cache these origins for the duration of a gesture.

* Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::handleMagnificationGestureEvent):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::didEndMagnificationGesture):
(WebKit::UnifiedPDFPlugin::setScaleFactor):
(WebKit::UnifiedPDFPlugin::setPageScaleFactor):

Canonical link: https://commits.webkit.org/276209@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list