Title: [94685] trunk/Source
Revision
94685
Author
[email protected]
Date
2011-09-07 10:35:21 -0700 (Wed, 07 Sep 2011)

Log Message

[Qt][WK2] Make TiledDrawingArea request tiles only in the direction the viewport is panned to.
https://bugs.webkit.org/show_bug.cgi?id=67606

Source/WebCore:

Reviewed by Noam Rosenthal.

TiledBackingStore previously used different values for horizontal and vertial multiplication
to calculate the cover area.
This patch replaces this mechanism, used to give a bigger panning range to vertical panning,
with the possibility to use the motion vector of the viewport to request tiles ahead instead.
This allows economies on rendering resources as tiles won't be rendered beside the trajectory
of the viewport.

* platform/graphics/TiledBackingStore.cpp:
(WebCore::TiledBackingStore::TiledBackingStore):
(WebCore::TiledBackingStore::setKeepAndCoverAreaMultipliers):
(WebCore::TiledBackingStore::setCoverAreaFocusVector):
(WebCore::TiledBackingStore::createTiles):
(WebCore::TiledBackingStore::calculateKeepRect):
(WebCore::TiledBackingStore::calculateCoverRect):
* platform/graphics/TiledBackingStore.h:
(WebCore::TiledBackingStore::getKeepAndCoverAreaMultipliers):

Source/WebKit/qt:

TiledBackingStore previously used different values for horizontal and vertial multiplication
to calculate the cover area.
This patch replaces this mechanism, used to give a bigger panning range to vertical panning,
with the possibility to use the motion vector of the viewport to request tiles ahead instead.
This allows economies on rendering resources as tiles won't be rendered beside the trajectory
of the viewport.

* Api/qwebpage.cpp:
(QWebPagePrivate::dynamicPropertyChangeEvent):

Source/WebKit2:

TiledBackingStore previously used different values for horizontal and vertial multiplication
to calculate the cover area.
This patch replaces this mechanism, used to give a bigger panning range to vertical panning,
with the possibility to use the motion vector of the viewport to request tiles ahead instead.
This allows economies on rendering resources as tiles won't be rendered beside the trajectory
of the viewport.

* UIProcess/API/qt/qtouchwebview.cpp:
(QTouchWebViewPrivate::QTouchWebViewPrivate):
(QTouchWebViewPrivate::_q_viewportMotionVectorChanged):
* UIProcess/API/qt/qtouchwebview.h:
* UIProcess/API/qt/qtouchwebview_p.h:
* UIProcess/TiledDrawingAreaProxy.cpp:
(WebKit::TiledDrawingAreaProxy::setVisibleContentRectMotionVector):
* UIProcess/TiledDrawingAreaProxy.h:
* UIProcess/qt/ViewportInteractionEngine.cpp:
(WebKit::ViewportInteractionEngine::panGestureRequestUpdate):
(WebKit::ViewportInteractionEngine::panGestureEnded):
(WebKit::ViewportInteractionEngine::pinchGestureStarted):
* UIProcess/qt/ViewportInteractionEngine.h:
* UIProcess/qt/qtouchwebpageproxy.cpp:
(QTouchWebPageProxy::setVisibleContentRectMotionVector):
* UIProcess/qt/qtouchwebpageproxy.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setVisibleContentRectMotionVector):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/TiledDrawingArea.cpp:
(WebKit::TiledDrawingArea::setVisibleContentRectMotionVector):
* WebProcess/WebPage/TiledDrawingArea.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94684 => 94685)


