summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
commit8d473cf9743f1d30a16a27114e93bd5af5648d23 (patch)
treecdca40d0353886b3ca52f33a2d7b8f1c0011aafc /Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
parent1b914638db989aaa98631a1c1e02c7b2d44805d8 (diff)
downloadqtwebkit-8d473cf9743f1d30a16a27114e93bd5af5648d23.tar.gz
Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578)
Weekly snapshot
Diffstat (limited to 'Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp')
-rw-r--r--Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp37
1 files changed, 7 insertions, 30 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
index 949a5918c..eb3c5a8d2 100644
--- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp
@@ -192,6 +192,13 @@ bool QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
if (itemRect == currentItemRectVisible)
return false;
+ // FIXME: Investigate why that animation doesn't run when we are unfocused.
+ if (!m_viewport->isVisible() || !m_viewport->hasFocus()) {
+ // Apply the end result immediately when we are non-visible.
+ setItemRectVisible(itemRect);
+ return true;
+ }
+
m_scaleAnimation->setDuration(kScaleAnimationDurationMillis);
m_scaleAnimation->setEasingCurve(QEasingCurve::OutCubic);
@@ -254,36 +261,6 @@ static inline QPointF boundPosition(const QPointF minPosition, const QPointF& po
qBound(minPosition.y(), position.y(), maxPosition.y()));
}
-void QtViewportInteractionEngine::wheelEvent(QWheelEvent* ev)
-{
- if (scrollAnimationActive() || scaleAnimationActive() || pinchGestureActive())
- return; // Ignore.
-
-
- // A normal scroll-tick should have a delta of 120 (1/8) degrees. Convert this to
- // local standard scroll step of 3 lines of 20 pixels.
- static const int cDefaultQtScrollStep = 20;
- static const int wheelScrollLines = 3;
- const int wheelTick = wheelScrollLines * cDefaultQtScrollStep;
-
- int pixelDelta = ev->delta() * (wheelTick / 120.f);
-
- QPointF newPosition = m_viewport->contentPos();
-
- if (ev->orientation() == Qt::Horizontal)
- newPosition.rx() -= pixelDelta;
- else
- newPosition.ry() -= pixelDelta;
-
- QRectF endPosRange = computePosRangeForItemAtScale(m_content->contentsScale());
-
- QPointF currentPosition = m_viewport->contentPos();
- newPosition = boundPosition(endPosRange.topLeft(), newPosition, endPosRange.bottomRight());
- m_viewport->setContentPos(newPosition);
-
- emit contentViewportChanged(currentPosition - newPosition);
-}
-
void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition)
{
// Ignore the request if suspended. Can only happen due to delay in event delivery.