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()); |