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

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

Issue 20103002: Make composited scrolling codepaths co-operate. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: UMA + bug Created 7 years, 3 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') | Source/core/rendering/RenderLayerCompositor.cpp » ('j') | 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 5c9e098c33c79084c7bb6ecfbc2f89833f7a00a9..099b4a35e0a40a334a45f96fa724c91a235e6c26 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -131,9 +131,10 @@ 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_needsToBeStackingContainer(false)
, m_canBePromotedToStackingContainer(false)
, m_canBePromotedToStackingContainerDirty(true)
, m_isRootLayer(renderer->isRenderView())
@@ -477,6 +478,24 @@ bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const
return settings && settings->acceleratedCompositingForOverflowScrollEnabled();
}
+bool RenderLayer::useCompositorDrivenAcceleratedScrolling() const
Ian Vollick 2013/09/06 02:01:05 It looks like there's some repeated logic here in
hartmanng 2013/09/06 20:18:36 Yeah, I guess we can... I thought we needed it fro
+{
+ if (!compositorDrivenAcceleratedScrollingEnabled())
+ return false;
+
+ const RenderLayer* scrollingLayer = ancestorScrollingLayer();
+ if (!scrollingLayer || scrollingLayer->isStackingContainer())
+ return false;
+
+ if (scrollingLayer->m_canBePromotedToStackingContainerDirty) {
+ // We don't know if it's safe to promote to stacking container, and
+ // aren't in a position to find out, so we have to assume the worst.
+ return true;
+ }
+
+ return !scrollingLayer->needsToBeStackingContainer();
+}
+
// FIXME: This is a temporary flag and should be removed once accelerated
// overflow scroll is ready (crbug.com/254111).
bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const
@@ -2038,20 +2057,11 @@ bool RenderLayer::usesCompositedScrolling() const
return isComposited() && backing()->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:
@@ -2059,12 +2069,22 @@ 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);
}
bool RenderLayer::hasScrollParent() const
{
- if (!compositorDrivenAcceleratedScrollingEnabled())
+ if (!useCompositorDrivenAcceleratedScrolling())
return false;
// A layer scrolls with its containing block. So to find the overflow scrolling layer
@@ -2102,10 +2122,15 @@ void RenderLayer::updateNeedsCompositedScrolling()
updateDescendantDependentFlags();
ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->containsScrollableArea(scrollableArea()));
- bool needsCompositedScrolling = acceleratedCompositingForOverflowScrollEnabled()
+ const bool needsToBeStackingContainer = acceleratedCompositingForOverflowScrollEnabled()
&& canBeStackingContainer()
&& !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
@@ -2113,7 +2138,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_canBePromotedToStackingContainer for either us or our stacking context
+ // or container.
+ didUpdateNeedsCompositedScrolling();
+ }
}
enum CompositedScrollingHistogramBuckets {
@@ -2123,28 +2156,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;
@@ -2152,11 +2171,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)
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698