Title: [116520] trunk/Source/WebKit2
Revision
116520
Author
[email protected]
Date
2012-05-09 05:39:39 -0700 (Wed, 09 May 2012)

Log Message

[Qt] Tap-to-zoom zooms to wrong area.
https://bugs.webkit.org/show_bug.cgi?id=85982

Patch by Allan Sandfeld Jensen <[email protected]> on 2012-05-09
Reviewed by Kenneth Rohde Christiansen.

Fix computation and take more care when to use CSS scale and when to use Item scale.

* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (116519 => 116520)


--- trunk/Source/WebKit2/ChangeLog	2012-05-09 12:34:01 UTC (rev 116519)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-09 12:39:39 UTC (rev 116520)
@@ -1,3 +1,15 @@
+2012-05-09  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Tap-to-zoom zooms to wrong area.
+        https://bugs.webkit.org/show_bug.cgi?id=85982
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Fix computation and take more care when to use CSS scale and when to use Item scale.
+
+        * UIProcess/qt/QtViewportInteractionEngine.cpp:
+        (WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded):
+
 2012-05-09  Zalan Bujtas  <[email protected]>
 
         [Qt][WK2] Define clear split between QtWebPageLoadClient and QQuickWebViewPrivate for loading tasks.

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (116519 => 116520)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-05-09 12:34:01 UTC (rev 116519)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-05-09 12:39:39 UTC (rev 116520)
@@ -370,17 +370,18 @@
 
     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 +416,9 @@
     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());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to