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

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 468633002: hasSelfPaintingLayerDescendant should clean m_hasSelfPaintingLayerDescendantDirty (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 4 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
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index c1656e2ff4a8a17752b8e15b1e0a421b9ac47a06..f613c239fe6b9bbeb2ae304d9b349b13ffd8438d 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -275,15 +275,20 @@ void RenderLayer::updateLayerPositionRecursive()
child->updateLayerPositionRecursive();
}
-void RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant()
+void RenderLayer::updateHasSelfPaintingLayerDescendant() const
{
- for (RenderLayer* layer = this; layer; layer = layer->parent()) {
- if (!layer->m_hasSelfPaintingLayerDescendantDirty && layer->hasSelfPaintingLayerDescendant())
- break;
+ ASSERT(m_hasSelfPaintingLayerDescendantDirty);
+
+ m_hasSelfPaintingLayerDescendant = false;
- layer->m_hasSelfPaintingLayerDescendantDirty = false;
- layer->m_hasSelfPaintingLayerDescendant = true;
+ for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
+ if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) {
+ m_hasSelfPaintingLayerDescendant = true;
+ break;
+ }
}
+
+ m_hasSelfPaintingLayerDescendantDirty = false;
}
void RenderLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus()
@@ -293,7 +298,7 @@ void RenderLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus()
// If we have reached a self-painting layer, we know our parent should have a self-painting descendant
// in this case, there is no need to dirty our ancestors further.
if (layer->isSelfPaintingLayer()) {
- ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->hasSelfPaintingLayerDescendant());
+ ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->m_hasSelfPaintingLayerDescendant);
break;
}
}
@@ -650,25 +655,19 @@ void RenderLayer::updateDescendantDependentFlagsForEntireSubtree()
void RenderLayer::updateDescendantDependentFlags()
{
- if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty) {
+ if (m_visibleDescendantStatusDirty) {
m_hasVisibleDescendant = false;
- m_hasSelfPaintingLayerDescendant = false;
for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
child->updateDescendantDependentFlags();
- bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_hasVisibleDescendant;
- bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant();
-
- m_hasVisibleDescendant |= hasVisibleDescendant;
- m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant;
-
- if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant)
+ if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) {
+ m_hasVisibleDescendant = true;
break;
+ }
}
m_visibleDescendantStatusDirty = false;
- m_hasSelfPaintingLayerDescendantDirty = false;
}
if (m_blendInfo.childLayerHasBlendModeStatusDirty()) {
@@ -1263,12 +1262,10 @@ void RenderLayer::addChild(RenderLayer* child, RenderLayer* beforeChild)
}
dirtyAncestorChainVisibleDescendantStatus();
+ dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
child->updateDescendantDependentFlags();
- if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
- setAncestorChainHasSelfPaintingLayerDescendant();
-
if (child->blendInfo().hasBlendMode() || child->blendInfo().childLayerHasBlendMode())
m_blendInfo.setAncestorChainBlendedDescendant();
}
@@ -1302,6 +1299,8 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild)
oldChild->setNextSibling(0);
oldChild->m_parent = 0;
+ dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
+
oldChild->updateDescendantDependentFlags();
if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
@@ -1310,9 +1309,6 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild)
if (oldChild->m_blendInfo.hasBlendMode() || oldChild->blendInfo().childLayerHasBlendMode())
m_blendInfo.dirtyAncestorChainBlendedDescendantStatus();
- if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescendant())
- dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
-
return oldChild;
}
@@ -3411,16 +3407,13 @@ bool RenderLayer::shouldBeSelfPaintingLayer() const
void RenderLayer::updateSelfPaintingLayer()
{
- bool isSelfPaintingLayer = this->shouldBeSelfPaintingLayer();
+ bool isSelfPaintingLayer = shouldBeSelfPaintingLayer();
if (this->isSelfPaintingLayer() == isSelfPaintingLayer)
return;
m_isSelfPaintingLayer = isSelfPaintingLayer;
- if (!parent())
- return;
- if (isSelfPaintingLayer)
- parent()->setAncestorChainHasSelfPaintingLayerDescendant();
- else
+
+ if (parent())
parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
}
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698