--- trunk/Source/WebCore/ChangeLog	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebCore/ChangeLog	2011-09-07 17:35:21 UTC (rev 94685)
@@ -1,3 +1,27 @@
+2011-09-05  Jocelyn Turcotte  <[email protected]>
+
+        [Qt][WK2] Make TiledDrawingArea request tiles only in the direction the viewport is panned to.
+        https://bugs.webkit.org/show_bug.cgi?id=67606
+
+        Reviewed by Noam Rosenthal.
+
+        TiledBackingStore previously used different values for horizontal and vertial multiplication
+        to calculate the cover area.
+        This patch replaces this mechanism, used to give a bigger panning range to vertical panning,
+        with the possibility to use the motion vector of the viewport to request tiles ahead instead.
+        This allows economies on rendering resources as tiles won't be rendered beside the trajectory
+        of the viewport.
+
+        * platform/graphics/TiledBackingStore.cpp:
+        (WebCore::TiledBackingStore::TiledBackingStore):
+        (WebCore::TiledBackingStore::setKeepAndCoverAreaMultipliers):
+        (WebCore::TiledBackingStore::setCoverAreaFocusVector):
+        (WebCore::TiledBackingStore::createTiles):
+        (WebCore::TiledBackingStore::calculateKeepRect):
+        (WebCore::TiledBackingStore::calculateCoverRect):
+        * platform/graphics/TiledBackingStore.h:
+        (WebCore::TiledBackingStore::getKeepAndCoverAreaMultipliers):
+
 2011-09-01  Jocelyn Turcotte  <[email protected]>
 
         [Qt] TiledBackingStore: Import the resizeEdgeTiles logic from TiledDrawindAreaProxy.

Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp (94684 => 94685)


--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp	2011-09-07 17:35:21 UTC (rev 94685)
@@ -43,12 +43,13 @@
     , m_tileCreationTimer(new TileTimer(this, &TiledBackingStore::tileCreationTimerFired))
     , m_tileSize(defaultTileWidth, defaultTileHeight)
     , m_tileCreationDelay(0.01)
-    , m_keepAreaMultiplier(2.f, 3.5f)
-    , m_coverAreaMultiplier(1.5f, 2.5f)
+    , m_keepAreaMultiplier(3.5f)
+    , m_coverAreaMultiplier(2.5f)
     , m_contentsScale(1.f)
     , m_pendingScale(0)
     , m_contentsFrozen(false)
 {
+    ASSERT(m_coverAreaMultiplier <= m_keepAreaMultiplier);
 }
 
 TiledBackingStore::~TiledBackingStore()
@@ -69,13 +70,23 @@
     m_tileCreationDelay = delay;
 }
 
-void TiledBackingStore::setKeepAndCoverAreaMultipliers(const FloatSize& keepMultiplier, const FloatSize& coverMultiplier)
+void TiledBackingStore::setKeepAndCoverAreaMultipliers(float keepMultiplier, float coverMultiplier)
 {
+    ASSERT(coverMultiplier <= keepMultiplier);
     m_keepAreaMultiplier = keepMultiplier;
     m_coverAreaMultiplier = coverMultiplier;
     startTileCreationTimer();
 }
 
+void TiledBackingStore::setVisibleRectTrajectoryVector(const FloatPoint& vector)
+{
+    if (m_visibleRectTrajectoryVector == vector)
+        return;
+
+    m_visibleRectTrajectoryVector = vector;
+    startTileCreationTimer();
+}
+
 void TiledBackingStore::invalidate(const IntRect& contentsDirtyRect)
 {
     IntRect dirtyRect(mapFromContents(contentsDirtyRect));
@@ -240,19 +251,12 @@
     // Resize tiles on edges in case the contents size has changed.
     bool didResizeTiles = resizeEdgeTiles();
 
-    IntRect keepRect = visibleRect;
-    // Inflates to both sides, so divide inflate delta by 2
-    keepRect.inflateX(visibleRect.width() * (m_keepAreaMultiplier.width() - 1.f) / 2);
-    keepRect.inflateY(visibleRect.height() * (m_keepAreaMultiplier.height() - 1.f) / 2);
-    keepRect.intersect(contentsRect());
+    IntRect keepRect = computeKeepRect(visibleRect);
     
     dropTilesOutsideRect(keepRect);
     
-    IntRect coverRect = visibleRect;
-    // Inflates to both sides, so divide inflate delta by 2
-    coverRect.inflateX(visibleRect.width() * (m_coverAreaMultiplier.width() - 1.f) / 2);
-    coverRect.inflateY(visibleRect.height() * (m_coverAreaMultiplier.height() - 1.f) / 2);
-    coverRect.intersect(contentsRect());
+    IntRect coverRect = computeCoverRect(visibleRect);
+    ASSERT(keepRect.contains(coverRect));
     
     // Search for the tile position closest to the viewport center that does not yet contain a tile. 
     // Which position is considered the closest depends on the tileDistance function.
@@ -296,6 +300,44 @@
         m_tileCreationTimer->startOneShot(m_tileCreationDelay);
 }
 
