Title: [108625] trunk/Source/WebKit2
Revision
108625
Author
[email protected]
Date
2012-02-23 07:10:30 -0800 (Thu, 23 Feb 2012)

Log Message

[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):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (108624 => 108625)


--- trunk/Source/WebKit2/ChangeLog	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-23 15:10:30 UTC (rev 108625)
@@ -1,3 +1,47 @@
+2012-02-23  Kenneth Rohde Christiansen  <[email protected]>
+
+        [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  <[email protected]>
 
         [CMAKE][WK2] Cleanup WebKit2/CMakeLists.txt.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-23 15:10:30 UTC (rev 108625)
@@ -212,14 +212,6 @@
     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);
@@ -620,14 +612,29 @@
     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()
 {
     pageIsSuspended = true;

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2012-02-23 15:10:30 UTC (rev 108625)
@@ -94,7 +94,7 @@
 
 #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) { }

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2012-02-23 15:10:30 UTC (rev 108625)
@@ -354,10 +354,10 @@
         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)

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2012-02-23 15:10:30 UTC (rev 108625)
@@ -79,7 +79,7 @@
 
 #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*);

Modified: trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.h (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.h	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/LayerTreeHostProxy.h	2012-02-23 15:10:30 UTC (rev 108625)
@@ -58,7 +58,7 @@
     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();

Modified: trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp	2012-02-23 15:10:30 UTC (rev 108625)
@@ -563,9 +563,9 @@
     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)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-02-23 15:10:30 UTC (rev 108625)
@@ -125,7 +125,7 @@
 
     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);
@@ -187,14 +187,44 @@
     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*/)
 {
     switch (newState) {
@@ -427,12 +457,8 @@
 {
     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()

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h (108624 => 108625)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h	2012-02-23 15:10:30 UTC (rev 108625)
@@ -110,7 +110,9 @@
     // 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()); }
 
@@ -125,6 +127,9 @@
     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);
 
@@ -154,6 +159,7 @@
 
     ScaleAnimation* m_scaleAnimation;
     QPointF m_lastPinchCenterInViewportCoordinates;
+    QPointF m_lastScrollPosition;
     qreal m_pinchStartScale;
 };
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h (108624 => 108625)


--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2012-02-23 15:10:30 UTC (rev 108625)
@@ -81,7 +81,7 @@
 
 #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() { }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in (108624 => 108625)


--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.messages.in	2012-02-23 15:10:30 UTC (rev 108625)
@@ -20,8 +20,8 @@
 
 #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()
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp (108624 => 108625)


--- trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp	2012-02-23 15:10:30 UTC (rev 108625)
@@ -420,8 +420,6 @@
 
 void LayerTreeHostQt::setVisibleContentRectAndScale(const IntRect& rect, float scale)
 {
-    if (rect == m_visibleContentsRect && scale == m_contentsScale)
-        return;
     m_visibleContentsRect = rect;
     m_contentsScale = scale;
 
@@ -433,9 +431,13 @@
     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()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h (108624 => 108625)


--- trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h	2012-02-23 14:58:07 UTC (rev 108624)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h	2012-02-23 15:10:30 UTC (rev 108625)
@@ -74,7 +74,7 @@
     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*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to