Title: [160179] trunk/Source/WebCore
Revision
160179
Author
[email protected]
Date
2013-12-05 09:57:26 -0800 (Thu, 05 Dec 2013)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160178 => 160179)


--- trunk/Source/WebCore/ChangeLog	2013-12-05 17:54:48 UTC (rev 160178)
+++ trunk/Source/WebCore/ChangeLog	2013-12-05 17:57:26 UTC (rev 160179)
@@ -1,3 +1,29 @@
+2013-12-05  Beth Dakin  <[email protected]>
+
+        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  <[email protected]>
 
         Remove the forward declaration of BidiContext class from RenderBlock.h

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h (160178 => 160179)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h	2013-12-05 17:54:48 UTC (rev 160178)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h	2013-12-05 17:57:26 UTC (rev 160179)
@@ -148,6 +148,8 @@
     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;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm (160178 => 160179)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm	2013-12-05 17:54:48 UTC (rev 160178)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm	2013-12-05 17:57:26 UTC (rev 160179)
@@ -403,6 +403,18 @@
     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 @@
         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 @@
     }
 
     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));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to