Commit cab34d3c authored by bdakin@apple.com's avatar bdakin@apple.com

Bad repaints on twitter when the tile cache has a margin

https://bugs.webkit.org/show_bug.cgi?id=125263
-and corresponding-
<rdar://problem/15576884>

Reviewed by Tim Horton.

When tiles that used to be margin tiles become real-content tiles, they need to be 
invalidated.

Two new helper functions will make it so that we don’t have to manually factor out 
the margin from the bounds in more than one place in the code.
* platform/graphics/ca/mac/TileController.h:
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::boundsWithoutMargin):
(WebCore::TileController::boundsAtLastRevalidateWithoutMargin):

 Here is one existing place where we used to factor out the margin, but now we can 
call boundsWithoutMargin().
(WebCore::TileController::adjustRectAtTileIndexForMargin):

And here is where we invalidate the formerly-margin tiles.
(WebCore::TileController::revalidateTiles):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c98cfd8f
2013-12-05 Beth Dakin <bdakin@apple.com>
Bad repaints on twitter when the tile cache has a margin
https://bugs.webkit.org/show_bug.cgi?id=125263
-and corresponding-
<rdar://problem/15576884>
Reviewed by Tim Horton.
When tiles that used to be margin tiles become real-content tiles, they need to be
invalidated.
Two new helper functions will make it so that we don’t have to manually factor out
the margin from the bounds in more than one place in the code.
* platform/graphics/ca/mac/TileController.h:
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::boundsWithoutMargin):
(WebCore::TileController::boundsAtLastRevalidateWithoutMargin):
Here is one existing place where we used to factor out the margin, but now we can
call boundsWithoutMargin().
(WebCore::TileController::adjustRectAtTileIndexForMargin):
And here is where we invalidate the formerly-margin tiles.
(WebCore::TileController::revalidateTiles):
2013-12-05 Zoltan Horvath <zoltan@webkit.org>
Remove the forward declaration of BidiContext class from RenderBlock.h
......@@ -148,6 +148,8 @@ private:
virtual float platformCALayerDeviceScaleFactor() const OVERRIDE;
IntRect bounds() const;
IntRect boundsWithoutMargin() const;
IntRect boundsAtLastRevalidateWithoutMargin() const;
IntRect rectForTileIndex(const TileIndex&) const;
void adjustRectAtTileIndexForMargin(const TileIndex&, IntRect&) const;
......
......@@ -403,6 +403,18 @@ IntRect TileController::bounds() const
return IntRect(boundsOriginIncludingMargin, boundsSizeIncludingMargin);
}
IntRect TileController::boundsWithoutMargin() const
{
return IntRect(IntPoint(), expandedIntSize(m_tileCacheLayer->bounds().size()));
}
IntRect TileController::boundsAtLastRevalidateWithoutMargin() const
{
IntRect boundsWithoutMargin = IntRect(IntPoint(), m_boundsAtLastRevalidate.size());
boundsWithoutMargin.contract(IntSize(leftMarginWidth() + rightMarginWidth(), topMarginHeight() + bottomMarginHeight()));
return boundsWithoutMargin;
}
void TileController::adjustRectAtTileIndexForMargin(const TileIndex& tileIndex, IntRect& rect) const
{
if (!hasMargins())
......@@ -420,10 +432,9 @@ void TileController::adjustRectAtTileIndexForMargin(const TileIndex& tileIndex,
rect.setWidth(leftMarginWidth());
}
IntRect boundsWithoutMargin = IntRect(IntPoint(), expandedIntSize(m_tileCacheLayer->bounds().size()));
TileIndex contentTopLeft;
TileIndex contentBottomRight;
getTileIndexRangeForRect(boundsWithoutMargin, contentTopLeft, contentBottomRight);
getTileIndexRangeForRect(boundsWithoutMargin(), contentTopLeft, contentBottomRight);
// This is a tile in the bottom margin.
if (m_marginBottom && tileIndex.y() > contentBottomRight.y())
......@@ -752,6 +763,27 @@ void TileController::revalidateTiles(TileValidationPolicyFlags foregroundValidat
}
if (m_boundsAtLastRevalidate != bounds) {
// If there are margin tiles and the bounds have grown taller or wider, then the tiles that used to
// be bottom or right margin tiles need to be invalidated.
if (hasMargins()) {
if (bounds.width() > m_boundsAtLastRevalidate.width() || bounds.height() > m_boundsAtLastRevalidate.height()) {
IntRect boundsWithoutMargin = this->boundsWithoutMargin();
IntRect oldBoundsWithoutMargin = boundsAtLastRevalidateWithoutMargin();
if (bounds.height() > m_boundsAtLastRevalidate.height()) {
IntRect formerBottomMarginRect = IntRect(oldBoundsWithoutMargin.x(), oldBoundsWithoutMargin.height(),
oldBoundsWithoutMargin.width(), boundsWithoutMargin.height() - oldBoundsWithoutMargin.height());
setNeedsDisplayInRect(formerBottomMarginRect);
}
if (bounds.width() > m_boundsAtLastRevalidate.width()) {
IntRect formerRightMarginRect = IntRect(oldBoundsWithoutMargin.width(), oldBoundsWithoutMargin.y(),
boundsWithoutMargin.width() - oldBoundsWithoutMargin.width(), oldBoundsWithoutMargin.height());
setNeedsDisplayInRect(formerRightMarginRect);
}
}
}
FloatRect scaledBounds(bounds);
scaledBounds.scale(m_scale);
IntRect boundsInTileCoords(enclosingIntRect(scaledBounds));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment