Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 1892473002: Update PaintLayer::needsPaintPhaseXXX flags when add/remove layer on style change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index 5eed81877f073cfb7a536b2120991c542dc3b312..7b419ad9db642aef30b6c1ab0f5f27b70e2da17b 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -1252,11 +1252,12 @@ PaintLayer* PaintLayer::removeChild(PaintLayer* oldChild)
return oldChild;
}
-void PaintLayer::removeOnlyThisLayer()
+void PaintLayer::removeOnlyThisLayerAfterStyleChange()
{
if (!m_parent)
return;
+ bool didSetPaintInvalidation = false;
if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
DisableCompositingQueryAsserts disabler; // We need the current compositing status.
if (isPaintInvalidationContainer()) {
@@ -1266,9 +1267,15 @@ void PaintLayer::removeOnlyThisLayer()
DisablePaintInvalidationStateAsserts disabler;
layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
layoutObject()->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
+ didSetPaintInvalidation = true;
}
}
+ if (!didSetPaintInvalidation && isSelfPaintingLayer()) {
+ if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPaintingLayer())
+ enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this);
+ }
+
clipper().clearClipRectsIncludingDescendants();
PaintLayer* nextSib = nextSibling();
@@ -1295,7 +1302,7 @@ void PaintLayer::removeOnlyThisLayer()
m_layoutObject->destroyLayer();
}
-void PaintLayer::insertOnlyThisLayer()
+void PaintLayer::insertOnlyThisLayerAfterStyleChange()
{
if (!m_parent && layoutObject()->parent()) {
// We need to connect ourselves when our layoutObject() has a parent.
@@ -1310,6 +1317,23 @@ void PaintLayer::insertOnlyThisLayer()
for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = curr->nextSibling())
curr->moveLayers(m_parent, this);
+ // If the previous paint invalidation container is not a stacking context and this object is
+ // stacked content, creating this layer may cause this object and its descendants to change
+ // paint invalidation container.
+ bool didSetPaintInvalidation = false;
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && !layoutObject()->isLayoutView() && layoutObject()->isRooted() && layoutObject()->styleRef().isStacked()) {
+ const LayoutBoxModelObject& previousPaintInvalidationContainer = layoutObject()->parent()->containerForPaintInvalidation();
+ if (!previousPaintInvalidationContainer.styleRef().isStackingContext()) {
+ layoutObject()->invalidatePaintIncludingNonSelfPaintingLayerDescendants(previousPaintInvalidationContainer);
+ didSetPaintInvalidation = true;
+ }
+ }
+
+ if (!didSetPaintInvalidation && isSelfPaintingLayer()) {
+ if (PaintLayer* enclosingSelfPaintingLayer = m_parent->enclosingSelfPaintingLayer())
+ mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer);
+ }
+
// Clear out all the clip rects.
clipper().clearClipRectsIncludingDescendants();
}
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698