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

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

Issue 548523005: Clip incremental invalidation rects for RenderBox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 3d40a296ec8b5e2f8ffab78926531778015280e8..193585a61245226eab182f47f007f1dea4ed0a4d 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -3892,7 +3892,7 @@ void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject& 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;
@@ -3916,7 +3916,7 @@ void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject& paint
positionFromPaintInvalidationBacking.y(),
deltaWidth + borderWidth,
std::max(oldBorderBoxSize.height(), newBorderBoxSize.height()));
- invalidatePaintUsingContainer(&paintInvalidationContainer, rightDeltaRect, InvalidationIncremental);
+ invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, rightDeltaRect, oldBounds, newBounds);
}
// Invalidate the bottom delta part and the bottom border of the old or new box which has smaller height.
@@ -3930,10 +3930,28 @@ void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject& paint
positionFromPaintInvalidationBacking.y() + smallerHeight - borderHeight,
std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()),
deltaHeight + borderHeight);
- invalidatePaintUsingContainer(&paintInvalidationContainer, bottomDeltaRect, InvalidationIncremental);
+ invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer, bottomDeltaRect, oldBounds, newBounds);
}
}
+void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const RenderLayerModelObject& 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, InvalidationIncremental);
+ return;
+ }
+ // Invalidate the bigger one if one contains another. Otherwise invalidate both.
+ if (!rectClippedByNewBounds.contains(rectClippedByOldBounds))
+ invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByOldBounds, InvalidationIncremental);
+ if (!rectClippedByOldBounds.contains(rectClippedByNewBounds))
+ invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByNewBounds, InvalidationIncremental);
Julien - ping for review 2014/09/16 18:22:52 I count 3 cases for the non-equal case. Do we have
Xianzhu 2014/09/16 18:36:13 Yes. The existing layout tests cover the cases. Ac
+}
+
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