diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-02-13 15:22:54 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-14 17:51:49 +0100 |
commit | 7e5ca126b32d9106c737b2cc399b98378619ca63 (patch) | |
tree | efa5ba939f3b0a3d1f7fe3d4115cce4e99c0ed3e | |
parent | ca9b6836810d2f9535810790fcca86ab35834caa (diff) | |
download | qtwebkit-7e5ca126b32d9106c737b2cc399b98378619ca63.tar.gz |
Changing WebView.contentY and WebView.contentX does not redraw content
https://bugs.webkit.org/show_bug.cgi?id=108337
https://bugreports.qt-project.org/browse/QTBUG-29557
Reviewed by Jocelyn Turcotte.
We should not ignore content position changes unless pinch zoom or bounce-back
animation is ongoing.
This way we notify the web process about visible rect changes if the contentX
and contentY properties are used to programmatically scroll the content from QML.
One important usecase for this is when implementing scrollbars.
Change-Id: If54453081debee7ad9f8c003b1bd54c5b0927fc9
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r-- | Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp index a8ba76cdb..c0eb16ab9 100644 --- a/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp +++ b/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp @@ -46,7 +46,7 @@ PageViewportControllerClientQt::PageViewportControllerClientQt(QQuickWebView* vi , m_lastCommittedScale(-1) , m_zoomOutScale(0) , m_isUserInteracting(false) - , m_ignoreViewportChanges(true) + , m_ignoreViewportChanges(false) { m_scaleAnimation->setDuration(kScaleAnimationDurationMillis); m_scaleAnimation->setEasingCurve(QEasingCurve::OutCubic); @@ -124,15 +124,12 @@ void PageViewportControllerClientQt::flickMoveStarted() m_controller->suspendContent(); m_lastScrollPosition = m_viewportItem->contentPos(); - - m_ignoreViewportChanges = false; } void PageViewportControllerClientQt::flickMoveEnded() { // This method is called on the end of the pan or pan kinetic animation. - m_ignoreViewportChanges = true; if (!m_isUserInteracting) m_controller->resumeContent(); } @@ -153,10 +150,12 @@ void PageViewportControllerClientQt::scaleAnimationStateChanged(QAbstractAnimati { switch (newState) { case QAbstractAnimation::Running: + m_ignoreViewportChanges = true; m_viewportItem->cancelFlick(); m_controller->suspendContent(); break; case QAbstractAnimation::Stopped: + m_ignoreViewportChanges = false; m_controller->resumeContent(); break; default: @@ -318,8 +317,8 @@ QRectF PageViewportControllerClientQt::nearestValidVisibleContentsRect() const void PageViewportControllerClientQt::setViewportPosition(const FloatPoint& contentsPoint) { QPointF newPosition((m_pageItem->position() + QPointF(contentsPoint)) * m_pageItem->contentsScale()); + // The contentX and contentY property changes trigger a visible rect update. m_viewportItem->setContentPos(newPosition); - updateViewportController(); } void PageViewportControllerClientQt::setContentsScale(float localScale, bool treatAsInitialValue) @@ -427,6 +426,7 @@ void PageViewportControllerClientQt::pinchGestureStarted(const QPointF& pinchCen clearRelativeZoomState(); + m_ignoreViewportChanges = true; m_controller->suspendContent(); m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; @@ -461,6 +461,7 @@ void PageViewportControllerClientQt::pinchGestureEnded() if (!m_controller->allowsUserScaling()) return; + m_ignoreViewportChanges = false; m_pinchStartScale = -1; // This will take care of resuming the content, even if no animation was performed. |