Title: [114857] trunk/Source/WebKit2
- Revision
- 114857
- Author
- commit-qu...@webkit.org
- Date
- 2012-04-22 09:43:27 -0700 (Sun, 22 Apr 2012)
Log Message
[Qt] Multi-level tap-to-zoom.
https://bugs.webkit.org/show_bug.cgi?id=84456
Patch by Allan Sandfeld Jensen <allan.jen...@nokia.com> on 2012-04-22
Reviewed by Kenneth Rohde Christiansen.
Replace tap-to-zoomed flag with a stack of progressively higher zoom levels,
and zoom out to last zoom-level when attempting to zoom to current level.
Additionally detect a series of tap-to-zoom gestures on the same level and
continue to zoom out.
* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine):
(WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded):
(WebKit::QtViewportInteractionEngine::pinchGestureStarted):
* UIProcess/qt/QtViewportInteractionEngine.h:
(QtViewportInteractionEngine):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (114856 => 114857)
--- trunk/Source/WebKit2/ChangeLog 2012-04-22 00:18:34 UTC (rev 114856)
+++ trunk/Source/WebKit2/ChangeLog 2012-04-22 16:43:27 UTC (rev 114857)
@@ -1,3 +1,23 @@
+2012-04-22 Allan Sandfeld Jensen <allan.jen...@nokia.com>
+
+ [Qt] Multi-level tap-to-zoom.
+ https://bugs.webkit.org/show_bug.cgi?id=84456
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Replace tap-to-zoomed flag with a stack of progressively higher zoom levels,
+ and zoom out to last zoom-level when attempting to zoom to current level.
+
+ Additionally detect a series of tap-to-zoom gestures on the same level and
+ continue to zoom out.
+
+ * UIProcess/qt/QtViewportInteractionEngine.cpp:
+ (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine):
+ (WebKit::QtViewportInteractionEngine::zoomToAreaGestureEnded):
+ (WebKit::QtViewportInteractionEngine::pinchGestureStarted):
+ * UIProcess/qt/QtViewportInteractionEngine.h:
+ (QtViewportInteractionEngine):
+
2012-04-20 Jon Lee <jon...@apple.com>
Add Notification constructor
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (114856 => 114857)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp 2012-04-22 00:18:34 UTC (rev 114856)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp 2012-04-22 16:43:27 UTC (rev 114857)
@@ -125,9 +125,9 @@
, m_suspendCount(0)
, m_hasSuspendedContent(false)
, m_hadUserInteraction(false)
- , m_zoomedToArea(false)
, m_scaleAnimation(new ScaleAnimation(this))
, m_pinchStartScale(-1)
+ , m_zoomOutScale(0.0)
{
reset();
@@ -367,12 +367,25 @@
qreal targetCSSScale = cssScaleFromItem(viewportRect.size().width() / endArea.size().width());
qreal endItemScale = itemScaleFromCSS(innerBoundedCSSScale(qMin(targetCSSScale, qreal(2.5))));
- // Zoom back out on a second double click, but still center on the new touch point.
- if (m_zoomedToArea) {
- m_zoomedToArea = false;
- endItemScale = itemScaleFromCSS(m_minimumScale);
- } else
- m_zoomedToArea = true;
+ qreal currentScale = m_content->contentsScale();
+ if (!m_scaleStack.isEmpty()) {
+ // Zoom back out if attempting to scale to the same current scale, or
+ // attempting to continue scaling out from the inner most level.
+ if (endItemScale == m_zoomOutScale || endItemScale == currentScale)
+ endItemScale = m_scaleStack.takeLast();
+ else if (endItemScale > currentScale) {
+ m_scaleStack.append(currentScale);
+ m_zoomOutScale = endItemScale;
+ } else { // endItemScale < currentScale
+ // Unstack all scale-levels deeper than the new level, so a zoom-out won't zoom in to a previous level.
+ while (!m_scaleStack.isEmpty() && m_scaleStack.last() >= endItemScale)
+ m_scaleStack.removeLast();
+ m_zoomOutScale = endItemScale;
+ }
+ } else {
+ m_scaleStack.append(currentScale);
+ m_zoomOutScale = endItemScale;
+ }
// 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
@@ -526,7 +539,8 @@
return;
m_hadUserInteraction = true;
- m_zoomedToArea = false;
+ m_scaleStack.clear();
+ m_zoomOutScale = 0.0;
m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent));
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h (114856 => 114857)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h 2012-04-22 00:18:34 UTC (rev 114856)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h 2012-04-22 16:43:27 UTC (rev 114857)
@@ -148,7 +148,6 @@
OwnPtr<ViewportUpdateDeferrer> m_touchUpdateDeferrer;
bool m_hadUserInteraction;
- bool m_zoomedToArea;
class ScaleAnimation : public QVariantAnimation {
public:
@@ -163,6 +162,8 @@
QPointF m_lastPinchCenterInViewportCoordinates;
QPointF m_lastScrollPosition;
qreal m_pinchStartScale;
+ qreal m_zoomOutScale;
+ QList<qreal> m_scaleStack;
};
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes