Zoom on macOS is centered around a point lower than the cursor
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Mar 2019 23:11:09 +0000 (23:11 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Mar 2019 23:11:09 +0000 (23:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196225
rdar://problem/49213574

Reviewed by Tim Horton.

The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
coordinates, but we end up setting the transform on the RenderView's layer, so we need
to subtract the topContentInset.

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::handleMagnificationGestureEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243468 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm

index 242bd73..929cddf 100644 (file)
@@ -1,3 +1,18 @@
+2019-03-25  Simon Fraser  <simon.fraser@apple.com>
+
+        Zoom on macOS is centered around a point lower than the cursor
+        https://bugs.webkit.org/show_bug.cgi?id=196225
+        rdar://problem/49213574
+
+        Reviewed by Tim Horton.
+        
+        The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
+        coordinates, but we end up setting the transform on the RenderView's layer, so we need
+        to subtract the topContentInset.
+
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::handleMagnificationGestureEvent):
+
 2019-03-25  Alex Christensen  <achristensen@webkit.org>
 
         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
index 298b5e3..50241d8 100644 (file)
@@ -134,6 +134,8 @@ void ViewGestureController::gestureEventWasNotHandledByWebCore(NSEvent *event, F
 
 void ViewGestureController::handleMagnificationGestureEvent(NSEvent *event, FloatPoint origin)
 {
+    origin.setY(origin.y() - m_webPageProxy.topContentInset());
+
     ASSERT(m_activeGestureType == ViewGestureType::None || m_activeGestureType == ViewGestureType::Magnification);
 
     if (m_activeGestureType == ViewGestureType::None) {