Title: [111705] trunk/Source/WebKit2
Revision
111705
Author
jocelyn.turco...@nokia.com
Date
2012-03-22 08:24:26 -0700 (Thu, 22 Mar 2012)

Log Message

[Qt] Don't resume the suspended page if the user is continuously flicking.
https://bugs.webkit.org/show_bug.cgi?id=81895

Reviewed by Kenneth Rohde Christiansen.

Create an additional suspend deferrer between TouchBegin and TouchEnd to
relay with the one kept while the flick animation is running.
This allows the page to be suspended when a pan gesture starts and stay
that way until the last flick animation ends.

* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::touchBegin):
(WebKit):
(WebKit::QtViewportInteractionEngine::touchEnd):
(WebKit::QtViewportInteractionEngine::pinchGestureStarted):
* UIProcess/qt/QtViewportInteractionEngine.h:
(QtViewportInteractionEngine):
* UIProcess/qt/QtWebPageEventHandler.cpp:
(QtWebPageEventHandler::doneWithTouchEvent):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (111704 => 111705)


--- trunk/Source/WebKit2/ChangeLog	2012-03-22 15:22:54 UTC (rev 111704)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-22 15:24:26 UTC (rev 111705)
@@ -1,3 +1,25 @@
+2012-03-22  Jocelyn Turcotte  <jocelyn.turco...@nokia.com>
+
+        [Qt] Don't resume the suspended page if the user is continuously flicking.
+        https://bugs.webkit.org/show_bug.cgi?id=81895
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Create an additional suspend deferrer between TouchBegin and TouchEnd to
+        relay with the one kept while the flick animation is running.
+        This allows the page to be suspended when a pan gesture starts and stay
+        that way until the last flick animation ends.
+
+        * UIProcess/qt/QtViewportInteractionEngine.cpp:
+        (WebKit::QtViewportInteractionEngine::touchBegin):
+        (WebKit):
+        (WebKit::QtViewportInteractionEngine::touchEnd):
+        (WebKit::QtViewportInteractionEngine::pinchGestureStarted):
+        * UIProcess/qt/QtViewportInteractionEngine.h:
+        (QtViewportInteractionEngine):
+        * UIProcess/qt/QtWebPageEventHandler.cpp:
+        (QtWebPageEventHandler::doneWithTouchEvent):
+
 2012-03-22  Carlos Garcia Campos  <cgar...@bb-webkit-rel-64.local.igalia.com>
 
         [GTK] Use the angle-bracket form to include wtf headers

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (111704 => 111705)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-03-22 15:22:54 UTC (rev 111704)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-03-22 15:24:26 UTC (rev 111705)
@@ -298,6 +298,18 @@
     setItemRectVisible(endVisibleContentRect);
 }
 
+void QtViewportInteractionEngine::touchBegin()
+{
+    // Prevents resuming the page between the user's flicks of the page while the animation is running.
+    if (scrollAnimationActive())
+        m_touchUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent));
+}
+
+void QtViewportInteractionEngine::touchEnd()
+{
+    m_touchUpdateDeferrer.clear();
+}
+
 QRectF QtViewportInteractionEngine::computePosRangeForItemAtScale(qreal itemScale) const
 {
     const QSizeF contentItemSize = m_content->contentsSize() * itemScale;
@@ -517,8 +529,6 @@
 
 void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenterInViewportCoordinates)
 {
-    ASSERT(!m_suspendCount);
-
     if (!m_constraints.isUserScalable)
         return;
 

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h (111704 => 111705)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h	2012-03-22 15:22:54 UTC (rev 111704)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h	2012-03-22 15:24:26 UTC (rev 111705)
@@ -76,6 +76,8 @@
 
     void wheelEvent(QWheelEvent*);
     void pagePositionRequest(const QPoint& pos);
+    void touchBegin();
+    void touchEnd();
 
     bool scrollAnimationActive() const;
     void cancelScrollAnimation();
@@ -148,6 +150,7 @@
     bool m_hasSuspendedContent;
     OwnPtr<ViewportUpdateDeferrer> m_scaleUpdateDeferrer;
     OwnPtr<ViewportUpdateDeferrer> m_scrollUpdateDeferrer;
+    OwnPtr<ViewportUpdateDeferrer> m_touchUpdateDeferrer;
 
     bool m_hadUserInteraction;
 

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (111704 => 111705)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-03-22 15:22:54 UTC (rev 111704)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-03-22 15:24:26 UTC (rev 111705)
@@ -449,6 +449,7 @@
     case QEvent::TouchBegin:
         ASSERT(!m_interactionEngine->panGestureActive());
         ASSERT(!m_interactionEngine->pinchGestureActive());
+        m_interactionEngine->touchBegin();
 
         // The interaction engine might still be animating kinetic scrolling or a scale animation
         // such as double-tap to zoom or the bounce back effect. A touch stops the kinetic scrolling
@@ -460,6 +461,9 @@
         if (m_interactionEngine->scaleAnimationActive() && m_pinchGestureRecognizer.isRecognized())
             m_interactionEngine->interruptScaleAnimation();
         break;
+    case QEvent::TouchEnd:
+        m_interactionEngine->touchEnd();
+        break;
     default:
         break;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to