Index: Source/core/layout/LayoutBoxModelObject.cpp |
diff --git a/Source/core/layout/LayoutBoxModelObject.cpp b/Source/core/layout/LayoutBoxModelObject.cpp |
index 8595619d09ae7b2001bc6f3568787551c5f98e58..d30dc0ca69d9a39e0b938b1fdf67361817e345ee 100644 |
--- a/Source/core/layout/LayoutBoxModelObject.cpp |
+++ b/Source/core/layout/LayoutBoxModelObject.cpp |
@@ -284,6 +284,22 @@ void LayoutBoxModelObject::styleDidChange(StyleDifference diff, const ComputedSt |
void LayoutBoxModelObject::createLayer(DeprecatedPaintLayerType type) |
{ |
+ |
+ // Acquiring a DeprecatedPaintLayer may change the paint invalidation container. Therefore we must eagerly |
+ // invalidate paint for this object before creating the layer. |
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && isRooted()) { |
+ DisablePaintInvalidationStateAsserts invalidationDisabler; |
+ DisableCompositingQueryAsserts compositingDisabler; |
+ |
+ // It would be more correct to call invalidatePaintIncludingNonCompositingDescendants, but |
+ // we do this instead to avoid performance issues when creating large numbers of layers. |
+ const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidationOnRootedTree(); |
+ invalidatePaintUsingContainer( |
+ paintInvalidationContainer, |
+ boundsRectForPaintInvalidation(&paintInvalidationContainer), |
+ PaintInvalidationLayer); |
+ } |
+ |
ASSERT(!m_layer); |
m_layer = adoptPtr(new DeprecatedPaintLayer(this, type)); |
setHasLayer(true); |