Commit be85c582 authored by jocelyn.turcotte@nokia.com's avatar jocelyn.turcotte@nokia.com
Browse files

[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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@111705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 24dd2c0b
2012-03-22 Jocelyn Turcotte <jocelyn.turcotte@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 <cgarcia@bb-webkit-rel-64.local.igalia.com>
 
[GTK] Use the angle-bracket form to include wtf headers
......@@ -298,6 +298,18 @@ void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition
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 @@ bool QtViewportInteractionEngine::pinchGestureActive() const
void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenterInViewportCoordinates)
{
ASSERT(!m_suspendCount);
if (!m_constraints.isUserScalable)
return;
......
......@@ -76,6 +76,8 @@ public:
void wheelEvent(QWheelEvent*);
void pagePositionRequest(const QPoint& pos);
void touchBegin();
void touchEnd();
bool scrollAnimationActive() const;
void cancelScrollAnimation();
......@@ -148,6 +150,7 @@ private:
bool m_hasSuspendedContent;
OwnPtr<ViewportUpdateDeferrer> m_scaleUpdateDeferrer;
OwnPtr<ViewportUpdateDeferrer> m_scrollUpdateDeferrer;
OwnPtr<ViewportUpdateDeferrer> m_touchUpdateDeferrer;
bool m_hadUserInteraction;
......
......@@ -449,6 +449,7 @@ void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event,
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 @@ void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event,
if (m_interactionEngine->scaleAnimationActive() && m_pinchGestureRecognizer.isRecognized())
m_interactionEngine->interruptScaleAnimation();
break;
case QEvent::TouchEnd:
m_interactionEngine->touchEnd();
break;
default:
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment