Title: [102338] trunk/Source/WebKit2
- Revision
- 102338
- Author
- [email protected]
- Date
- 2011-12-08 07:32:37 -0800 (Thu, 08 Dec 2011)
Log Message
[Qt] Fix non-animated pinch-zoom scale commit.
https://bugs.webkit.org/show_bug.cgi?id=74007
Reviewed by Kenneth Rohde Christiansen.
The update deferrer object was only destroyed at the end of the animation
and wouldn't be if the pinch-zoom was ended within legal bounds.
This patch also makes sure that the deferrer isn't destroyed and re-created
once the animation is started if it was already there.
* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::animateItemRectVisible):
(WebKit::QtViewportInteractionEngine::scaleAnimationStateChanged):
(WebKit::QtViewportInteractionEngine::ensureContentWithinViewportBoundary):
(WebKit::QtViewportInteractionEngine::pinchGestureEnded):
* UIProcess/qt/QtViewportInteractionEngine.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (102337 => 102338)
--- trunk/Source/WebKit2/ChangeLog 2011-12-08 15:30:29 UTC (rev 102337)
+++ trunk/Source/WebKit2/ChangeLog 2011-12-08 15:32:37 UTC (rev 102338)
@@ -1,3 +1,22 @@
+2011-12-07 Jocelyn Turcotte <[email protected]>
+
+ [Qt] Fix non-animated pinch-zoom scale commit.
+ https://bugs.webkit.org/show_bug.cgi?id=74007
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ The update deferrer object was only destroyed at the end of the animation
+ and wouldn't be if the pinch-zoom was ended within legal bounds.
+ This patch also makes sure that the deferrer isn't destroyed and re-created
+ once the animation is started if it was already there.
+
+ * UIProcess/qt/QtViewportInteractionEngine.cpp:
+ (WebKit::QtViewportInteractionEngine::animateItemRectVisible):
+ (WebKit::QtViewportInteractionEngine::scaleAnimationStateChanged):
+ (WebKit::QtViewportInteractionEngine::ensureContentWithinViewportBoundary):
+ (WebKit::QtViewportInteractionEngine::pinchGestureEnded):
+ * UIProcess/qt/QtViewportInteractionEngine.h:
+
2011-12-08 Simon Hausmann <[email protected]>
REGRESSION(r101683): QQuickWebView doesn't work with OpenGL/ES 2.0
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (102337 => 102338)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp 2011-12-08 15:30:29 UTC (rev 102337)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp 2011-12-08 15:32:37 UTC (rev 102338)
@@ -181,11 +181,11 @@
m_content->setPos(- itemRect.topLeft() * itemScale);
}
-void QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
+bool QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
{
QRectF currentItemRectVisible = m_content->mapRectFromItem(m_viewport, m_viewport->boundingRect());
if (itemRect == currentItemRectVisible)
- return;
+ return false;
m_scaleAnimation->setDuration(kScaleAnimationDurationMillis);
m_scaleAnimation->setEasingCurve(QEasingCurve::OutCubic);
@@ -194,13 +194,15 @@
m_scaleAnimation->setEndValue(itemRect);
m_scaleAnimation->start();
+ return true;
}
void QtViewportInteractionEngine::scaleAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State /*oldState*/)
{
switch (newState) {
case QAbstractAnimation::Running:
- m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this));
+ if (!m_scaleUpdateDeferrer)
+ m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this));
break;
case QAbstractAnimation::Stopped:
m_scaleUpdateDeferrer.clear();
@@ -392,12 +394,12 @@
animateItemRectVisible(endVisibleContentRect);
}
-void QtViewportInteractionEngine::ensureContentWithinViewportBoundary(bool immediate)
+bool QtViewportInteractionEngine::ensureContentWithinViewportBoundary(bool immediate)
{
ASSERT(m_suspendCount);
if (scrollAnimationActive() || scaleAnimationActive())
- return;
+ return false;
qreal currentCSSScale = cssScaleFromItem(m_content->scale());
@@ -413,10 +415,11 @@
QRectF endVisibleContentRect(endPosition / endItemScale, viewportRect.size() / endItemScale);
- if (immediate)
+ if (immediate) {
setItemRectVisible(endVisibleContentRect);
- else
- animateItemRectVisible(endVisibleContentRect);
+ return true;
+ }
+ return !animateItemRectVisible(endVisibleContentRect);
}
void QtViewportInteractionEngine::reset()
@@ -555,7 +558,9 @@
return;
m_pinchStartScale = -1;
- ensureContentWithinViewportBoundary();
+ // Clear the update deferrer now if we're in our final position and there won't be any animation to clear it later.
+ if (ensureContentWithinViewportBoundary())
+ m_scaleUpdateDeferrer.clear();
}
void QtViewportInteractionEngine::itemSizeChanged()
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h (102337 => 102338)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h 2011-12-08 15:30:29 UTC (rev 102337)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h 2011-12-08 15:32:37 UTC (rev 102338)
@@ -69,7 +69,7 @@
void applyConstraints(const Constraints&);
void setItemRectVisible(const QRectF&);
- void animateItemRectVisible(const QRectF&);
+ bool animateItemRectVisible(const QRectF&);
void wheelEvent(QWheelEvent*);
void pagePositionRequest(const QPoint& pos);
@@ -120,7 +120,7 @@
qreal outerBoundedCSSScale(qreal);
QRectF computePosRangeForItemAtScale(qreal itemScale) const;
- void ensureContentWithinViewportBoundary(bool immediate = false);
+ bool ensureContentWithinViewportBoundary(bool immediate = false);
void scaleContent(const QPointF& centerInContentCoordinates, qreal scale);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes