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

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

Issue 58543002: Use a boolean hasCompositedLayerMapping() accessor instead of the pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comment for hasCompositedLayerMapping Created 7 years, 1 month 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: Source/core/rendering/CompositedLayerMapping.cpp
diff --git a/Source/core/rendering/CompositedLayerMapping.cpp b/Source/core/rendering/CompositedLayerMapping.cpp
index e11ed1642f2927bff1e4c0747609cb469aa9c06f..e8d88c5fec80158578187cc5ceafbadd3e614f19 100644
--- a/Source/core/rendering/CompositedLayerMapping.cpp
+++ b/Source/core/rendering/CompositedLayerMapping.cpp
@@ -53,6 +53,7 @@
#include "core/rendering/RenderImage.h"
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderLayerCompositor.h"
+#include "core/rendering/RenderLayerStackingNodeIterator.h"
#include "core/rendering/RenderVideo.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/animation/WebAnimationProvider.h"
@@ -464,7 +465,7 @@ bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.get());
if (m_owningLayer->reflectionInfo()) {
- if (m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerMapping()) {
+ if (m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLayerMapping()) {
GraphicsLayer* reflectionLayer = m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
}
@@ -551,7 +552,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry()
// We compute everything relative to the enclosing compositing layer.
IntRect ancestorCompositingBounds;
if (compAncestor) {
- ASSERT(compAncestor->compositedLayerMapping());
+ ASSERT(compAncestor->hasCompositedLayerMapping());
ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->compositedLayerMapping()->compositedBounds());
}
@@ -700,8 +701,8 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry()
m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
}
- if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerMapping()) {
- CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
+ if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->reflectionLayer()->hasCompositedLayerMapping()) {
+ CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
// The reflection layer has the bounds of m_owningLayer->reflectionLayer(),
@@ -1348,40 +1349,23 @@ static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
LayerListMutationDetector mutationChecker(parent->stackingNode());
#endif
- if (Vector<RenderLayerStackingNode*>* normalFlowList = parent->stackingNode()->normalFlowList()) {
- size_t listSize = normalFlowList->size();
- for (size_t i = 0; i < listSize; ++i) {
- RenderLayer* curLayer = normalFlowList->at(i)->layer();
- if (!curLayer->compositedLayerMapping()
- && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
- return true;
- }
+ RenderLayerStackingNodeIterator normalFlowIterator(*parent->stackingNode(), NormalFlowChildren);
+ while (RenderLayerStackingNode* curNode = normalFlowIterator.next()) {
+ RenderLayer* curLayer = curNode->layer();
+ if (!curLayer->hasCompositedLayerMapping()
+ && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
+ return true;
}
- if (parent->stackingNode()->isStackingContainer()) {
- if (!parent->hasVisibleDescendant())
- return false;
-
- // Use the m_hasCompositingDescendant bit to optimize?
- if (Vector<RenderLayerStackingNode*>* negZOrderList = parent->stackingNode()->negZOrderList()) {
- size_t listSize = negZOrderList->size();
- for (size_t i = 0; i < listSize; ++i) {
- RenderLayer* curLayer = negZOrderList->at(i)->layer();
- if (!curLayer->compositedLayerMapping()
- && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
- return true;
- }
- }
+ if (!parent->hasVisibleDescendant())
+ return false;
- if (Vector<RenderLayerStackingNode*>* posZOrderList = parent->stackingNode()->posZOrderList()) {
- size_t listSize = posZOrderList->size();
- for (size_t i = 0; i < listSize; ++i) {
- RenderLayer* curLayer = posZOrderList->at(i)->layer();
- if (!curLayer->compositedLayerMapping()
- && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
- return true;
- }
- }
+ RenderLayerStackingNodeIterator zOrderIterator(*parent->stackingNode(), NegativeZOrderChildren | PositiveZOrderChildren);
+ while (RenderLayerStackingNode* curNode = zOrderIterator.next()) {
+ RenderLayer* curLayer = curNode->layer();
+ if (!curLayer->hasCompositedLayerMapping()
+ && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
+ return true;
}
return false;
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.cpp ('k') | Source/core/rendering/CompositedLayerMappingPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698