Reviewed by Simon Hausmann.
The tiling code needed the current visibleContentsRect in order to be
able to create tiles, so we now make sure it gets it. We also needed
to make sure to set the trajectory vector while panning and while the
flicking engine was animating kinetic scrolling.
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewFlickablePrivate::_q_updateVisibleContentRectAndScale):
(QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged):
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::setVisibleContentRectTrajectoryVector):
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::setVisibleContentRectTrajectoryVector):
* UIProcess/DrawingAreaProxyImpl.h:
(DrawingAreaProxyImpl):
* UIProcess/LayerTreeHostProxy.h:
(LayerTreeHostProxy):
* UIProcess/qt/LayerTreeHostProxyQt.cpp:
(WebKit::LayerTreeHostProxy::setVisibleContentRectTrajectoryVector):
* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine):
(WebKit::QtViewportInteractionEngine::flickableMovingStateChanged):
(WebKit):
(WebKit::QtViewportInteractionEngine::panMoveStarted):
(WebKit::QtViewportInteractionEngine::panMoveEnded):
(WebKit::QtViewportInteractionEngine::flickableMovingPositionUpdate):
(WebKit::QtViewportInteractionEngine::panGestureRequestUpdate):
* UIProcess/qt/QtViewportInteractionEngine.h:
(QtViewportInteractionEngine):
* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::setVisibleContentRectTrajectoryVector):
* WebProcess/WebPage/LayerTreeHost.messages.in:
* WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
(WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):
(WebKit::LayerTreeHostQt::setVisibleContentRectTrajectoryVector):
* WebProcess/WebPage/qt/LayerTreeHostQt.h:
(LayerTreeHostQt):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108625
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-23 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ [Qt] Page doesn't get repainted while panning is in progress
+ https://bugs.webkit.org/show_bug.cgi?id=78602
+
+ Reviewed by Simon Hausmann.
+
+ The tiling code needed the current visibleContentsRect in order to be
+ able to create tiles, so we now make sure it gets it. We also needed
+ to make sure to set the trajectory vector while panning and while the
+ flicking engine was animating kinetic scrolling.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewFlickablePrivate::_q_updateVisibleContentRectAndScale):
+ (QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged):
+ * UIProcess/DrawingAreaProxy.h:
+ (WebKit::DrawingAreaProxy::setVisibleContentRectTrajectoryVector):
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ (WebKit::DrawingAreaProxyImpl::setVisibleContentRectTrajectoryVector):
+ * UIProcess/DrawingAreaProxyImpl.h:
+ (DrawingAreaProxyImpl):
+ * UIProcess/LayerTreeHostProxy.h:
+ (LayerTreeHostProxy):
+ * UIProcess/qt/LayerTreeHostProxyQt.cpp:
+ (WebKit::LayerTreeHostProxy::setVisibleContentRectTrajectoryVector):
+ * UIProcess/qt/QtViewportInteractionEngine.cpp:
+ (WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine):
+ (WebKit::QtViewportInteractionEngine::flickableMovingStateChanged):
+ (WebKit):
+ (WebKit::QtViewportInteractionEngine::panMoveStarted):
+ (WebKit::QtViewportInteractionEngine::panMoveEnded):
+ (WebKit::QtViewportInteractionEngine::flickableMovingPositionUpdate):
+ (WebKit::QtViewportInteractionEngine::panGestureRequestUpdate):
+ * UIProcess/qt/QtViewportInteractionEngine.h:
+ (QtViewportInteractionEngine):
+ * WebProcess/WebPage/LayerTreeHost.h:
+ (WebKit::LayerTreeHost::setVisibleContentRectTrajectoryVector):
+ * WebProcess/WebPage/LayerTreeHost.messages.in:
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):
+ (WebKit::LayerTreeHostQt::setVisibleContentRectTrajectoryVector):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.h:
+ (LayerTreeHostQt):
+
2012-02-23 Patrick Gansterer <paroga@webkit.org>
[CMAKE][WK2] Cleanup WebKit2/CMakeLists.txt.
context->downloadManager()->addDownload(download, downloadItem);
}
-void QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& trajectoryVector)
-{
- DrawingAreaProxy* drawingArea = webPageProxy->drawingArea();
- if (!drawingArea)
- return;
- drawingArea->setVisibleContentRectTrajectoryVector(trajectoryVector);
-}
-
void QQuickWebViewPrivate::_q_onVisibleChanged()
{
webPageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
const QRectF visibleRectInCSSCoordinates = q->mapRectToWebContent(q->boundingRect()).intersected(pageView->boundingRect());
float scale = pageView->contentsScale();
+ // This is only for our QML ViewportInfo debugging API.
+ q->experimental()->viewportInfo()->didUpdateCurrentScale();
+
QRect alignedVisibleContentRect = visibleRectInCSSCoordinates.toAlignedRect();
drawingArea->setVisibleContentsRectAndScale(alignedVisibleContentRect, scale);
// FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended.
webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect);
- q->experimental()->viewportInfo()->didUpdateCurrentScale();
+}
+
+void QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& trajectoryVector)
+{
+ DrawingAreaProxy* drawingArea = webPageProxy->drawingArea();
+ if (!drawingArea)
+ return;
+
+ Q_Q(QQuickWebView);
+ const QRectF visibleRectInCSSCoordinates = q->mapRectToWebContent(q->boundingRect()).intersected(pageView->boundingRect());
+
+ QRect alignedVisibleContentRect = visibleRectInCSSCoordinates.toAlignedRect();
+ drawingArea->setVisibleContentRectTrajectoryVector(alignedVisibleContentRect, trajectoryVector);
}
void QQuickWebViewFlickablePrivate::_q_suspend()
#if USE(TILED_BACKING_STORE)
virtual void setVisibleContentsRectAndScale(const WebCore::IntRect& visibleContentsRect, float scale) { }
- virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&) { }
+ virtual void setVisibleContentRectTrajectoryVector(const WebCore::IntRect& visibleContentsRect, const WebCore::FloatPoint& trajectoryVector) { }
virtual void createTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo&) { }
virtual void updateTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo&) { }
virtual void removeTileForLayer(int layerID, int tileID) { }
m_layerTreeHostProxy->setVisibleContentsRectAndScale(visibleContentsRect, scale);
}
-void DrawingAreaProxyImpl::setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint& trajectoryVector)
+void DrawingAreaProxyImpl::setVisibleContentRectTrajectoryVector(const WebCore::IntRect& visibleContentsRect, const WebCore::FloatPoint& trajectoryVector)
{
if (m_layerTreeHostProxy)
- m_layerTreeHostProxy->setVisibleContentRectTrajectoryVector(trajectoryVector);
+ m_layerTreeHostProxy->setVisibleContentRectTrajectoryVector(visibleContentsRect, trajectoryVector);
}
void DrawingAreaProxyImpl::paintLayerTree(BackingStore::PlatformGraphicsContext context)
#if USE(TILED_BACKING_STORE)
virtual void setVisibleContentsRectAndScale(const WebCore::IntRect& visibleContentsRect, float scale);
- virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
+ virtual void setVisibleContentRectTrajectoryVector(const WebCore::IntRect& visibleContentsRect, const WebCore::FloatPoint&);
virtual void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float opacity, const WebCore::FloatRect&);
virtual void paintLayerTree(BackingStore::PlatformGraphicsContext);
void didReceiveLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
void paintToGraphicsContext(BackingStore::PlatformGraphicsContext);
void purgeGLResources();
void setVisibleContentsRectAndScale(const WebCore::IntRect&, float);
- void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
+ void setVisibleContentRectTrajectoryVector(const WebCore::IntRect&, const WebCore::FloatPoint&);
#if USE(TILED_BACKING_STORE)
void syncRemoteContent();
void swapContentBuffers();
pushUpdateToQueue(DestroyImageMessage::create(data));
}
-void LayerTreeHostProxy::setVisibleContentRectTrajectoryVector(const FloatPoint& trajectoryVector)
+void LayerTreeHostProxy::setVisibleContentRectTrajectoryVector(const IntRect& rect, const FloatPoint& trajectoryVector)
{
- m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentRectTrajectoryVector(trajectoryVector), m_drawingAreaProxy->page()->pageID());
+ m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeHost::SetVisibleContentRectTrajectoryVector(rect, trajectoryVector), m_drawingAreaProxy->page()->pageID());
}
void LayerTreeHostProxy::setVisibleContentsRectAndScale(const IntRect& rect, float scale)
connect(m_content, SIGNAL(widthChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection);
connect(m_content, SIGNAL(heightChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection);
- connect(m_flickProvider, SIGNAL(movingChanged()), SLOT(scrollStateChanged()), Qt::DirectConnection);
+ connect(m_flickProvider, SIGNAL(movingChanged()), SLOT(flickableMovingStateChanged()), Qt::DirectConnection);
connect(m_scaleAnimation, SIGNAL(valueChanged(QVariant)),
SLOT(scaleAnimationValueChanged(QVariant)), Qt::DirectConnection);
return true;
}
-void QtViewportInteractionEngine::scrollStateChanged()
+void QtViewportInteractionEngine::flickableMovingStateChanged()
{
- if (m_flickProvider->isMoving() && !m_scrollUpdateDeferrer)
- m_scrollUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this));
- else
- m_scrollUpdateDeferrer.clear();
+ if (m_flickProvider->isMoving()) {
+ if (m_scrollUpdateDeferrer)
+ return; // We get the isMoving() signal multiple times.
+ panMoveStarted();
+ } else
+ panMoveEnded();
+}
+
+void QtViewportInteractionEngine::panMoveStarted()
+{
+ m_scrollUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this));
+
+ m_lastScrollPosition = m_flickProvider->contentPos();
+ connect(m_flickProvider, SIGNAL(contentXChanged()), SLOT(flickableMovingPositionUpdate()));
+ connect(m_flickProvider, SIGNAL(contentYChanged()), SLOT(flickableMovingPositionUpdate()));
+}
+
+void QtViewportInteractionEngine::panMoveEnded()
+{
+ // This method is called on the end of the pan or pan kinetic animation.
+ m_scrollUpdateDeferrer.clear();
+
+ m_lastScrollPosition = QPointF();
+ disconnect(m_flickProvider, SIGNAL(contentXChanged()), this, SLOT(flickableMovingPositionUpdate()));
+ disconnect(m_flickProvider, SIGNAL(contentYChanged()), this, SLOT(flickableMovingPositionUpdate()));
+}
+
+void QtViewportInteractionEngine::flickableMovingPositionUpdate()
+{
+ QPointF newPosition = m_flickProvider->contentPos();
+
+ emit viewportTrajectoryVectorChanged(m_lastScrollPosition - newPosition);
+
+ m_lastScrollPosition = newPosition;
}
void QtViewportInteractionEngine::scaleAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State /*oldState*/)
{
ASSERT(event->type() == QEvent::TouchUpdate);
- QPointF viewportPosition = event->touchPoints().first().pos();
-
- emit viewportTrajectoryVectorChanged(m_lastPinchCenterInViewportCoordinates - viewportPosition);
-
m_flickProvider->handleTouchFlickEvent(const_cast<QTouchEvent*>(event));
- m_lastPinchCenterInViewportCoordinates = viewportPosition;
+ m_lastPinchCenterInViewportCoordinates = event->touchPoints().first().pos();
}
void QtViewportInteractionEngine::panGestureCancelled()
// Respond to changes of content that are not driven by us, like the page resizing itself.
void itemSizeChanged();
- void scrollStateChanged();
+ void flickableMovingStateChanged();
+ void flickableMovingPositionUpdate();
+
void scaleAnimationStateChanged(QAbstractAnimation::State, QAbstractAnimation::State);
void scaleAnimationValueChanged(QVariant value) { setItemRectVisible(value.toRectF()); }
qreal innerBoundedCSSScale(qreal);
qreal outerBoundedCSSScale(qreal);
+ void panMoveStarted(); // Called when panning starts.
+ void panMoveEnded(); // Called when panning (+ kinetic animation) ends.
+
QRectF computePosRangeForItemAtScale(qreal itemScale) const;
bool ensureContentWithinViewportBoundary(bool immediate = false);
ScaleAnimation* m_scaleAnimation;
QPointF m_lastPinchCenterInViewportCoordinates;
+ QPointF m_lastScrollPosition;
qreal m_pinchStartScale;
};
#if USE(TILED_BACKING_STORE)
virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float scale) { }
- virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&) { }
+ virtual void setVisibleContentRectTrajectoryVector(const WebCore::IntRect&, const WebCore::FloatPoint&) { }
virtual void setVisibleContentRectForLayer(int layerID, const WebCore::IntRect&) { }
virtual void renderNextFrame() { }
virtual void purgeBackingStores() { }
#if USE(TILED_BACKING_STORE)
messages -> LayerTreeHost {
- SetVisibleContentRectTrajectoryVector(WebCore::FloatPoint trajectoryVectory)
- SetVisibleContentRectAndScale(WebCore::IntRect contentRect, float scale)
+ SetVisibleContentRectTrajectoryVector(WebCore::IntRect visibleContentsRect, WebCore::FloatPoint trajectoryVectory)
+ SetVisibleContentRectAndScale(WebCore::IntRect visibleContentsRect, float scale)
RenderNextFrame()
PurgeBackingStores()
}
void LayerTreeHostQt::setVisibleContentRectAndScale(const IntRect& rect, float scale)
{
- if (rect == m_visibleContentsRect && scale == m_contentsScale)
- return;
m_visibleContentsRect = rect;
m_contentsScale = scale;
scheduleLayerFlush();
}
-void LayerTreeHostQt::setVisibleContentRectTrajectoryVector(const FloatPoint& trajectoryVector)
+void LayerTreeHostQt::setVisibleContentRectTrajectoryVector(const IntRect& rect, const FloatPoint& trajectoryVector)
{
+ m_visibleContentsRect = rect;
+
toWebGraphicsLayer(m_nonCompositedContentLayer.get())->setVisibleContentRectTrajectoryVector(trajectoryVector);
+
+ scheduleLayerFlush();
}
void LayerTreeHostQt::renderNextFrame()
virtual void purgeBackingStores();
virtual bool layerTreeTileUpdatesAllowed() const;
virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float scale);
- virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
+ virtual void setVisibleContentRectTrajectoryVector(const WebCore::IntRect&, const WebCore::FloatPoint&);
virtual void didSyncCompositingStateForLayer(const WebLayerInfo&);
virtual void attachLayer(WebCore::WebGraphicsLayer*);
virtual void detachLayer(WebCore::WebGraphicsLayer*);