| Index: Source/core/layout/LayoutBox.cpp
|
| diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
|
| index aff8b7f4339afcf14c19215ae9c50f6b2c768c16..fdc44cfd005baa37afd79a11f20e734f44067648 100644
|
| --- a/Source/core/layout/LayoutBox.cpp
|
| +++ b/Source/core/layout/LayoutBox.cpp
|
| @@ -1400,6 +1400,27 @@ PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(PaintInvalidationStat
|
| return reason;
|
| }
|
|
|
| +PaintInvalidationReason LayoutBox::invalidatePaintIfNeededForSlimmingPaintV2(const LayoutPoint& paintOffset)
|
| +{
|
| + PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason();
|
| + // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the
|
| + // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original
|
| + // paint invalidation that chose PaintInvalidationDelayedFull.
|
| + if (fullInvalidationReason == PaintInvalidationDelayedFull) {
|
| + if (!intersectsVisibleViewport())
|
| + return PaintInvalidationDelayedFull;
|
| +
|
| + // Reset state back to regular full paint invalidation if the object is onscreen.
|
| + setShouldDoFullPaintInvalidation(PaintInvalidationFull);
|
| + }
|
| +
|
| + PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeededForSlimmingPaintV2(paintOffset);
|
| +
|
| + // This is for the next invalidatePaintIfNeeded so must be at the end.
|
| + savePreviousBoxSizesIfNeeded();
|
| + return reason;
|
| +}
|
| +
|
| void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintInvalidationState)
|
| {
|
| LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState);
|
| @@ -3990,6 +4011,7 @@ PaintInvalidationReason LayoutBox::paintInvalidationReason(const LayoutBoxModelO
|
| return PaintInvalidationIncremental;
|
| }
|
|
|
| +// TODO: Remove incremental invalidation for slimming paint v2.
|
| void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, const LayoutPoint& positionFromPaintInvalidationBacking)
|
| {
|
| LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newBounds, positionFromPaintInvalidationBacking);
|
| @@ -4583,7 +4605,7 @@ bool LayoutBox::needToSavePreviousBoxSizes()
|
| LayoutSize paintInvalidationSize = previousPaintInvalidationRectSize();
|
| // Don't save old box sizes if the paint rect is empty because we'll
|
| // full invalidate once the paint rect becomes non-empty.
|
| - if (paintInvalidationSize.isEmpty())
|
| + if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && paintInvalidationSize.isEmpty())
|
| return false;
|
|
|
| // We need the old box sizes only when the box has background, decorations, or masks.
|
| @@ -4593,7 +4615,7 @@ bool LayoutBox::needToSavePreviousBoxSizes()
|
|
|
| // No need to save old border box size if we can use size of the old paint
|
| // rect as the old border box size in the next invalidation.
|
| - if (paintInvalidationSize != size())
|
| + if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && paintInvalidationSize != size())
|
| return true;
|
|
|
| // Background and mask layers can depend on other boxes than border box. See crbug.com/490533
|
|
|