| Index: Source/core/rendering/RenderLayer.cpp
|
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
|
| index a18ab22ce0bc044933cbbba4ced6a615213cfcce..970b7d088dd528d3b39a73f9cf5de2b56e8612ed 100644
|
| --- a/Source/core/rendering/RenderLayer.cpp
|
| +++ b/Source/core/rendering/RenderLayer.cpp
|
| @@ -114,11 +114,12 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer)
|
| , m_hasUnclippedDescendant(false)
|
| , m_isUnclippedDescendant(false)
|
| , m_needsCompositedScrolling(false)
|
| - , m_needsCompositedScrollingHasBeenRecorded(false)
|
| + , m_needsToBeStackingContainerHasBeenRecorded(false)
|
| , m_willUseCompositedScrollingHasBeenRecorded(false)
|
| , m_isScrollableAreaHasBeenRecorded(false)
|
| - , m_canBePromotedToStackingContainer(false)
|
| - , m_canBePromotedToStackingContainerDirty(true)
|
| + , m_needsToBeStackingContainer(false)
|
| + , m_descendantsAreContiguousInStackingOrder(false)
|
| + , m_descendantsAreContiguousInStackingOrderDirty(true)
|
| , m_isRootLayer(renderer->isRenderView())
|
| , m_usedTransparency(false)
|
| , m_childLayerHasBlendMode(false)
|
| @@ -410,11 +411,11 @@ bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const
|
| // 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 RenderLayer::updateCanBeStackingContainer()
|
| +void RenderLayer::updateDescendantsAreContiguousInStackingOrder()
|
| {
|
| - TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayer::updateCanBeStackingContainer");
|
| + TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayer::updateDescendantsAreContiguousInStackingOrder");
|
|
|
| - if (isStackingContext() || !m_canBePromotedToStackingContainerDirty || !acceleratedCompositingForOverflowScrollEnabled())
|
| + if (isStackingContext() || !m_descendantsAreContiguousInStackingOrderDirty || !acceleratedCompositingForOverflowScrollEnabled())
|
| return;
|
|
|
| FrameView* frameView = renderer()->view()->frameView();
|
| @@ -435,8 +436,8 @@ void RenderLayer::updateCanBeStackingContainer()
|
|
|
| size_t maxIndex = std::min(posZOrderListAfterPromote->size() + negZOrderListAfterPromote->size(), posZOrderListBeforePromote->size() + negZOrderListBeforePromote->size());
|
|
|
| - m_canBePromotedToStackingContainerDirty = false;
|
| - m_canBePromotedToStackingContainer = false;
|
| + m_descendantsAreContiguousInStackingOrderDirty = false;
|
| + m_descendantsAreContiguousInStackingOrder = false;
|
|
|
| const RenderLayer* layerAfterPromote = 0;
|
| for (size_t i = 0; i < maxIndex && layerAfterPromote != this; ++i) {
|
| @@ -464,7 +465,7 @@ void RenderLayer::updateCanBeStackingContainer()
|
| return;
|
| }
|
|
|
| - m_canBePromotedToStackingContainer = true;
|
| + m_descendantsAreContiguousInStackingOrder = true;
|
| }
|
|
|
| static inline bool isPositionedContainer(const RenderLayer* layer)
|
| @@ -905,13 +906,13 @@ void RenderLayer::updatePagination()
|
| }
|
| }
|
|
|
| -bool RenderLayer::canBeStackingContainer() const
|
| +bool RenderLayer::descendantsAreContiguousInStackingOrder() const
|
| {
|
| if (isStackingContext() || !ancestorStackingContainer())
|
| return true;
|
|
|
| - ASSERT(!m_canBePromotedToStackingContainerDirty);
|
| - return m_canBePromotedToStackingContainer;
|
| + ASSERT(!m_descendantsAreContiguousInStackingOrderDirty);
|
| + return m_descendantsAreContiguousInStackingOrder;
|
| }
|
|
|
| void RenderLayer::setHasVisibleContent()
|
| @@ -1685,7 +1686,7 @@ void RenderLayer::addChild(RenderLayer* child, RenderLayer* beforeChild)
|
| // layer's stacking context. We need to manually do it here as well, in case
|
| // we're adding this layer after the stacking context has already been
|
| // updated.
|
| - child->m_canBePromotedToStackingContainerDirty = true;
|
| + child->m_descendantsAreContiguousInStackingOrderDirty = true;
|
| compositor()->layerWasAdded(this, child);
|
| }
|
|
|
| @@ -1950,20 +1951,11 @@ bool RenderLayer::usesCompositedScrolling() const
|
| return compositedLayerMapping() && compositedLayerMapping()->scrollingLayer();
|
| }
|
|
|
| -bool RenderLayer::needsCompositedScrolling() const
|
| -{
|
| - if (!compositorDrivenAcceleratedScrollingEnabled())
|
| - return needsToBeStackingContainer();
|
| - if (FrameView* frameView = renderer()->view()->frameView())
|
| - return frameView->containsScrollableArea(scrollableArea());
|
| - return false;
|
| -}
|
| -
|
| -bool RenderLayer::needsToBeStackingContainer() const
|
| +bool RenderLayer::adjustForForceCompositedScrollingMode(bool value) const
|
| {
|
| switch (m_forceNeedsCompositedScrolling) {
|
| case DoNotForceCompositedScrolling:
|
| - return m_needsCompositedScrolling;
|
| + return value;
|
| case CompositedScrollingAlwaysOn:
|
| return true;
|
| case CompositedScrollingAlwaysOff:
|
| @@ -1971,7 +1963,17 @@ bool RenderLayer::needsToBeStackingContainer() const
|
| }
|
|
|
| ASSERT_NOT_REACHED();
|
| - return m_needsCompositedScrolling;
|
| + return value;
|
| +}
|
| +
|
| +bool RenderLayer::needsCompositedScrolling() const
|
| +{
|
| + return adjustForForceCompositedScrollingMode(m_needsCompositedScrolling);
|
| +}
|
| +
|
| +bool RenderLayer::needsToBeStackingContainer() const
|
| +{
|
| + return adjustForForceCompositedScrollingMode(m_needsToBeStackingContainer);
|
| }
|
|
|
| RenderLayer* RenderLayer::scrollParent() const
|
| @@ -1993,13 +1995,13 @@ RenderLayer* RenderLayer::scrollParent() const
|
| // that we scroll with our scrolling ancestor and it cannot do this if we do not promote.
|
| RenderLayer* scrollParent = ancestorScrollingLayer();
|
|
|
| - if (!scrollParent || scrollParent->isStackingContext())
|
| + if (!scrollParent || scrollParent->isStackingContainer())
|
| return 0;
|
|
|
| // If we hit a stacking context on our way up to the ancestor scrolling layer, it will already
|
| // be composited due to an overflow scrolling parent, so we don't need to.
|
| for (RenderLayer* ancestor = parent(); ancestor && ancestor != scrollParent; ancestor = ancestor->parent()) {
|
| - if (ancestor->isStackingContext())
|
| + if (ancestor->isStackingContainer())
|
| return 0;
|
| }
|
|
|
| @@ -2023,14 +2025,19 @@ void RenderLayer::updateNeedsCompositedScrolling()
|
| {
|
| TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling");
|
|
|
| - updateCanBeStackingContainer();
|
| + updateDescendantsAreContiguousInStackingOrder();
|
| updateDescendantDependentFlags();
|
|
|
| ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->containsScrollableArea(scrollableArea()));
|
| - bool needsCompositedScrolling = acceleratedCompositingForOverflowScrollEnabled()
|
| - && canBeStackingContainer()
|
| + const bool needsToBeStackingContainer = acceleratedCompositingForOverflowScrollEnabled()
|
| + && descendantsAreContiguousInStackingOrder()
|
| && !hasUnclippedDescendant();
|
|
|
| + const bool needsToBeStackingContainerDidChange = setNeedsToBeStackingContainer(needsToBeStackingContainer);
|
| +
|
| + const bool needsCompositedScrolling = needsToBeStackingContainer
|
| + || compositorDrivenAcceleratedScrollingEnabled();
|
| +
|
| // We gather a boolean value for use with Google UMA histograms to
|
| // quantify the actual effects of a set of patches attempting to
|
| // relax composited scrolling requirements, thereby increasing the
|
| @@ -2038,7 +2045,15 @@ void RenderLayer::updateNeedsCompositedScrolling()
|
| if (acceleratedCompositingForOverflowScrollEnabled())
|
| HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrolling", needsCompositedScrolling, 2);
|
|
|
| - setNeedsCompositedScrolling(needsCompositedScrolling);
|
| + const bool needsCompositedScrollingDidChange = setNeedsCompositedScrolling(needsCompositedScrolling);
|
| +
|
| + if (needsToBeStackingContainerDidChange || needsCompositedScrollingDidChange) {
|
| + // Note, the z-order lists may need to be rebuilt, but our code guarantees
|
| + // that we have not affected stacking, so we will not dirty
|
| + // m_descendantsAreContiguousInStackingOrder for either us or our stacking
|
| + // context or container.
|
| + didUpdateNeedsCompositedScrolling();
|
| + }
|
| }
|
|
|
| enum CompositedScrollingHistogramBuckets {
|
| @@ -2048,28 +2063,14 @@ enum CompositedScrollingHistogramBuckets {
|
| CompositedScrollingHistogramMax = 3
|
| };
|
|
|
| -void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling)
|
| +bool RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling)
|
| {
|
| if (m_needsCompositedScrolling == needsCompositedScrolling)
|
| - return;
|
| -
|
| - // 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_needsCompositedScrollingHasBeenRecorded.
|
| - if (acceleratedCompositingForOverflowScrollEnabled() && !m_needsCompositedScrollingHasBeenRecorded) {
|
| - HistogramSupport::histogramEnumeration("Renderer.CompositedScrolling", NeedsToBeStackingContainerBucket, CompositedScrollingHistogramMax);
|
| - m_needsCompositedScrollingHasBeenRecorded = true;
|
| - }
|
| + return false;
|
|
|
| // Count the total number of RenderLayers which need composited scrolling at
|
| // some point. This should be recorded at most once per RenderLayer, so we
|
| // check m_willUseCompositedScrollingHasBeenRecorded.
|
| - //
|
| - // FIXME: Currently, this computes the exact same value as the above.
|
| - // However, it will soon be expanded to cover more than just stacking
|
| - // containers (see crbug.com/249354). When this happens, we should see a
|
| - // spike in "WillUseCompositedScrolling", while "NeedsToBeStackingContainer"
|
| - // will remain relatively static.
|
| if (acceleratedCompositingForOverflowScrollEnabled() && !m_willUseCompositedScrollingHasBeenRecorded) {
|
| HistogramSupport::histogramEnumeration("Renderer.CompositedScrolling", WillUseCompositedScrollingBucket, CompositedScrollingHistogramMax);
|
| m_willUseCompositedScrollingHasBeenRecorded = true;
|
| @@ -2077,11 +2078,25 @@ void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling)
|
|
|
| m_needsCompositedScrolling = needsCompositedScrolling;
|
|
|
| - // Note, the z-order lists may need to be rebuilt, but our code guarantees
|
| - // that we have not affected stacking, so we will not dirty
|
| - // m_canBePromotedToStackingContainer for either us or our stacking context
|
| - // or container.
|
| - didUpdateNeedsCompositedScrolling();
|
| + return true;
|
| +}
|
| +
|
| +bool RenderLayer::setNeedsToBeStackingContainer(bool needsToBeStackingContainer)
|
| +{
|
| + if (m_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 (acceleratedCompositingForOverflowScrollEnabled() && !m_needsToBeStackingContainerHasBeenRecorded) {
|
| + HistogramSupport::histogramEnumeration("Renderer.CompositedScrolling", NeedsToBeStackingContainerBucket, CompositedScrollingHistogramMax);
|
| + m_needsToBeStackingContainerHasBeenRecorded = true;
|
| + }
|
| +
|
| + m_needsToBeStackingContainer = needsToBeStackingContainer;
|
| +
|
| + return true;
|
| }
|
|
|
| void RenderLayer::setForceNeedsCompositedScrolling(RenderLayer::ForceNeedsCompositedScrollingMode mode)
|
| @@ -4644,7 +4659,7 @@ static inline bool compareZIndex(RenderLayer* first, RenderLayer* second)
|
|
|
| void RenderLayer::dirtyNormalFlowListCanBePromotedToStackingContainer()
|
| {
|
| - m_canBePromotedToStackingContainerDirty = true;
|
| + m_descendantsAreContiguousInStackingOrderDirty = true;
|
|
|
| if (m_normalFlowListDirty || !normalFlowList())
|
| return;
|
| @@ -4661,14 +4676,14 @@ void RenderLayer::dirtySiblingStackingContextCanBePromotedToStackingContainer()
|
|
|
| if (!ancestorStackingContext->m_zOrderListsDirty && ancestorStackingContext->posZOrderList()) {
|
| for (size_t index = 0; index < ancestorStackingContext->posZOrderList()->size(); ++index)
|
| - ancestorStackingContext->posZOrderList()->at(index)->m_canBePromotedToStackingContainerDirty = true;
|
| + ancestorStackingContext->posZOrderList()->at(index)->m_descendantsAreContiguousInStackingOrderDirty = true;
|
| }
|
|
|
| ancestorStackingContext->dirtyNormalFlowListCanBePromotedToStackingContainer();
|
|
|
| if (!ancestorStackingContext->m_zOrderListsDirty && ancestorStackingContext->negZOrderList()) {
|
| for (size_t index = 0; index < ancestorStackingContext->negZOrderList()->size(); ++index)
|
| - ancestorStackingContext->negZOrderList()->at(index)->m_canBePromotedToStackingContainerDirty = true;
|
| + ancestorStackingContext->negZOrderList()->at(index)->m_descendantsAreContiguousInStackingOrderDirty = true;
|
| }
|
| }
|
|
|
| @@ -4683,7 +4698,7 @@ void RenderLayer::dirtyZOrderLists()
|
| m_negZOrderList->clear();
|
| m_zOrderListsDirty = true;
|
|
|
| - m_canBePromotedToStackingContainerDirty = true;
|
| + m_descendantsAreContiguousInStackingOrderDirty = true;
|
|
|
| if (!renderer()->documentBeingDestroyed()) {
|
| compositor()->setNeedsUpdateCompositingRequirementsState();
|
| @@ -4698,7 +4713,7 @@ void RenderLayer::dirtyStackingContainerZOrderLists()
|
| // 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_canBePromotedToStackingContainer for that sibling.
|
| + // m_descendantsAreContiguousInStackingOrder for that sibling.
|
| dirtySiblingStackingContextCanBePromotedToStackingContainer();
|
|
|
| RenderLayer* stackingContainer = this->ancestorStackingContainer();
|
|
|