Chromium Code Reviews| 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()); |