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

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

Issue 59063003: Don't coerce pointers to compositor layer mappings to booleans. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . 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 1beb7cc164262f6339bd2d03b1cfc88dbb9bae0d..775a3d1e1ba0d324ad045ffc95226de3e244e843 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"
@@ -323,6 +324,10 @@ bool CompositedLayerMapping::shouldClipCompositedBounds() const
void CompositedLayerMapping::updateCompositedBounds()
{
+ // We need to know if we draw content in order to update our bounds (this has an effect
+ // on whether or not descendands will paint into our backing). Update this value now.
+ updateDrawsContent(isSimpleContainerCompositingLayer());
hartmanng 2013/11/08 22:51:05 this seems out of place in this patch
+
IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
// Clip to the size of the document or enclosing overflow-scroll layer.
@@ -464,7 +469,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 +556,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 +705,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 +1353,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;

Powered by Google App Engine
This is Rietveld 408576698