+IntRect TiledBackingStore::computeKeepRect(const IntRect& visibleRect) const
+{
+    IntRect result = visibleRect;
+    // Inflates to both sides, so divide the inflate delta by 2.
+    result.inflateX(visibleRect.width() * (m_keepAreaMultiplier - 1) / 2);
+    result.inflateY(visibleRect.height() * (m_keepAreaMultiplier - 1) / 2);
+    result.intersect(contentsRect());
+
+    return result;
+}
+
+// A null trajectory vector means that tiles intersecting all the coverArea (i.e. visibleRect * coverMultiplier) will be created.
+// A non-null trajectory vector will shrink the intersection rect to visibleRect plus its expansion from its
+// center toward the cover area edges in the direction of the given vector.
+// E.g. if visibleRect == (10,10)5x5 and coverMultiplier == 3.0:
+// a (0,0) trajectory vector will create tiles intersecting (5,5)15x15,
+// a (1,0) trajectory vector will create tiles intersecting (10,10)10x5,
+// and a (1,1) trajectory vector will create tiles intersecting (10,10)10x10.
+IntRect TiledBackingStore::computeCoverRect(const IntRect& visibleRect) const
+{
+    IntRect result = visibleRect;
+    float trajectoryVectorNorm = sqrt(pow(m_visibleRectTrajectoryVector.x(), 2) + pow(m_visibleRectTrajectoryVector.y(), 2));
+    if (trajectoryVectorNorm > 0) {
+        // Multiply the vector by the distance to the edge of the cover area.
+        float trajectoryVectorMultiplier = (m_coverAreaMultiplier - 1) / 2;
+        // Unite the visible rect with a "ghost" of the visible rect moved in the direction of the trajectory vector.
+        result.move(result.width() * m_visibleRectTrajectoryVector.x() / trajectoryVectorNorm * trajectoryVectorMultiplier,
+                    result.height() * m_visibleRectTrajectoryVector.y() / trajectoryVectorNorm * trajectoryVectorMultiplier);
+        result.unite(visibleRect);
+    } else {
+        result.inflateX(visibleRect.width() * (m_coverAreaMultiplier - 1) / 2);
+        result.inflateY(visibleRect.height() * (m_coverAreaMultiplier - 1) / 2);
+    }
+    result.intersect(contentsRect());
+
+    return result;
+}
+
 bool TiledBackingStore::resizeEdgeTiles()
 {
     IntRect contentsRect = this->contentsRect();

Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.h (94684 => 94685)


--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -22,7 +22,7 @@
 
 #if ENABLE(TILED_BACKING_STORE)
 
-#include "FloatSize.h"
+#include "FloatPoint.h"
 #include "IntPoint.h"
 #include "IntRect.h"
 #include "Tile.h"
@@ -64,12 +64,13 @@
     void setTileCreationDelay(double delay);
     
     // Tiled are dropped outside the keep area, and created for cover area. The values a relative to the viewport size.
-    void getKeepAndCoverAreaMultipliers(FloatSize& keepMultiplier, FloatSize& coverMultiplier)
+    void getKeepAndCoverAreaMultipliers(float& keepMultiplier, float& coverMultiplier)
     {
         keepMultiplier = m_keepAreaMultiplier;
         coverMultiplier = m_coverAreaMultiplier;
     }
-    void setKeepAndCoverAreaMultipliers(const FloatSize& keepMultiplier, const FloatSize& coverMultiplier);    
+    void setKeepAndCoverAreaMultipliers(float keepMultiplier, float coverMultiplier);
+    void setVisibleRectTrajectoryVector(const FloatPoint&);
 
     IntRect mapToContents(const IntRect&) const;
     IntRect mapFromContents(const IntRect&) const;
@@ -89,6 +90,8 @@
     void tileCreationTimerFired(TileTimer*);
     
     void createTiles();
+    IntRect computeKeepRect(const IntRect& visibleRect) const;
+    IntRect computeCoverRect(const IntRect& visibleRect) const;
     
     void commitScaleChange();
 
@@ -115,8 +118,9 @@
 
     IntSize m_tileSize;
     double m_tileCreationDelay;
-    FloatSize m_keepAreaMultiplier;
-    FloatSize m_coverAreaMultiplier;
+    float m_keepAreaMultiplier;
+    float m_coverAreaMultiplier;
+    FloatPoint m_visibleRectTrajectoryVector;
     
     IntRect m_previousVisibleRect;
     float m_contentsScale;

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (94684 => 94685)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2011-09-07 17:35:21 UTC (rev 94685)
@@ -1218,21 +1218,23 @@
         WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame());
         if (!frame->tiledBackingStore())
             return;
