Title: [163323] trunk/Source/WebKit2
Revision
163323
Author
[email protected]
Date
2014-02-03 13:46:46 -0800 (Mon, 03 Feb 2014)

Log Message

WebKit2 View Gestures: Two smart magnifications in a row without moving the mouse should zoom out
https://bugs.webkit.org/show_bug.cgi?id=128108
<rdar://problem/15914539>

Reviewed by Darin Adler.

* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureController.mm:
(WebKit::ViewGestureController::ViewGestureController):
(WebKit::ViewGestureController::handleMagnificationGesture):
Clear the bit that tells us that we should do "smart" things (because the
last gesture was also a smart magnification gesture) when the user manually pinch-magnifies.

(WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
Zoom out if the mouse hasn't moved since the last pinch-magnification gesture.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (163322 => 163323)


--- trunk/Source/WebKit2/ChangeLog	2014-02-03 20:59:40 UTC (rev 163322)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-03 21:46:46 UTC (rev 163323)
@@ -1,3 +1,22 @@
+2014-02-03  Tim Horton  <[email protected]>
+
+        WebKit2 View Gestures: Two smart magnifications in a row without moving the mouse should zoom out
+        https://bugs.webkit.org/show_bug.cgi?id=128108
+        <rdar://problem/15914539>
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/mac/ViewGestureController.h:
+        * UIProcess/mac/ViewGestureController.mm:
+        (WebKit::ViewGestureController::ViewGestureController):
+        (WebKit::ViewGestureController::handleMagnificationGesture):
+        Clear the bit that tells us that we should do "smart" things (because the
+        last gesture was also a smart magnification gesture) when the user manually pinch-magnifies.
+
+        (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
+        Zoom out if the mouse hasn't moved since the last pinch-magnification gesture.
+
+
 2014-02-03  Darin Adler  <[email protected]>
 
         Try to fix 32-bit Mac build.

Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (163322 => 163323)


--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2014-02-03 20:59:40 UTC (rev 163322)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2014-02-03 21:46:46 UTC (rev 163323)
@@ -100,7 +100,8 @@
     WebCore::FloatPoint m_magnificationOrigin;
 
     WebCore::FloatRect m_lastSmartMagnificationUnscaledTargetRect;
-    bool m_lastSmartMagnificationUnscaledTargetRectIsValid;
+    bool m_lastMagnificationGestureWasSmartMagnification;
+    WebCore::FloatPoint m_lastSmartMagnificationOrigin;
 
     ViewGestureType m_activeGestureType;
 

Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.mm (163322 => 163323)


--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.mm	2014-02-03 20:59:40 UTC (rev 163322)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.mm	2014-02-03 21:46:46 UTC (rev 163323)
@@ -93,7 +93,7 @@
 
 ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
     : m_webPageProxy(webPageProxy)
-    , m_lastSmartMagnificationUnscaledTargetRectIsValid(false)
+    , m_lastMagnificationGestureWasSmartMagnification(false)
     , m_activeGestureType(ViewGestureType::None)
     , m_visibleContentRectIsValid(false)
     , m_frameHandlesMagnificationGesture(false)
@@ -153,6 +153,7 @@
         // FIXME: We drop the first frame of the gesture on the floor, because we don't have the visible content bounds yet.
         m_magnification = m_webPageProxy.pageScaleFactor();
         m_webPageProxy.process().send(Messages::ViewGestureGeometryCollector::CollectGeometryForMagnificationGesture(), m_webPageProxy.pageID());
+        m_lastMagnificationGestureWasSmartMagnification = false;
 
         return;
     }
@@ -225,12 +226,15 @@
     targetMagnification = std::min(std::max(targetMagnification, minMagnification), maxMagnification);
 
     // Allow panning between elements via double-tap while magnified, unless the target rect is
-    // similar to the last one, in which case we'll zoom all the way out.
-    if (currentScaleFactor > 1
-        && m_lastSmartMagnificationUnscaledTargetRectIsValid
-        && maximumRectangleComponentDelta(m_lastSmartMagnificationUnscaledTargetRect, unscaledTargetRect) < smartMagnificationPanScrollThreshold)
-        targetMagnification = 1;
+    // similar to the last one or the mouse has not moved, in which case we'll zoom all the way out.
+    if (currentScaleFactor > 1 && m_lastMagnificationGestureWasSmartMagnification) {
+        if (maximumRectangleComponentDelta(m_lastSmartMagnificationUnscaledTargetRect, unscaledTargetRect) < smartMagnificationPanScrollThreshold)
+            targetMagnification = 1;
 
+        if (m_lastSmartMagnificationOrigin == origin)
+            targetMagnification = 1;
+    }
+
     FloatRect targetRect(unscaledTargetRect);
     targetRect.scale(targetMagnification);
     FloatPoint targetOrigin(visibleContentRect.center());
@@ -240,7 +244,9 @@
     m_webPageProxy.drawingArea()->commitTransientZoom(targetMagnification, targetOrigin);
 
     m_lastSmartMagnificationUnscaledTargetRect = unscaledTargetRect;
-    m_lastSmartMagnificationUnscaledTargetRectIsValid = true;
+    m_lastSmartMagnificationOrigin = origin;
+
+    m_lastMagnificationGestureWasSmartMagnification = true;
 }
 
 bool ViewGestureController::handleScrollWheelEvent(NSEvent *event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to