- Revision
- 94681
- Author
- [email protected]
- Date
- 2011-09-07 10:19:36 -0700 (Wed, 07 Sep 2011)
Log Message
[Qt] TiledBackingStore: Import the resizeEdgeTiles logic from TiledDrawindAreaProxy.
https://bugs.webkit.org/show_bug.cgi?id=67416
Reviewed by Kenneth Rohde Christiansen.
Original code by Antti Koivisto.
With the current code, when the page is layouted during load, edge tiles will
get removed instead of continuing to show their front buffer while the tile
is being rendered for the new size.
Source/WebCore:
* platform/graphics/Tile.h:
* platform/graphics/TiledBackingStore.cpp:
(WebCore::TiledBackingStore::createTiles):
(WebCore::TiledBackingStore::resizeEdgeTiles):
* platform/graphics/TiledBackingStore.h:
* platform/graphics/qt/TileQt.cpp:
(WebCore::TileQt::resize):
* platform/graphics/qt/TileQt.h:
Source/WebKit2:
* WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp:
(WebKit::TiledBackingStoreRemoteTile::updateBackBuffer):
(WebKit::TiledBackingStoreRemoteTile::resize):
* WebProcess/WebPage/TiledBackingStoreRemoteTile.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (94680 => 94681)
--- trunk/Source/WebCore/ChangeLog 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebCore/ChangeLog 2011-09-07 17:19:36 UTC (rev 94681)
@@ -1,3 +1,24 @@
+2011-09-01 Jocelyn Turcotte <[email protected]>
+
+ [Qt] TiledBackingStore: Import the resizeEdgeTiles logic from TiledDrawindAreaProxy.
+ https://bugs.webkit.org/show_bug.cgi?id=67416
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Original code by Antti Koivisto.
+ With the current code, when the page is layouted during load, edge tiles will
+ get removed instead of continuing to show their front buffer while the tile
+ is being rendered for the new size.
+
+ * platform/graphics/Tile.h:
+ * platform/graphics/TiledBackingStore.cpp:
+ (WebCore::TiledBackingStore::createTiles):
+ (WebCore::TiledBackingStore::resizeEdgeTiles):
+ * platform/graphics/TiledBackingStore.h:
+ * platform/graphics/qt/TileQt.cpp:
+ (WebCore::TileQt::resize):
+ * platform/graphics/qt/TileQt.h:
+
2011-09-07 Tim Horton <[email protected]>
Don't round-trip through TransformationMatrix in SVGImageBufferTools::clearAffineTransform2DRotation
Modified: trunk/Source/WebCore/platform/graphics/Tile.h (94680 => 94681)
--- trunk/Source/WebCore/platform/graphics/Tile.h 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebCore/platform/graphics/Tile.h 2011-09-07 17:19:36 UTC (rev 94681)
@@ -46,6 +46,7 @@
virtual const Tile::Coordinate& coordinate() const = 0;
virtual const IntRect& rect() const = 0;
+ virtual void resize(const WebCore::IntSize&) = 0;
};
}
Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp (94680 => 94681)
--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp 2011-09-07 17:19:36 UTC (rev 94681)
@@ -237,8 +237,8 @@
if (visibleRect.isEmpty())
return;
- // Remove tiles that extend outside the current contents rect.
- dropOverhangingTiles();
+ // 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
@@ -288,7 +288,7 @@
requiredTileCount -= tilesToCreateCount;
// Paint the content of the newly created tiles
- if (tilesToCreateCount)
+ if (tilesToCreateCount || didResizeTiles)
updateTileBuffers();
// Keep creating tiles until the whole coverRect is covered.
@@ -296,9 +296,10 @@
m_tileCreationTimer->startOneShot(m_tileCreationDelay);
}
-void TiledBackingStore::dropOverhangingTiles()
-{
+bool TiledBackingStore::resizeEdgeTiles()
+{
IntRect contentsRect = this->contentsRect();
+ bool wasResized = false;
Vector<Tile::Coordinate> tilesToRemove;
TileMap::iterator end = m_tiles.end();
@@ -306,12 +307,17 @@
Tile::Coordinate tileCoordinate = it->second->coordinate();
IntRect tileRect = it->second->rect();
IntRect expectedTileRect = tileRectForCoordinate(tileCoordinate);
- if (expectedTileRect != tileRect || !contentsRect.contains(tileRect))
+ if (expectedTileRect.isEmpty())
tilesToRemove.append(tileCoordinate);
+ else if (expectedTileRect != tileRect) {
+ it->second->resize(expectedTileRect.size());
+ wasResized = true;
+ }
}
unsigned removeCount = tilesToRemove.size();
for (unsigned n = 0; n < removeCount; ++n)
removeTile(tilesToRemove[n]);
+ return wasResized;
}
void TiledBackingStore::dropTilesOutsideRect(const IntRect& keepRect)
Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.h (94680 => 94681)
--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.h 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.h 2011-09-07 17:19:36 UTC (rev 94681)
@@ -92,7 +92,7 @@
void commitScaleChange();
- void dropOverhangingTiles();
+ bool resizeEdgeTiles();
void dropTilesOutsideRect(const IntRect&);
PassRefPtr<Tile> tileAt(const Tile::Coordinate&) const;
Modified: trunk/Source/WebCore/platform/graphics/qt/TileQt.cpp (94680 => 94681)
--- trunk/Source/WebCore/platform/graphics/qt/TileQt.cpp 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebCore/platform/graphics/qt/TileQt.cpp 2011-09-07 17:19:36 UTC (rev 94681)
@@ -153,6 +153,16 @@
context->platformContext()->drawPixmap(target, *m_buffer, source);
}
+void TileQt::resize(const IntSize& newSize)
+{
+ IntRect oldRect = m_rect;
+ m_rect = IntRect(m_rect.location(), newSize);
+ if (m_rect.maxX() > oldRect.maxX())
+ invalidate(IntRect(oldRect.maxX(), oldRect.y(), m_rect.maxX() - oldRect.maxX(), m_rect.height()));
+ if (m_rect.maxY() > oldRect.maxY())
+ invalidate(IntRect(oldRect.x(), oldRect.maxY(), m_rect.width(), m_rect.maxY() - oldRect.maxY()));
+}
+
void TiledBackingStoreBackend::paintCheckerPattern(GraphicsContext* context, const FloatRect& target)
{
QPainter* painter = context->platformContext();
Modified: trunk/Source/WebCore/platform/graphics/qt/TileQt.h (94680 => 94681)
--- trunk/Source/WebCore/platform/graphics/qt/TileQt.h 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebCore/platform/graphics/qt/TileQt.h 2011-09-07 17:19:36 UTC (rev 94681)
@@ -53,6 +53,7 @@
const Tile::Coordinate& coordinate() const { return m_coordinate; }
const IntRect& rect() const { return m_rect; }
+ void resize(const WebCore::IntSize&);
private:
TileQt(TiledBackingStore*, const Coordinate&);
Modified: trunk/Source/WebKit2/ChangeLog (94680 => 94681)
--- trunk/Source/WebKit2/ChangeLog 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebKit2/ChangeLog 2011-09-07 17:19:36 UTC (rev 94681)
@@ -1,5 +1,22 @@
2011-09-01 Jocelyn Turcotte <[email protected]>
+ [Qt] TiledBackingStore: Import the resizeEdgeTiles logic from TiledDrawindAreaProxy.
+ https://bugs.webkit.org/show_bug.cgi?id=67416
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Original code by Antti Koivisto.
+ With the current code, when the page is layouted during load, edge tiles will
+ get removed instead of continuing to show their front buffer while the tile
+ is being rendered for the new size.
+
+ * WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp:
+ (WebKit::TiledBackingStoreRemoteTile::updateBackBuffer):
+ (WebKit::TiledBackingStoreRemoteTile::resize):
+ * WebProcess/WebPage/TiledBackingStoreRemoteTile.h:
+
+2011-09-01 Jocelyn Turcotte <[email protected]>
+
TiledDrawingArea: Fix issues where the tiles of the previous scale would be removed too early.
https://bugs.webkit.org/show_bug.cgi?id=67390
Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp (94680 => 94681)
--- trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp 2011-09-07 17:19:36 UTC (rev 94681)
@@ -75,7 +75,7 @@
// FIXME: Only use a local buffer when we know the tile is animated (after the first invalidate)
// and destroy it after a few seconds of inactivity. We can render directly to shared
// memory in other cases.
- if (!m_localBuffer) {
+ if (!m_localBuffer || m_localBuffer->size() != m_rect.size()) {
m_localBuffer = ImageBuffer::create(m_rect.size());
m_localBuffer->context()->translate(-m_rect.x(), -m_rect.y());
m_localBuffer->context()->scale(FloatSize(m_tiledBackingStore->contentsScale(), m_tiledBackingStore->contentsScale()));
@@ -119,6 +119,12 @@
ASSERT_NOT_REACHED();
}
+void TiledBackingStoreRemoteTile::resize(const IntSize& newSize)
+{
+ m_rect = IntRect(m_rect.location(), newSize);
+ m_dirtyRect = m_rect;
+}
+
TiledBackingStoreRemoteTileBackend::TiledBackingStoreRemoteTileBackend(TiledBackingStoreRemoteTileClient* client)
: m_client(client)
{
Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.h (94680 => 94681)
--- trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.h 2011-09-07 17:17:38 UTC (rev 94680)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.h 2011-09-07 17:19:36 UTC (rev 94681)
@@ -56,6 +56,7 @@
const Coordinate& coordinate() const { return m_coordinate; }
const WebCore::IntRect& rect() const { return m_rect; }
+ void resize(const WebCore::IntSize&);
private:
TiledBackingStoreRemoteTile(TiledBackingStoreRemoteTileClient*, WebCore::TiledBackingStore*, const Coordinate&);