WebKit2 View Gestures (Smart Zoom): Can't double-tap zoom-out on the body
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Jan 2014 06:01:29 +0000 (06:01 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Jan 2014 06:01:29 +0000 (06:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127602

Reviewed by Anders Carlsson.

* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureController.mm:
(WebKit::ViewGestureController::ViewGestureController):
(WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
Use an explicit boolean instead of the emptiness of the renderRect() to determine
whether or not the user has already smart-zoomed. renderRect() can be 0x0
if our hit-test hits the body element.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/ViewGestureController.h
Source/WebKit2/UIProcess/mac/ViewGestureController.mm

index da1d1d0..2701380 100644 (file)
@@ -1,3 +1,18 @@
+2014-01-24  Tim Horton  <timothy_horton@apple.com>
+
+        WebKit2 View Gestures (Smart Zoom): Can't double-tap zoom-out on the body
+        https://bugs.webkit.org/show_bug.cgi?id=127602
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/mac/ViewGestureController.h:
+        * UIProcess/mac/ViewGestureController.mm:
+        (WebKit::ViewGestureController::ViewGestureController):
+        (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
+        Use an explicit boolean instead of the emptiness of the renderRect() to determine
+        whether or not the user has already smart-zoomed. renderRect() can be 0x0
+        if our hit-test hits the body element.
+
 2014-01-24  Jinwoo Song  <jinwoo7.song@samsung.com>
 
         Fix EFL WebKit2 build.
index 2bbc2f3..c7d7b0b 100644 (file)
@@ -69,6 +69,7 @@ private:
     WebCore::FloatPoint m_magnificationOrigin;
 
     WebCore::FloatRect m_lastSmartMagnificationUnscaledTargetRect;
+    bool m_lastSmartMagnificationUnscaledTargetRectIsValid;
 
     ViewGestureType m_activeGestureType;
 
index 7cefcc1..ee5ebd4 100644 (file)
@@ -49,6 +49,7 @@ namespace WebKit {
 
 ViewGestureController::ViewGestureController(WebPageProxy& webPageProxy)
     : m_webPageProxy(webPageProxy)
+    , m_lastSmartMagnificationUnscaledTargetRectIsValid(false)
     , m_activeGestureType(ViewGestureType::None)
     , m_visibleContentRectIsValid(false)
     , m_frameHandlesMagnificationGesture(false)
@@ -177,7 +178,7 @@ void ViewGestureController::didCollectGeometryForSmartMagnificationGesture(Float
     // 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_lastSmartMagnificationUnscaledTargetRect.isEmpty()
+        && m_lastSmartMagnificationUnscaledTargetRectIsValid
         && maximumRectangleComponentDelta(m_lastSmartMagnificationUnscaledTargetRect, unscaledTargetRect) < smartMagnificationPanScrollThreshold)
         targetMagnification = 1;
 
@@ -190,6 +191,7 @@ void ViewGestureController::didCollectGeometryForSmartMagnificationGesture(Float
     m_webPageProxy.drawingArea()->commitTransientZoom(targetMagnification, targetOrigin);
 
     m_lastSmartMagnificationUnscaledTargetRect = unscaledTargetRect;
+    m_lastSmartMagnificationUnscaledTargetRectIsValid = true;
 }
 
 void ViewGestureController::endActiveGesture()