Title: [91180] trunk/Source/WebKit2
Revision
91180
Author
[email protected]
Date
2011-07-18 06:43:12 -0700 (Mon, 18 Jul 2011)

Log Message

TiledDrawingArea: map the visibleArea rect from page to tiles coordinates.
https://bugs.webkit.org/show_bug.cgi?id=64538

Reviewed by Benjamin Poulain.

TiledDrawingAreaProxy expects its coordinates to be scaled according to
contentsScale. This patch keep the pushed visibleArea as page coordinates
and convert it each time to scaled coordinates in case the contents scale was
changed afterward.
This is a regression introduced in r90750.
Also:
- Rename visibleArea to visibleContentRect
- Remove an unnecessary mapToContents in QTouchWebPageProxy::setVisibleContentRect

* UIProcess/API/qt/qtouchwebpage.cpp:
(QTouchWebPagePrivate::setViewportRect):
* UIProcess/TiledDrawingAreaProxy.cpp:
(WebKit::TiledDrawingAreaProxy::invalidate):
(WebKit::TiledDrawingAreaProxy::setVisibleContentRect):
(WebKit::TiledDrawingAreaProxy::createTiles):
(WebKit::TiledDrawingAreaProxy::visibleRect):
* UIProcess/TiledDrawingAreaProxy.h:
* UIProcess/qt/qtouchwebpageproxy.cpp:
(QTouchWebPageProxy::setVisibleContentRect):
* UIProcess/qt/qtouchwebpageproxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (91179 => 91180)


--- trunk/Source/WebKit2/ChangeLog	2011-07-18 13:18:08 UTC (rev 91179)
+++ trunk/Source/WebKit2/ChangeLog	2011-07-18 13:43:12 UTC (rev 91180)
@@ -1,3 +1,31 @@
+2011-07-15  Jocelyn Turcotte  <[email protected]>
+
+        TiledDrawingArea: map the visibleArea rect from page to tiles coordinates.
+        https://bugs.webkit.org/show_bug.cgi?id=64538
+
+        Reviewed by Benjamin Poulain.
+
+        TiledDrawingAreaProxy expects its coordinates to be scaled according to
+        contentsScale. This patch keep the pushed visibleArea as page coordinates
+        and convert it each time to scaled coordinates in case the contents scale was
+        changed afterward.
+        This is a regression introduced in r90750.
+        Also:
+        - Rename visibleArea to visibleContentRect
+        - Remove an unnecessary mapToContents in QTouchWebPageProxy::setVisibleContentRect
+
+        * UIProcess/API/qt/qtouchwebpage.cpp:
+        (QTouchWebPagePrivate::setViewportRect):
+        * UIProcess/TiledDrawingAreaProxy.cpp:
+        (WebKit::TiledDrawingAreaProxy::invalidate):
+        (WebKit::TiledDrawingAreaProxy::setVisibleContentRect):
+        (WebKit::TiledDrawingAreaProxy::createTiles):
+        (WebKit::TiledDrawingAreaProxy::visibleRect):
+        * UIProcess/TiledDrawingAreaProxy.h:
+        * UIProcess/qt/qtouchwebpageproxy.cpp:
+        (QTouchWebPageProxy::setVisibleContentRect):
+        * UIProcess/qt/qtouchwebpageproxy.h:
+
 2011-07-17  Amruth Raj  <[email protected]>
 
         [GTK] Fix selection of elements in a multi select list and remove an unnecessary include in WorkQueue

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp (91179 => 91180)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp	2011-07-18 13:18:08 UTC (rev 91179)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp	2011-07-18 13:43:12 UTC (rev 91180)
@@ -141,8 +141,8 @@
 
 void QTouchWebPagePrivate::setViewportRect(const QRectF& viewportRect)
 {
-    const QRectF visibleArea = q->boundingRect().intersected(viewportRect);
-    page->setVisibleArea(visibleArea);
+    const QRectF visibleContentRect = q->boundingRect().intersected(viewportRect);
+    page->setVisibleContentRect(visibleContentRect);
 }
 
 #include "moc_qtouchwebpage.cpp"

Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp (91179 => 91180)


--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp	2011-07-18 13:18:08 UTC (rev 91179)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp	2011-07-18 13:43:12 UTC (rev 91180)
@@ -181,7 +181,7 @@
     TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location());
     TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(innerBottomRight(dirtyRect));
 
-    IntRect coverRect = calculateCoverRect(m_visibleArea);
+    IntRect coverRect = calculateCoverRect(visibleRect());
 
     Vector<TiledDrawingAreaTile::Coordinate> tilesToRemove;
 
@@ -290,10 +290,10 @@
     return true;
 }
 