-        FloatSize keepMultiplier;
-        FloatSize coverMultiplier;
+        float keepMultiplier;
+        float coverMultiplier;
         frame->tiledBackingStore()->getKeepAndCoverAreaMultipliers(keepMultiplier, coverMultiplier);
         QSizeF qSize = q->property("_q_TiledBackingStoreKeepAreaMultiplier").toSizeF();
-        keepMultiplier = FloatSize(qSize.width(), qSize.height());
+        // setKeepAndCoverAreaMultipliers do not use FloatSize anymore, keep only the height part.
+        keepMultiplier = qSize.height();
         frame->tiledBackingStore()->setKeepAndCoverAreaMultipliers(keepMultiplier, coverMultiplier);
     } else if (event->propertyName() == "_q_TiledBackingStoreCoverAreaMultiplier") {
         WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame());
         if (!frame->tiledBackingStore())
             return;
-        FloatSize keepMultiplier;
-        FloatSize coverMultiplier;
+        float keepMultiplier;
+        float coverMultiplier;
         frame->tiledBackingStore()->getKeepAndCoverAreaMultipliers(keepMultiplier, coverMultiplier);
         QSizeF qSize = q->property("_q_TiledBackingStoreCoverAreaMultiplier").toSizeF();
-        coverMultiplier = FloatSize(qSize.width(), qSize.height());
+        // setKeepAndCoverAreaMultipliers do not use FloatSize anymore, keep only the height part.
+        coverMultiplier = qSize.height();
         frame->tiledBackingStore()->setKeepAndCoverAreaMultipliers(keepMultiplier, coverMultiplier);
     }
 #endif

Modified: trunk/Source/WebKit/qt/ChangeLog (94684 => 94685)


--- trunk/Source/WebKit/qt/ChangeLog	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-09-07 17:35:21 UTC (rev 94685)
@@ -1,3 +1,18 @@
+2011-09-05  Jocelyn Turcotte  <[email protected]>
+
+        [Qt][WK2] Make TiledDrawingArea request tiles only in the direction the viewport is panned to.
+        https://bugs.webkit.org/show_bug.cgi?id=67606
+
+        TiledBackingStore previously used different values for horizontal and vertial multiplication
+        to calculate the cover area. 
+        This patch replaces this mechanism, used to give a bigger panning range to vertical panning,
+        with the possibility to use the motion vector of the viewport to request tiles ahead instead.
+        This allows economies on rendering resources as tiles won't be rendered beside the trajectory
+        of the viewport.
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::dynamicPropertyChangeEvent):
+
 2011-09-06  Csaba Osztrogonác  <[email protected]>
 
         Unreviewed buildfix after r94620.

Modified: trunk/Source/WebKit2/ChangeLog (94684 => 94685)


