Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 948513004: Revert of Revert of Clip incremental invalidation rects for RenderBox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index 6c9bea47aefbb07abb77a327f43dc7f6f854c42d..d29d1599ef1ee09e7894f22384e49dc3b14866f1 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -3959,7 +3959,7 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size());
LayoutSize newBorderBoxSize = size();
- // If border box size didn't change, RenderBox's incrementallyInvalidatePaint() is good.
+ // If border box size didn't change, RenderObject's incrementallyInvalidatePaint() is good.
if (oldBorderBoxSize == newBorderBoxSize)
return;
@@ -3983,7 +3983,7 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
positionFromPaintInvalidationBacking.y(),
deltaWidth + borderWidth,
std::max(oldBorderBoxSize.height(), newBorderBoxSize.height()));
- invalidatePaintUsingContainer(&paintInvalidationContainer, rightDeltaRect, PaintInvalidationIncremental);
+ invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds);
}
// Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height.
@@ -3997,10 +3997,28 @@ void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
positionFromPaintInvalidationBacking.y() + smallerHeight - borderHeight,
std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()),
deltaHeight + borderHeight);
- invalidatePaintUsingContainer(&paintInvalidationContainer, bottomDeltaRect, PaintInvalidationIncremental);
+ invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds);
}
}
+void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutLayerModelObject& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& oldBounds, const LayoutRect& newBounds)
+{
+ if (rect.isEmpty())
+ return;
+ LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds);
+ LayoutRect rectClippedByNewBounds = intersection(rect, newBounds);
+ // Invalidate only once if the clipped rects equal.
+ if (rectClippedByOldBounds == rectClippedByNewBounds) {
+ invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByOldBounds, PaintInvalidationIncremental);
+ return;
+ }
+ // Invalidate the bigger one if one contains another. Otherwise invalidate both.
+ if (!rectClippedByNewBounds.contains(rectClippedByOldBounds))
+ invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByOldBounds, PaintInvalidationIncremental);
+ if (!rectClippedByOldBounds.contains(rectClippedByNewBounds))
+ invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByNewBounds, PaintInvalidationIncremental);
+}
+
void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScope)
{
ASSERT(!needsLayout());
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698