-void TiledDrawingAreaProxy::setVisibleArea(const WebCore::IntRect& visibleArea)
+void TiledDrawingAreaProxy::setVisibleContentRect(const WebCore::IntRect& visibleContentRect)
 {
-    if (m_visibleArea != visibleArea) {
-        m_visibleArea = visibleArea;
+    if (m_visibleContentRect != visibleContentRect) {
+        m_visibleContentRect = visibleContentRect;
         startTileCreationTimer();
     }
 }
@@ -351,14 +351,15 @@
 
 void TiledDrawingAreaProxy::createTiles()
 {
-    if (m_visibleArea.isEmpty())
+    IntRect visibleRect = this->visibleRect();
+    if (visibleRect.isEmpty())
         return;
 
     // Resize tiles on edges in case the contents size has changed.
     bool didResizeTiles = resizeEdgeTiles();
 
     // Remove tiles outside out current maximum keep rect.
-    dropTilesOutsideRect(calculateKeepRect(m_visibleArea));
+    dropTilesOutsideRect(calculateKeepRect(visibleRect));
 
     // 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.
@@ -366,13 +367,13 @@
     Vector<TiledDrawingAreaTile::Coordinate> tilesToCreate;
     unsigned requiredTileCount = 0;
     bool hasVisibleCheckers = false;
-    TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(m_visibleArea.location());
-    TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(innerBottomRight(m_visibleArea));
+    TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(visibleRect.location());
+    TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(innerBottomRight(visibleRect));
     for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
         for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
             TiledDrawingAreaTile::Coordinate currentCoordinate(xCoordinate, yCoordinate);
             // Distance is 0 for all currently visible tiles.
-            double distance = tileDistance(m_visibleArea, currentCoordinate);
+            double distance = tileDistance(visibleRect, currentCoordinate);
 
             RefPtr<TiledDrawingAreaTile> tile = tileAt(currentCoordinate);
             if (!distance && (!tile || !tile->isReadyToPaint()))
@@ -496,6 +497,11 @@
     return mapFromContents(IntRect(IntPoint(0, 0), m_viewSize));
 }
 
+IntRect TiledDrawingAreaProxy::visibleRect() const
+{
+    return mapFromContents(m_visibleContentRect);
+}
+
 IntRect TiledDrawingAreaProxy::tileRectForCoordinate(const TiledDrawingAreaTile::Coordinate& coordinate) const
 {
     IntRect rect(coordinate.x() * m_tileSize.width(),

Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h (91179 => 91180)


--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h	2011-07-18 13:18:08 UTC (rev 91179)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h	2011-07-18 13:43:12 UTC (rev 91180)
@@ -67,7 +67,7 @@
     TiledDrawingAreaProxy(PlatformWebView*, WebPageProxy*);
     virtual ~TiledDrawingAreaProxy();
 
-    void setVisibleArea(const WebCore::IntRect& visibleRect);
+    void setVisibleContentRect(const WebCore::IntRect&);
     float contentsScale() const { return m_contentsScale; }
     void setContentsScale(float);
 
@@ -135,6 +135,7 @@
     void removeAllTiles();
 
     WebCore::IntRect contentsRect() const;
+    WebCore::IntRect visibleRect() const;
 
     WebCore::IntRect calculateKeepRect(const WebCore::IntRect& visibleRect) const;
     WebCore::IntRect calculateCoverRect(const WebCore::IntRect& visibleRect) const;
@@ -166,7 +167,7 @@
     WebCore::FloatSize m_keepAreaMultiplier;
     WebCore::FloatSize m_coverAreaMultiplier;
 
-    WebCore::IntRect m_visibleArea;
+    WebCore::IntRect m_visibleContentRect;
     float m_contentsScale;
 
     friend class TiledDrawingAreaTile;

Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp (91179 => 91180)


--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp	2011-07-18 13:18:08 UTC (rev 91179)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp	2011-07-18 13:43:12 UTC (rev 91180)
@@ -85,15 +85,14 @@
     return QtWebPageProxy::handleEvent(ev);
 }
 
-void QTouchWebPageProxy::setVisibleArea(const QRectF& visibleArea)
+void QTouchWebPageProxy::setVisibleContentRect(const QRectF& visibleContentRect)
 {
     TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(m_webPageProxy->drawingArea());
-    QRect alignedVisibleArea = visibleArea.toAlignedRect();
-    tiledDrawingArea->setVisibleArea(alignedVisibleArea);
+    QRect alignedVisibleContentRect = visibleContentRect.toAlignedRect();
+    tiledDrawingArea->setVisibleContentRect(alignedVisibleContentRect);
 
     // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended.
-    IntRect contentVisibleArea = tiledDrawingArea->mapToContents(alignedVisibleArea);
-    m_webPageProxy->setFixedVisibleContentRect(contentVisibleArea);
+    m_webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect);
 }
 
 void QTouchWebPageProxy::setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize)

Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h (91179 => 91180)


--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h	2011-07-18 13:18:08 UTC (rev 91179)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h	2011-07-18 13:43:12 UTC (rev 91180)
@@ -39,7 +39,7 @@
 
     virtual bool handleEvent(QEvent*);
 
-    void setVisibleArea(const QRectF&);
+    void setVisibleContentRect(const QRectF&);
     void setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize);
     void findZoomableAreaForPoint(const QPoint&);
     void setContentsScale(qreal);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to