--- trunk/Source/WebKit2/ChangeLog	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-07 17:35:21 UTC (rev 94685)
@@ -1,3 +1,38 @@
+2011-09-05  Jocelyn Turcotte  <[email protected]>
+
+        [Qt][WK2] Make TiledDrawingArea request tiles only in the direction the viewport is panned to.
+        https://bugs.webkit.org/show_bug.cgi?id=67606
+
+        TiledBackingStore previously used different values for horizontal and vertial multiplication
+        to calculate the cover area. 
+        This patch replaces this mechanism, used to give a bigger panning range to vertical panning,
+        with the possibility to use the motion vector of the viewport to request tiles ahead instead.
+        This allows economies on rendering resources as tiles won't be rendered beside the trajectory
+        of the viewport.
+
+        * UIProcess/API/qt/qtouchwebview.cpp:
+        (QTouchWebViewPrivate::QTouchWebViewPrivate):
+        (QTouchWebViewPrivate::_q_viewportMotionVectorChanged):
+        * UIProcess/API/qt/qtouchwebview.h:
+        * UIProcess/API/qt/qtouchwebview_p.h:
+        * UIProcess/TiledDrawingAreaProxy.cpp:
+        (WebKit::TiledDrawingAreaProxy::setVisibleContentRectMotionVector):
+        * UIProcess/TiledDrawingAreaProxy.h:
+        * UIProcess/qt/ViewportInteractionEngine.cpp:
+        (WebKit::ViewportInteractionEngine::panGestureRequestUpdate):
+        (WebKit::ViewportInteractionEngine::panGestureEnded):
+        (WebKit::ViewportInteractionEngine::pinchGestureStarted):
+        * UIProcess/qt/ViewportInteractionEngine.h:
+        * UIProcess/qt/qtouchwebpageproxy.cpp:
+        (QTouchWebPageProxy::setVisibleContentRectMotionVector):
+        * UIProcess/qt/qtouchwebpageproxy.h:
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::setVisibleContentRectMotionVector):
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/TiledDrawingArea.cpp:
+        (WebKit::TiledDrawingArea::setVisibleContentRectMotionVector):
+        * WebProcess/WebPage/TiledDrawingArea.h:
+
 2011-09-01  Jocelyn Turcotte  <[email protected]>
 
         [Qt] TiledBackingStore: Import the resizeEdgeTiles logic from TiledDrawindAreaProxy.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp	2011-09-07 17:35:21 UTC (rev 94685)
@@ -40,6 +40,7 @@
     pageViewPrivate->setPage(&page);
 
     QObject::connect(&interactionEngine, SIGNAL(viewportUpdateRequested()), q, SLOT(_q_viewportUpdated()));
+    QObject::connect(&interactionEngine, SIGNAL(viewportTrajectoryVectorChanged(const QPointF&)), q, SLOT(_q_viewportTrajectoryVectorChanged(const QPointF&)));
 }
 
 void QTouchWebViewPrivate::loadDidCommit()
@@ -54,6 +55,11 @@
     page.setVisibleContentRectAndScale(visibleRectInPageViewCoordinate, scale);
 }
 
+void QTouchWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& trajectoryVector)
+{
+    page.setVisibleContentRectTrajectoryVector(trajectoryVector);
+}
+
 void QTouchWebViewPrivate::updateViewportConstraints()
 {
     QSize availableSize = q->boundingRect().size().toSize();

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -48,6 +48,7 @@
 
 private:
     Q_PRIVATE_SLOT(d, void _q_viewportUpdated());
+    Q_PRIVATE_SLOT(d, void _q_viewportTrajectoryVectorChanged(const QPointF&));
 
     friend class WebKit::TouchViewInterface;
     QTouchWebViewPrivate *d;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -36,6 +36,7 @@
 
     void loadDidCommit();
     void _q_viewportUpdated();
+    void _q_viewportTrajectoryVectorChanged(const QPointF&);
     void updateViewportConstraints();
 
     void setViewportArguments(const WebCore::ViewportArguments& args);

Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp	2011-09-07 17:35:21 UTC (rev 94685)
@@ -61,6 +61,11 @@
     page()->process()->send(Messages::DrawingArea::SetVisibleContentRectAndScale(visibleContentRect, scale), page()->pageID());
 }
 
+void TiledDrawingAreaProxy::setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint& trajectoryVector)
+{
+    page()->process()->send(Messages::DrawingArea::SetVisibleContentRectTrajectoryVector(trajectoryVector), page()->pageID());
+}
+
 void TiledDrawingAreaProxy::renderNextFrame()
 {
     page()->process()->send(Messages::DrawingArea::RenderNextFrame(), page()->pageID());

Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -72,6 +72,7 @@
     virtual ~TiledDrawingAreaProxy();
 
     void setVisibleContentRectAndScale(const WebCore::IntRect&, float);
+    void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
     void renderNextFrame();
 
 #if USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.cpp (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.cpp	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.cpp	2011-09-07 17:35:21 UTC (rev 94685)
@@ -139,6 +139,8 @@
     QPointF destInViewportCoords = m_viewport->mapFromItem(m_content, itemPositionInItemCoords + QPointF(deltaX, deltaY));
 
     m_content->setPos(destInViewportCoords);
+    // This must be emitted before viewportUpdateRequested so that the web process knows where to look for tiles.
+    emit viewportTrajectoryVectorChanged(QPointF(-deltaX, -deltaY));
 }
 
 void ViewportInteractionEngine::panGestureCancelled()
