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

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: Rebase 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 b806e2cf2df5a3e0ef3cacef92aae2d3646e6ae2..bc83648c4ce63ea7b3bda57571e8f54cd04546ad 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -4099,7 +4099,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;
@@ -4123,7 +4123,7 @@ void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject& paint
positionFromPaintInvalidationContainer.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.
@@ -4137,10 +4137,26 @@ void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject& paint
positionFromPaintInvalidationContainer.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 they equal;
+ // - Invalidate the bigger one if one contains another;
+ // - Otherwise invalidate both.
+ bool equal = rectClippedByOldBounds == rectClippedByNewBounds;
Julien - ping for review 2014/09/16 18:22:52 (FYI as it's on the old patch) coding style violat
Xianzhu 2014/09/16 18:36:13 Acknowledged.
+ if (equal || !rectClippedByNewBounds.contains(rectClippedByOldBounds))
+ invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByOldBounds, InvalidationIncremental);
+ if (!equal && !rectClippedByOldBounds.contains(rectClippedByNewBounds))
+ invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedByNewBounds, InvalidationIncremental);
dsinclair 2014/09/16 15:24:01 This maybe a bit easier to read if the conditions
Xianzhu 2014/09/16 15:53:27 Good idea. Done.
+}
+
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