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