+2012-01-03 Adrienne Walker <enne@google.com>
+
+ [chromium] Remove unneeded content vs. layer space distinction in tiled layers
+ https://bugs.webkit.org/show_bug.cgi?id=75498
+
+ Reviewed by James Robinson.
+
+ Long ago, before scrollbars became their own layers, tiled layers had
+ a distinction between content space (what's mostly called layer space
+ elsewhere) and layer space (the transformed content space). It seemed
+ like this transform could get reused for supporting RTL pages, but as
+ that's not the case, it should be eradicated.
+
+ Tiled layers now deal with everything in "layer space", which is a 2d
+ rectangle starting at (0, 0) in the top left of the layer and
+ extending to contentBounds() in the bottom right.
+
+ As no code actually set the tiler position, this change should be a
+ no-op.
+
+ Test: LayoutTests/compositing/
+
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::UpdatableTile::isDirty):
+ (WebCore::UpdatableTile::clearDirty):
+ (WebCore::TiledLayerChromium::updateCompositorResources):
+ (WebCore::TiledLayerChromium::createTile):
+ (WebCore::TiledLayerChromium::invalidateRect):
+ (WebCore::TiledLayerChromium::protectTileTextures):
+ (WebCore::TiledLayerChromium::prepareToUpdateTiles):
+ (WebCore::TiledLayerChromium::prepareToUpdate):
+ (WebCore::TiledLayerChromium::prepareToUpdateIdle):
+ (WebCore::TiledLayerChromium::needsIdlePaint):
+ (WebCore::TiledLayerChromium::idlePaintRect):
+ * platform/graphics/chromium/TiledLayerChromium.h:
+ * platform/graphics/chromium/cc/CCLayerTilingData.cpp:
+ (WebCore::CCLayerTilingData::operator=):
+ (WebCore::CCLayerTilingData::layerRectToTileIndices):
+ (WebCore::CCLayerTilingData::tileRect):
+ * platform/graphics/chromium/cc/CCLayerTilingData.h:
+ * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
+ (WebCore::CCTiledLayerImpl::appendQuads):
+
2011-12-22 Joseph Pecoraro <pecoraro@apple.com>
Implement Date and Time Input Value Sanitization
LayerTextureUpdater::Texture* texture() { return m_texture.get(); }
ManagedTexture* managedTexture() { return m_texture->texture(); }
- bool isDirty() const { return !m_dirtyLayerRect.isEmpty(); }
- void clearDirty() { m_dirtyLayerRect = IntRect(); }
+ bool isDirty() const { return !m_dirtyRect.isEmpty(); }
+ void clearDirty() { m_dirtyRect = IntRect(); }
- // Layer-space dirty rectangle that needs to be repainted.
- IntRect m_dirtyLayerRect;
- // Content-space rectangle that needs to be updated.
+ IntRect m_dirtyRect;
IntRect m_updateRect;
private:
OwnPtr<LayerTextureUpdater::Texture> m_texture;
continue;
ASSERT(tile->managedTexture()->isReserved());
- const IntPoint anchor = m_tiler->tileContentRect(tile).location();
+ const IntPoint anchor = m_tiler->tileRect(tile).location();
// Calculate tile-space rectangle to upload into.
IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size());
}
}
- m_updateRect = FloatRect(m_tiler->contentRectToLayerRect(m_paintRect));
+ m_updateRect = FloatRect(m_paintRect);
}
void TiledLayerChromium::setTilingOption(TilingOption tilingOption)
{
RefPtr<UpdatableTile> tile = adoptRef(new UpdatableTile(textureUpdater()->createTexture(textureManager())));
m_tiler->addTile(tile, i, j);
- tile->m_dirtyLayerRect = m_tiler->tileLayerRect(tile.get());
+ tile->m_dirtyRect = m_tiler->tileRect(tile.get());
return tile.get();
}
setBorderTexelOption(borderTexelOption);
}
-void TiledLayerChromium::invalidateRect(const IntRect& contentRect)
+void TiledLayerChromium::invalidateRect(const IntRect& layerRect)
{
- if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw)
+ if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw)
return;
- // Dirty rects are always in layer space, as the layer could be repositioned
- // after invalidation.
- const IntRect layerRect = m_tiler->contentRectToLayerRect(contentRect);
-
int left, top, right, bottom;
- m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
+ m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
UpdatableTile* tile = tileAt(i, j);
if (!tile)
continue;
- IntRect bound = m_tiler->tileLayerRect(tile);
+ IntRect bound = m_tiler->tileRect(tile);
bound.intersect(layerRect);
- tile->m_dirtyLayerRect.unite(bound);
+ tile->m_dirtyRect.unite(bound);
}
}
}
protectTileTextures(IntRect(IntPoint::zero(), contentBounds()));
}
-void TiledLayerChromium::protectTileTextures(const IntRect& contentRect)
+void TiledLayerChromium::protectTileTextures(const IntRect& layerRect)
{
- if (m_tiler->isEmpty() || contentRect.isEmpty())
+ if (m_tiler->isEmpty() || layerRect.isEmpty())
return;
int left, top, right, bottom;
- m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
+ m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
tile = createTile(i, j);
if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat))
- tile->m_dirtyLayerRect = m_tiler->tileLayerRect(tile);
+ tile->m_dirtyRect = m_tiler->tileRect(tile);
if (!tile->managedTexture()->reserve(m_tiler->tileSize(), m_textureFormat)) {
m_skipsIdlePaint = true;
return;
}
- dirtyLayerRect.unite(tile->m_dirtyLayerRect);
+ dirtyLayerRect.unite(tile->m_dirtyRect);
}
}
- m_paintRect = m_tiler->layerRectToContentRect(dirtyLayerRect);
+ m_paintRect = dirtyLayerRect;
if (dirtyLayerRect.isEmpty())
return;
if (!tile->isDirty())
continue;
- // Calculate content-space rectangle to copy from.
- IntRect sourceRect = m_tiler->tileContentRect(tile);
- sourceRect.intersect(m_tiler->layerRectToContentRect(tile->m_dirtyLayerRect));
+ IntRect sourceRect = m_tiler->tileRect(tile);
+ sourceRect.intersect(tile->m_dirtyRect);
// Paint rect not guaranteed to line up on tile boundaries, so
// make sure that sourceRect doesn't extend outside of it.
sourceRect.intersect(m_paintRect);
}
-void TiledLayerChromium::prepareToUpdate(const IntRect& contentRect)
+void TiledLayerChromium::prepareToUpdate(const IntRect& layerRect)
{
m_skipsDraw = false;
m_skipsIdlePaint = false;
updateBounds();
- if (contentRect.isEmpty() || !m_tiler->numTiles())
+ if (layerRect.isEmpty() || !m_tiler->numTiles())
return;
int left, top, right, bottom;
- m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
+ m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
prepareToUpdateTiles(false, left, top, right, bottom);
}
-void TiledLayerChromium::prepareToUpdateIdle(const IntRect& contentRect)
+void TiledLayerChromium::prepareToUpdateIdle(const IntRect& layerRect)
{
// Abort if we have already prepared a paint or run out of memory.
if (m_skipsIdlePaint || !m_paintRect.isEmpty())
// Protect any textures in the pre-paint area so we don't end up just
// reclaiming them below.
- IntRect idlePaintContentRect = idlePaintRect(contentRect);
- protectTileTextures(idlePaintContentRect);
+ IntRect idlePaintLayerRect = idlePaintRect(layerRect);
+ protectTileTextures(idlePaintLayerRect);
// Expand outwards until we find a dirty row or column to update.
int left, top, right, bottom;
- m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
+ m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
int prepaintLeft, prepaintTop, prepaintRight, prepaintBottom;
- m_tiler->contentRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom);
+ m_tiler->layerRectToTileIndices(idlePaintLayerRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom);
while (!m_skipsIdlePaint && (left > prepaintLeft || top > prepaintTop || right < prepaintRight || bottom < prepaintBottom)) {
if (bottom < prepaintBottom) {
++bottom;
}
}
-bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect)
+bool TiledLayerChromium::needsIdlePaint(const IntRect& layerRect)
{
if (m_skipsIdlePaint)
return false;
- IntRect idlePaintContentRect = idlePaintRect(contentRect);
+ IntRect idlePaintLayerRect = idlePaintRect(layerRect);
int left, top, right, bottom;
- m_tiler->contentRectToTileIndices(idlePaintContentRect, left, top, right, bottom);
+ m_tiler->layerRectToTileIndices(idlePaintLayerRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
if (m_requestedUpdateTilesRect.contains(IntPoint(i, j)))
return false;
}
-IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleContentRect)
+IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleLayerRect)
{
- IntRect prepaintRect = visibleContentRect;
+ IntRect prepaintRect = visibleLayerRect;
// FIXME: This can be made a lot larger if we can:
// - reserve memory at a lower priority than for visible content
// - only reserve idle paint tiles up to a memory reclaim threshold and
const CCLayerTilingData& CCLayerTilingData::operator=(const CCLayerTilingData& tiler)
{
m_tileSize = tiler.m_tileSize;
- m_layerPosition = tiler.m_layerPosition;
m_tilingData = tiler.m_tilingData;
return *this;
m_tilingData.setTotalSize(0, 0);
}
-void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const
+void CCLayerTilingData::layerRectToTileIndices(const IntRect& layerRect, int& left, int& top, int& right, int& bottom) const
{
- const IntRect layerRect = contentRectToLayerRect(contentRect);
-
left = m_tilingData.tileXIndexFromSrcCoord(layerRect.x());
top = m_tilingData.tileYIndexFromSrcCoord(layerRect.y());
right = m_tilingData.tileXIndexFromSrcCoord(layerRect.maxX() - 1);
bottom = m_tilingData.tileYIndexFromSrcCoord(layerRect.maxY() - 1);
}
-IntRect CCLayerTilingData::contentRectToLayerRect(const IntRect& contentRect) const
-{
- IntPoint pos(contentRect.x() - m_layerPosition.x(), contentRect.y() - m_layerPosition.y());
- IntRect layerRect(pos, contentRect.size());
-
- // Clip to the position.
- if (pos.x() < 0 || pos.y() < 0)
- layerRect = IntRect(IntPoint(0, 0), IntSize(contentRect.width() + pos.x(), contentRect.height() + pos.y()));
- return layerRect;
-}
-
-IntRect CCLayerTilingData::layerRectToContentRect(const IntRect& layerRect) const
-{
- IntRect contentRect = layerRect;
- contentRect.move(m_layerPosition.x(), m_layerPosition.y());
- return contentRect;
-}
-
-IntRect CCLayerTilingData::tileContentRect(const Tile* tile) const
-{
- IntRect contentRect = tileLayerRect(tile);
- contentRect.move(m_layerPosition.x(), m_layerPosition.y());
- return contentRect;
-}
-
-IntRect CCLayerTilingData::tileLayerRect(const Tile* tile) const
+IntRect CCLayerTilingData::tileRect(const Tile* tile) const
{
const int index = m_tilingData.tileIndex(tile->i(), tile->j());
- IntRect layerRect = m_tilingData.tileBoundsWithBorder(index);
- layerRect.setSize(m_tileSize);
- return layerRect;
-}
-
-void CCLayerTilingData::setLayerPosition(const IntPoint& layerPosition)
-{
- m_layerPosition = layerPosition;
+ IntRect tileRect = m_tilingData.tileBoundsWithBorder(index);
+ tileRect.setSize(m_tileSize);
+ return tileRect;
}
void CCLayerTilingData::setBounds(const IntSize& size)