diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-11 09:43:24 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-11 09:43:24 +0200 |
commit | 1b914638db989aaa98631a1c1e02c7b2d44805d8 (patch) | |
tree | 87f4fd2c7b38db320079a5de8877890d2ca3c485 /Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp | |
parent | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (diff) | |
download | qtwebkit-1b914638db989aaa98631a1c1e02c7b2d44805d8.tar.gz |
Imported WebKit commit 9a52e27980f47e8b0d8f8b7cc0fd7b5741bceb92 (http://svn.webkit.org/repository/webkit/trunk@116736)
New snapshot to include QDeclarative* -> QQml* build fixes
Diffstat (limited to 'Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp index 09f632456..949a5918c 100644 --- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp +++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp @@ -365,22 +365,25 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi if (scrollAnimationActive() || scaleAnimationActive()) return; + m_hadUserInteraction = true; + const int margin = 10; // We want at least a little bit of margin. QRectF endArea = itemRectFromCSS(targetArea.adjusted(-margin, -margin, margin, margin)); const QRectF viewportRect = m_viewport->boundingRect(); - qreal targetCSSScale = cssScaleFromItem(viewportRect.size().width() / endArea.size().width()); - qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(qMin(targetCSSScale, qreal(2.5)))); + qreal targetCSSScale = viewportRect.size().width() / endArea.size().width(); + qreal endCSSScale = innerBoundedCSSScale(qMin(targetCSSScale, qreal(2.5))); + qreal endItemScale = itemScaleFromCSS(endCSSScale); qreal currentScale = m_content->contentsScale(); // We want to end up with the target area filling the whole width of the viewport (if possible), // and centralized vertically where the user requested zoom. Thus our hotspot is the center of // the targetArea x-wise and the requested zoom position, y-wise. - const QPointF hotspot = QPointF(endArea.center().x(), touchPoint.y() * m_devicePixelRatio); + const QPointF hotspot = QPointF(endArea.center().x(), itemCoordFromCSS(touchPoint.y())); const QPointF viewportHotspot = viewportRect.center(); - QPointF endPosition = hotspot * endItemScale - viewportHotspot; + QPointF endPosition = hotspot * endCSSScale - viewportHotspot; QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); @@ -415,8 +418,9 @@ void QtViewportInteractionEngine::zoomToAreaGestureEnded(const QPointF& touchPoi case ZoomBack: { ScaleStackItem lastScale = m_scaleStack.takeLast(); endItemScale = lastScale.scale; + endCSSScale = cssScaleFromItem(lastScale.scale); // Recalculate endPosition and bound it according to new scale. - endPosition.setY(hotspot.y() * endItemScale - viewportHotspot.y()); + endPosition.setY(hotspot.y() * endCSSScale - viewportHotspot.y()); endPosition.setX(lastScale.xPosition); endPosRange = computePosRangeForItemAtScale(endItemScale); endPosition = boundPosition(endPosRange.topLeft(), endPosition, endPosRange.bottomRight()); |