Index: Source/core/rendering/RenderLayer.cpp |
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
index b164a9e885109df4fcce68dc42a2b3b3f3c272dc..6176e54e9295e840154c4771423a979db7ed0fc4 100644 |
--- a/Source/core/rendering/RenderLayer.cpp |
+++ b/Source/core/rendering/RenderLayer.cpp |
@@ -134,6 +134,7 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
, m_hasUnclippedDescendant(false) |
, m_isUnclippedDescendant(false) |
, m_needsCompositedScrolling(false) |
+ , m_needsToBeStackingContainer(false) |
, m_canBePromotedToStackingContainer(false) |
, m_canBePromotedToStackingContainerDirty(true) |
, m_isRootLayer(renderer->isRenderView()) |
@@ -477,6 +478,26 @@ bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
return settings && settings->acceleratedCompositingForOverflowScrollEnabled(); |
} |
+bool RenderLayer::useCompositorDrivenAcceleratedScrolling() const |
+{ |
+ TRACE_EVENT0("comp-scroll", "RenderLayer::useCompositorDrivenAcceleratedScrolling"); |
Ian Vollick
2013/08/29 03:05:01
Can you ditch the printf-y trace events for now? I
hartmanng
2013/09/05 20:43:58
Done.
|
+ |
+ 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->canBeStackingContainer(); |
+} |
+ |
// FIXME: This is a temporary flag and should be removed once accelerated |
// overflow scroll is ready (crbug.com/254111). |
bool RenderLayer::compositorDrivenAcceleratedScrollingEnabled() const |
@@ -2053,15 +2074,6 @@ bool RenderLayer::usesCompositedScrolling() const |
bool RenderLayer::needsCompositedScrolling() const |
{ |
- if (!compositorDrivenAcceleratedScrollingEnabled()) |
- return needsToBeStackingContainer(); |
- if (FrameView* frameView = renderer()->view()->frameView()) |
- return frameView->containsScrollableArea(scrollableArea()); |
- return false; |
-} |
- |
-bool RenderLayer::needsToBeStackingContainer() const |
-{ |
switch (m_forceNeedsCompositedScrolling) { |
case DoNotForceCompositedScrolling: |
return m_needsCompositedScrolling; |
@@ -2075,6 +2087,21 @@ bool RenderLayer::needsToBeStackingContainer() const |
return m_needsCompositedScrolling; |
} |
+bool RenderLayer::needsToBeStackingContainer() const |
+{ |
Ian Vollick
2013/08/29 03:05:01
Repeating the switch is a bummer. Maybe we could h
hartmanng
2013/09/05 20:43:58
Done.
|
+ switch (m_forceNeedsCompositedScrolling) { |
+ case DoNotForceCompositedScrolling: |
+ return m_needsToBeStackingContainer; |
+ case CompositedScrollingAlwaysOn: |
+ return true; |
+ case CompositedScrollingAlwaysOff: |
+ return false; |
+ } |
+ |
+ ASSERT_NOT_REACHED(); |
+ return m_needsToBeStackingContainer; |
+} |
+ |
void RenderLayer::updateNeedsCompositedScrolling() |
{ |
TRACE_EVENT0("comp-scroll", "RenderLayer::updateNeedsCompositedScrolling"); |
@@ -2083,10 +2110,16 @@ void RenderLayer::updateNeedsCompositedScrolling() |
updateDescendantDependentFlags(); |
ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->containsScrollableArea(scrollableArea())); |
- bool needsCompositedScrolling = acceleratedCompositingForOverflowScrollEnabled() |
+ const bool needsToBeStackingContainer = acceleratedCompositingForOverflowScrollEnabled() |
&& canBeStackingContainer() |
&& !hasUnclippedDescendant(); |
+ setNeedsToBeStackingContainer(needsToBeStackingContainer); |
+ |
+ const bool needsCompositedScrolling = needsToBeStackingContainer |
+ || (compositorDrivenAcceleratedScrollingEnabled() |
+ && renderer()->view()->frameView()->containsScrollableArea(scrollableArea())); |
Ian Vollick
2013/08/29 03:05:01
We've already asserted that renderer()->view()->fr
hartmanng
2013/09/05 20:43:58
Done.
|
+ |
// 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 |