diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/rendering/RenderLayerStackingNode.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/rendering/RenderLayerStackingNode.cpp | 434 |
1 files changed, 52 insertions, 382 deletions
diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerStackingNode.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerStackingNode.cpp index 715dcecfe77..eaa6dfc09b4 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerStackingNode.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerStackingNode.cpp @@ -45,37 +45,33 @@ #include "core/rendering/RenderLayerStackingNode.h" #include "core/rendering/RenderLayer.h" -#include "core/rendering/RenderLayerCompositor.h" #include "core/rendering/RenderView.h" +#include "core/rendering/compositing/RenderLayerCompositor.h" #include "public/platform/Platform.h" namespace WebCore { // FIXME: This should not require RenderLayer. There is currently a cycle where -// in order to determine if we shoulBeNormalFlowOnly() and isStackingContainer() -// we have to ask the render layer about some of its state. +// in order to determine if we shoulBeNormalFlowOnly() we have to ask the render +// layer about some of its state. RenderLayerStackingNode::RenderLayerStackingNode(RenderLayer* layer) : m_layer(layer) - , m_descendantsAreContiguousInStackingOrder(false) - , m_descendantsAreContiguousInStackingOrderDirty(true) , m_normalFlowListDirty(true) - , m_needsToBeStackingContainer(false) - , m_needsToBeStackingContainerHasBeenRecorded(false) -#if !ASSERT_DISABLED +#if ASSERT_ENABLED , m_layerListMutationAllowed(true) , m_stackingParent(0) #endif { m_isNormalFlowOnly = shouldBeNormalFlowOnly(); - // Non-stacking containers should have empty z-order lists. As this is already the case, + // Non-stacking contexts should have empty z-order lists. As this is already the case, // there is no need to dirty / recompute these lists. - m_zOrderListsDirty = isStackingContainer(); + m_zOrderListsDirty = isStackingContext(); } RenderLayerStackingNode::~RenderLayerStackingNode() { -#if !ASSERT_DISABLED +#if ASSERT_ENABLED if (!renderer()->documentBeingDestroyed()) { ASSERT(!isInStackingParentZOrderLists()); ASSERT(!isInStackingParentNormalFlowList()); @@ -86,11 +82,6 @@ RenderLayerStackingNode::~RenderLayerStackingNode() #endif } -bool RenderLayerStackingNode::isStackingContext(const RenderStyle* style) const -{ - return !style->hasAutoZIndex() || layer()->isRootLayer(); -} - // Helper for the sorting of layers by z-index. static inline bool compareZIndex(RenderLayerStackingNode* first, RenderLayerStackingNode* second) { @@ -99,47 +90,16 @@ static inline bool compareZIndex(RenderLayerStackingNode* first, RenderLayerStac RenderLayerCompositor* RenderLayerStackingNode::compositor() const { - if (!renderer()->view()) - return 0; + ASSERT(renderer()->view()); return renderer()->view()->compositor(); } -void RenderLayerStackingNode::dirtyNormalFlowListCanBePromotedToStackingContainer() -{ - m_descendantsAreContiguousInStackingOrderDirty = true; - - if (m_normalFlowListDirty || !normalFlowList()) - return; - - for (size_t index = 0; index < normalFlowList()->size(); ++index) - normalFlowList()->at(index)->dirtyNormalFlowListCanBePromotedToStackingContainer(); -} - -void RenderLayerStackingNode::dirtySiblingStackingNodeCanBePromotedToStackingContainer() -{ - RenderLayerStackingNode* stackingNode = ancestorStackingNode(); - if (!stackingNode) - return; - - if (!stackingNode->zOrderListsDirty() && stackingNode->posZOrderList()) { - for (size_t index = 0; index < stackingNode->posZOrderList()->size(); ++index) - stackingNode->posZOrderList()->at(index)->setDescendantsAreContiguousInStackingOrderDirty(true); - } - - stackingNode->dirtyNormalFlowListCanBePromotedToStackingContainer(); - - if (!stackingNode->zOrderListsDirty() && stackingNode->negZOrderList()) { - for (size_t index = 0; index < stackingNode->negZOrderList()->size(); ++index) - stackingNode->negZOrderList()->at(index)->setDescendantsAreContiguousInStackingOrderDirty(true); - } -} - void RenderLayerStackingNode::dirtyZOrderLists() { ASSERT(m_layerListMutationAllowed); - ASSERT(isStackingContainer()); + ASSERT(isStackingContext()); -#if !ASSERT_DISABLED +#if ASSERT_ENABLED updateStackingParentForZOrderLists(0); #endif @@ -149,35 +109,13 @@ void RenderLayerStackingNode::dirtyZOrderLists() m_negZOrderList->clear(); m_zOrderListsDirty = true; - m_descendantsAreContiguousInStackingOrderDirty = true; - - if (!renderer()->documentBeingDestroyed()) { - compositor()->setNeedsUpdateCompositingRequirementsState(); - compositor()->setCompositingLayersNeedRebuild(); - if (layer()->acceleratedCompositingForOverflowScrollEnabled()) - compositor()->setNeedsToRecomputeCompositingRequirements(); - } + if (!renderer()->documentBeingDestroyed()) + compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); } -void RenderLayerStackingNode::dirtyStackingContainerZOrderLists() +void RenderLayerStackingNode::dirtyStackingContextZOrderLists() { - // Any siblings in the ancestor stacking context could also be affected. - // Changing z-index, for example, could cause us to stack in between a - // sibling's descendants, meaning that we have to recompute - // m_descendantsAreContiguousInStackingOrder for that sibling. - dirtySiblingStackingNodeCanBePromotedToStackingContainer(); - - RenderLayerStackingNode* stackingContainerNode = ancestorStackingContainerNode(); - if (stackingContainerNode) - stackingContainerNode->dirtyZOrderLists(); - - // Any change that could affect our stacking container's z-order list could - // cause other RenderLayers in our stacking context to either opt in or out - // of composited scrolling. It is important that we make our stacking - // context aware of these z-order changes so the appropriate updating can - // happen. - RenderLayerStackingNode* stackingNode = ancestorStackingNode(); - if (stackingNode && stackingNode != stackingContainerNode) + if (RenderLayerStackingNode* stackingNode = ancestorStackingContextNode()) stackingNode->dirtyZOrderLists(); } @@ -185,7 +123,7 @@ void RenderLayerStackingNode::dirtyNormalFlowList() { ASSERT(m_layerListMutationAllowed); -#if !ASSERT_DISABLED +#if ASSERT_ENABLED updateStackingParentForNormalFlowList(0); #endif @@ -193,57 +131,48 @@ void RenderLayerStackingNode::dirtyNormalFlowList() m_normalFlowList->clear(); m_normalFlowListDirty = true; - if (!renderer()->documentBeingDestroyed()) { - compositor()->setCompositingLayersNeedRebuild(); - if (layer()->acceleratedCompositingForOverflowScrollEnabled()) - compositor()->setNeedsToRecomputeCompositingRequirements(); - } + if (!renderer()->documentBeingDestroyed()) + compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); } void RenderLayerStackingNode::rebuildZOrderLists() { ASSERT(m_layerListMutationAllowed); - ASSERT(isDirtyStackingContainer()); - rebuildZOrderLists(m_posZOrderList, m_negZOrderList); - -#if !ASSERT_DISABLED - updateStackingParentForZOrderLists(this); -#endif - - m_zOrderListsDirty = false; -} + ASSERT(isDirtyStackingContext()); -void RenderLayerStackingNode::rebuildZOrderLists(OwnPtr<Vector<RenderLayerStackingNode*> >& posZOrderList, - OwnPtr<Vector<RenderLayerStackingNode*> >& negZOrderList, const RenderLayerStackingNode* nodeToForceAsStackingContainer, - CollectLayersBehavior collectLayersBehavior) -{ for (RenderLayer* child = layer()->firstChild(); child; child = child->nextSibling()) { if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != child) - child->stackingNode()->collectLayers(posZOrderList, negZOrderList, nodeToForceAsStackingContainer, collectLayersBehavior); + child->stackingNode()->collectLayers(m_posZOrderList, m_negZOrderList); } // Sort the two lists. - if (posZOrderList) - std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZIndex); + if (m_posZOrderList) + std::stable_sort(m_posZOrderList->begin(), m_posZOrderList->end(), compareZIndex); - if (negZOrderList) - std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZIndex); + if (m_negZOrderList) + std::stable_sort(m_negZOrderList->begin(), m_negZOrderList->end(), compareZIndex); // Append layers for top layer elements after normal layer collection, to ensure they are on top regardless of z-indexes. // The renderers of top layer elements are children of the view, sorted in top layer stacking order. if (layer()->isRootLayer()) { - RenderObject* view = renderer()->view(); + RenderView* view = renderer()->view(); for (RenderObject* child = view->firstChild(); child; child = child->nextSibling()) { Element* childElement = (child->node() && child->node()->isElementNode()) ? toElement(child->node()) : 0; if (childElement && childElement->isInTopLayer()) { RenderLayer* layer = toRenderLayerModelObject(child)->layer(); // Create the buffer if it doesn't exist yet. - if (!posZOrderList) - posZOrderList = adoptPtr(new Vector<RenderLayerStackingNode*>); - posZOrderList->append(layer->stackingNode()); + if (!m_posZOrderList) + m_posZOrderList = adoptPtr(new Vector<RenderLayerStackingNode*>); + m_posZOrderList->append(layer->stackingNode()); } } } + +#if ASSERT_ENABLED + updateStackingParentForZOrderLists(this); +#endif + + m_zOrderListsDirty = false; } void RenderLayerStackingNode::updateNormalFlowList() @@ -254,7 +183,6 @@ void RenderLayerStackingNode::updateNormalFlowList() ASSERT(m_layerListMutationAllowed); for (RenderLayer* child = layer()->firstChild(); child; child = child->nextSibling()) { - // Ignore non-overflow layers and reflections. if (child->stackingNode()->isNormalFlowOnly() && (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != child)) { if (!m_normalFlowList) m_normalFlowList = adoptPtr(new Vector<RenderLayerStackingNode*>); @@ -262,71 +190,36 @@ void RenderLayerStackingNode::updateNormalFlowList() } } -#if !ASSERT_DISABLED +#if ASSERT_ENABLED updateStackingParentForNormalFlowList(this); #endif m_normalFlowListDirty = false; } -void RenderLayerStackingNode::collectLayers(OwnPtr<Vector<RenderLayerStackingNode*> >& posBuffer, OwnPtr<Vector<RenderLayerStackingNode*> >& negBuffer, - const RenderLayerStackingNode* nodeToForceAsStackingContainer, CollectLayersBehavior collectLayersBehavior) +void RenderLayerStackingNode::collectLayers(OwnPtr<Vector<RenderLayerStackingNode*> >& posBuffer, OwnPtr<Vector<RenderLayerStackingNode*> >& negBuffer) { if (layer()->isInTopLayer()) return; layer()->updateDescendantDependentFlags(); - bool isStacking = false; - bool isNormalFlow = false; - - switch (collectLayersBehavior) { - case ForceLayerToStackingContainer: - ASSERT(nodeToForceAsStackingContainer); - if (this == nodeToForceAsStackingContainer) { - isStacking = true; - isNormalFlow = false; - } else { - isStacking = isStackingContext(); - isNormalFlow = shouldBeNormalFlowOnlyIgnoringCompositedScrolling(); - } - break; - case OverflowScrollCanBeStackingContainers: - ASSERT(!nodeToForceAsStackingContainer); - isStacking = isStackingContainer(); - isNormalFlow = isNormalFlowOnly(); - break; - case OnlyStackingContextsCanBeStackingContainers: - isStacking = isStackingContext(); - isNormalFlow = shouldBeNormalFlowOnlyIgnoringCompositedScrolling(); - break; - } - - // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. - if (!isNormalFlow && !layer()->isOutOfFlowRenderFlowThread()) { - // Determine which buffer the child should be in. + if (!isNormalFlowOnly()) { OwnPtr<Vector<RenderLayerStackingNode*> >& buffer = (zIndex() >= 0) ? posBuffer : negBuffer; - - // Create the buffer if it doesn't exist yet. if (!buffer) buffer = adoptPtr(new Vector<RenderLayerStackingNode*>); - - // Append ourselves at the end of the appropriate buffer. buffer->append(this); } - // Recur into our children to collect more layers, but only if we don't establish - // a stacking context/container. - if (!isStacking) { + if (!isStackingContext()) { for (RenderLayer* child = layer()->firstChild(); child; child = child->nextSibling()) { - // Ignore reflections. if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != child) - child->stackingNode()->collectLayers(posBuffer, negBuffer, nodeToForceAsStackingContainer, collectLayersBehavior); + child->stackingNode()->collectLayers(posBuffer, negBuffer); } } } -#if !ASSERT_DISABLED +#if ASSERT_ENABLED bool RenderLayerStackingNode::isInStackingParentZOrderLists() const { if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) @@ -386,50 +279,26 @@ void RenderLayerStackingNode::updateLayerListsIfNeeded() void RenderLayerStackingNode::updateStackingNodesAfterStyleChange(const RenderStyle* oldStyle) { - bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; - EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; + bool wasStackingContext = oldStyle ? !oldStyle->hasAutoZIndex() : false; int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; - // FIXME: RenderLayer already handles visibility changes through our visiblity dirty bits. This logic could - // likely be folded along with the rest. bool isStackingContext = this->isStackingContext(); - if (isStackingContext == wasStackingContext && oldVisibility == renderer()->style()->visibility() && oldZIndex == zIndex()) + if (isStackingContext == wasStackingContext && oldZIndex == zIndex()) return; - dirtyStackingContainerZOrderLists(); + dirtyStackingContextZOrderLists(); - if (isStackingContainer()) + if (isStackingContext) dirtyZOrderLists(); else clearZOrderLists(); - - compositor()->setNeedsUpdateCompositingRequirementsState(); } +// FIXME: Rename shouldBeNormalFlowOnly to something more accurate now that CSS +// 2.1 defines the term "normal flow". bool RenderLayerStackingNode::shouldBeNormalFlowOnly() const { - return shouldBeNormalFlowOnlyIgnoringCompositedScrolling() && !layer()->needsCompositedScrolling(); -} - -bool RenderLayerStackingNode::shouldBeNormalFlowOnlyIgnoringCompositedScrolling() const -{ - const bool couldBeNormalFlow = renderer()->hasOverflowClip() - || renderer()->hasReflection() - || renderer()->hasMask() - || renderer()->isCanvas() - || renderer()->isVideo() - || renderer()->isEmbeddedObject() - || renderer()->isRenderIFrame() - || (renderer()->style()->specifiesColumns() && !layer()->isRootLayer()); - const bool preventsElementFromBeingNormalFlow = renderer()->isPositioned() - || renderer()->hasTransform() - || renderer()->hasClipPath() - || renderer()->hasFilter() - || renderer()->hasBlendMode() - || layer()->isTransparent() - || renderer()->style()->hasFlowFrom(); - - return couldBeNormalFlow && !preventsElementFromBeingNormalFlow; + return !isStackingContext() && !renderer()->isPositioned(); } void RenderLayerStackingNode::updateIsNormalFlowOnly() @@ -441,215 +310,16 @@ void RenderLayerStackingNode::updateIsNormalFlowOnly() m_isNormalFlowOnly = isNormalFlowOnly; if (RenderLayer* p = layer()->parent()) p->stackingNode()->dirtyNormalFlowList(); - dirtyStackingContainerZOrderLists(); -} - -bool RenderLayerStackingNode::needsToBeStackingContainer() const -{ - return layer()->scrollableArea() && layer()->scrollableArea()->adjustForForceCompositedScrollingMode(m_needsToBeStackingContainer); -} - -// Determine whether the current layer can be promoted to a stacking container. -// We do this by computing what positive and negative z-order lists would look -// like before and after promotion, and ensuring that proper stacking order is -// preserved between the two sets of lists. -void RenderLayerStackingNode::updateDescendantsAreContiguousInStackingOrder() -{ - TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerStackingNode::updateDescendantsAreContiguousInStackingOrder"); - - const RenderLayer* currentLayer = layer(); - if (isStackingContext() || !m_descendantsAreContiguousInStackingOrderDirty || !currentLayer->acceleratedCompositingForOverflowScrollEnabled()) - return; - - if (!currentLayer->scrollsOverflow()) - return; - - RenderLayerStackingNode* stackingNode = ancestorStackingNode(); - if (!stackingNode) - return; - - OwnPtr<Vector<RenderLayerStackingNode*> > posZOrderListBeforePromote = adoptPtr(new Vector<RenderLayerStackingNode*>); - OwnPtr<Vector<RenderLayerStackingNode*> > negZOrderListBeforePromote = adoptPtr(new Vector<RenderLayerStackingNode*>); - OwnPtr<Vector<RenderLayerStackingNode*> > posZOrderListAfterPromote = adoptPtr(new Vector<RenderLayerStackingNode*>); - OwnPtr<Vector<RenderLayerStackingNode*> > negZOrderListAfterPromote = adoptPtr(new Vector<RenderLayerStackingNode*>); - - collectBeforePromotionZOrderList(stackingNode, posZOrderListBeforePromote, negZOrderListBeforePromote); - collectAfterPromotionZOrderList(stackingNode, posZOrderListAfterPromote, negZOrderListAfterPromote); - - size_t maxIndex = std::min(posZOrderListAfterPromote->size() + negZOrderListAfterPromote->size(), posZOrderListBeforePromote->size() + negZOrderListBeforePromote->size()); - - m_descendantsAreContiguousInStackingOrderDirty = false; - m_descendantsAreContiguousInStackingOrder = false; - - const RenderLayerStackingNode* nodeAfterPromote = 0; - for (size_t i = 0; i < maxIndex && nodeAfterPromote != this; ++i) { - const RenderLayerStackingNode* nodeBeforePromote = i < negZOrderListBeforePromote->size() - ? negZOrderListBeforePromote->at(i) - : posZOrderListBeforePromote->at(i - negZOrderListBeforePromote->size()); - nodeAfterPromote = i < negZOrderListAfterPromote->size() - ? negZOrderListAfterPromote->at(i) - : posZOrderListAfterPromote->at(i - negZOrderListAfterPromote->size()); - - if (nodeBeforePromote != nodeAfterPromote && (nodeAfterPromote != this || renderer()->hasBackground())) - return; - } - - nodeAfterPromote = 0; - for (size_t i = 0; i < maxIndex && nodeAfterPromote != this; ++i) { - const RenderLayerStackingNode* nodeBeforePromote = i < posZOrderListBeforePromote->size() - ? posZOrderListBeforePromote->at(posZOrderListBeforePromote->size() - i - 1) - : negZOrderListBeforePromote->at(negZOrderListBeforePromote->size() + posZOrderListBeforePromote->size() - i - 1); - nodeAfterPromote = i < posZOrderListAfterPromote->size() - ? posZOrderListAfterPromote->at(posZOrderListAfterPromote->size() - i - 1) - : negZOrderListAfterPromote->at(negZOrderListAfterPromote->size() + posZOrderListAfterPromote->size() - i - 1); - - if (nodeBeforePromote != nodeAfterPromote && nodeAfterPromote != this) - return; - } - - m_descendantsAreContiguousInStackingOrder = true; -} - -void RenderLayerStackingNode::collectBeforePromotionZOrderList(RenderLayerStackingNode* ancestorStackingNode, - OwnPtr<Vector<RenderLayerStackingNode*> >& posZOrderList, OwnPtr<Vector<RenderLayerStackingNode*> >& negZOrderList) -{ - ancestorStackingNode->rebuildZOrderLists(posZOrderList, negZOrderList, this, OnlyStackingContextsCanBeStackingContainers); - - const RenderLayer* currentLayer = layer(); - const RenderLayer* positionedAncestor = currentLayer->parent(); - while (positionedAncestor && !positionedAncestor->isPositionedContainer() && !positionedAncestor->stackingNode()->isStackingContext()) - positionedAncestor = positionedAncestor->parent(); - if (positionedAncestor && (!positionedAncestor->isPositionedContainer() || positionedAncestor->stackingNode()->isStackingContext())) - positionedAncestor = 0; - - if (!posZOrderList) - posZOrderList = adoptPtr(new Vector<RenderLayerStackingNode*>()); - else if (posZOrderList->find(this) != kNotFound) - return; - - // The current node will appear in the z-order lists after promotion, so - // for a meaningful comparison, we must insert it in the z-order lists - // before promotion if it does not appear there already. - if (!positionedAncestor) { - posZOrderList->prepend(this); - return; - } - - for (size_t index = 0; index < posZOrderList->size(); index++) { - if (posZOrderList->at(index)->layer() == positionedAncestor) { - posZOrderList->insert(index + 1, this); - return; - } - } -} - -void RenderLayerStackingNode::collectAfterPromotionZOrderList(RenderLayerStackingNode* ancestorStackingNode, - OwnPtr<Vector<RenderLayerStackingNode*> >& posZOrderList, OwnPtr<Vector<RenderLayerStackingNode*> >& negZOrderList) -{ - ancestorStackingNode->rebuildZOrderLists(posZOrderList, negZOrderList, this, ForceLayerToStackingContainer); + dirtyStackingContextZOrderLists(); } -// Compute what positive and negative z-order lists would look like before and -// after promotion, so we can later ensure that proper stacking order is -// preserved between the two sets of lists. -// -// A few examples: -// c = currentLayer -// - = negative z-order child of currentLayer -// + = positive z-order child of currentLayer -// a = positioned ancestor of currentLayer -// x = any other RenderLayer in the list -// -// (a) xxxxx-----++a+++x -// (b) xxx-----c++++++xx -// -// Normally the current layer would be painted in the normal flow list if it -// doesn't already appear in the positive z-order list. However, in the case -// that the layer has a positioned ancestor, it will paint directly after the -// positioned ancestor. In example (a), the current layer would be painted in -// the middle of its own positive z-order children, so promoting would cause a -// change in paint order (since a promoted layer will paint all of its positive -// z-order children strictly after it paints itself). -// -// In example (b), it is ok to promote the current layer only if it does not -// have a background. If it has a background, the background gets painted before -// the layer's negative z-order children, so again, a promotion would cause a -// change in paint order (causing the background to get painted after the -// negative z-order children instead of before). -// -void RenderLayerStackingNode::computePaintOrderList(PaintOrderListType type, Vector<RefPtr<Node> >& list) +RenderLayerStackingNode* RenderLayerStackingNode::ancestorStackingContextNode() const { - OwnPtr<Vector<RenderLayerStackingNode*> > posZOrderList; - OwnPtr<Vector<RenderLayerStackingNode*> > negZOrderList; - - RenderLayerStackingNode* stackingNode = ancestorStackingNode(); - if (!stackingNode) - return; - - switch (type) { - case BeforePromote: - collectBeforePromotionZOrderList(stackingNode, posZOrderList, negZOrderList); - break; - case AfterPromote: - collectAfterPromotionZOrderList(stackingNode, posZOrderList, negZOrderList); - break; - } - - if (negZOrderList) { - for (size_t index = 0; index < negZOrderList->size(); ++index) - list.append(negZOrderList->at(index)->renderer()->node()); - } - - if (posZOrderList) { - for (size_t index = 0; index < posZOrderList->size(); ++index) - list.append(posZOrderList->at(index)->renderer()->node()); + for (RenderLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor->parent()) { + RenderLayerStackingNode* stackingNode = ancestor->stackingNode(); + if (stackingNode->isStackingContext()) + return stackingNode; } -} - -bool RenderLayerStackingNode::descendantsAreContiguousInStackingOrder() const -{ - if (isStackingContext() || !ancestorStackingContainerNode()) - return true; - - ASSERT(!m_descendantsAreContiguousInStackingOrderDirty); - return m_descendantsAreContiguousInStackingOrder; -} - -bool RenderLayerStackingNode::setNeedsToBeStackingContainer(bool needsToBeStackingContainer) -{ - if (this->needsToBeStackingContainer() == needsToBeStackingContainer) - return false; - - // Count the total number of RenderLayers which need to be stacking - // containers some point. This should be recorded at most once per - // RenderLayer, so we check m_needsToBeStackingContainerHasBeenRecorded. - if (layer()->acceleratedCompositingForOverflowScrollEnabled() && !m_needsToBeStackingContainerHasBeenRecorded) { - blink::Platform::current()->histogramEnumeration("Renderer.CompositedScrolling", RenderLayer::NeedsToBeStackingContainerBucket, RenderLayer::CompositedScrollingHistogramMax); - m_needsToBeStackingContainerHasBeenRecorded = true; - } - - m_needsToBeStackingContainer = needsToBeStackingContainer; - - return true; -} - -RenderLayerStackingNode* RenderLayerStackingNode::ancestorStackingContainerNode() const -{ - RenderLayer* ancestor = layer()->parent(); - while (ancestor && !ancestor->stackingNode()->isStackingContainer()) - ancestor = ancestor->parent(); - if (ancestor) - return ancestor->stackingNode(); - return 0; -} - -RenderLayerStackingNode* RenderLayerStackingNode::ancestorStackingNode() const -{ - RenderLayer* ancestor = layer()->parent(); - while (ancestor && !ancestor->stackingNode()->isStackingContext()) - ancestor = ancestor->parent(); - if (ancestor) - return ancestor->stackingNode(); return 0; } |