@@ -152,6 +154,7 @@
 {
     ViewportUpdateGuard guard(this);
     animateContentIntoBoundariesIfNeeded();
+    // FIXME: emit viewportTrajectoryVectorChanged(QPointF()) when the pan throw animation ends and the page stops moving.
 }
 
 void ViewportInteractionEngine::pinchGestureStarted()
@@ -164,6 +167,9 @@
     m_userInteractionFlags |= UserHasScaledContent;
     m_userInteractionFlags |= UserHasMovedContent;
     m_pinchStartScale = m_content->scale();
+
+    // Reset the tiling look-ahead vector so that tiles all around the viewport will be requested on pinch-end.
+    emit viewportTrajectoryVectorChanged(QPointF());
 }
 
 void ViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinchCenterInContentCoordinate, qreal totalScaleFactor)

Modified: trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.h (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -69,6 +69,7 @@
 
 Q_SIGNALS:
     void viewportUpdateRequested();
+    void viewportTrajectoryVectorChanged(const QPointF&);
 
 private Q_SLOTS:
     // Respond to changes of content that are not driven by us, like the page resizing itself.

Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp	2011-09-07 17:35:21 UTC (rev 94685)
@@ -86,6 +86,11 @@
     m_webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect);
 }
 
+void QTouchWebPageProxy::setVisibleContentRectTrajectoryVector(const QPointF& trajectoryVector)
+{
+    drawingArea()->setVisibleContentRectTrajectoryVector(trajectoryVector);
+}
+
 void QTouchWebPageProxy::setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize)
 {
     m_webPageProxy->setResizesToContentsUsingLayoutSize(targetLayoutSize);

Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h (94684 => 94685)


--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -44,6 +44,7 @@
     virtual bool handleEvent(QEvent*);
 
     void setVisibleContentRectAndScale(const QRectF&, float);
+    void setVisibleContentRectTrajectoryVector(const QPointF&);
     void setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize);
     void findZoomableAreaForPoint(const QPoint&);
     void renderNextFrame();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (94684 => 94685)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -27,6 +27,7 @@
 #define DrawingArea_h
 
 #include "DrawingAreaInfo.h"
+#include <WebCore/FloatPoint.h>
 #include <WebCore/IntRect.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/PassOwnPtr.h>
@@ -100,6 +101,7 @@
 #if ENABLE(TILED_BACKING_STORE)
     virtual void setSize(const WebCore::IntSize& viewSize) { }
     virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float) { }
+    virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&) { }
     virtual void setContentsScale(float scale) { }
     virtual void renderNextFrame() { }
     virtual void takeSnapshot(const WebCore::IntSize& targetSize, const WebCore::IntRect& contentsRect) { }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (94684 => 94685)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-09-07 17:35:21 UTC (rev 94685)
@@ -29,6 +29,7 @@
 #if ENABLE(TILED_BACKING_STORE)
     SetSize(WebCore::IntSize viewSize)
     SetVisibleContentRectAndScale(WebCore::IntRect visibleContentRect, float scale)
+    SetVisibleContentRectTrajectoryVector(WebCore::FloatPoint trajectoryVector)
     RenderNextFrame()
     TakeSnapshot(WebCore::IntSize size, WebCore::IntRect contentsRect)
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp (94684 => 94685)


--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp	2011-09-07 17:35:21 UTC (rev 94685)
@@ -89,6 +89,11 @@
         m_mainBackingStore->adjustVisibleRect();
 }
 
+void TiledDrawingArea::setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint& trajectoryVector)
+{
+    m_mainBackingStore->setVisibleRectTrajectoryVector(trajectoryVector);
+}
+
 void TiledDrawingArea::renderNextFrame()
 {
     m_isWaitingForUIProcess = false;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h (94684 => 94685)


--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h	2011-09-07 17:34:28 UTC (rev 94684)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h	2011-09-07 17:35:21 UTC (rev 94685)
@@ -55,6 +55,7 @@
     // CoreIPC message handlers.
     virtual void setSize(const WebCore::IntSize& viewSize);
     virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float);
+    virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&);
     virtual void renderNextFrame();
     virtual void suspendPainting();
     virtual void resumePainting();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to