From 84649fa33f14f02f32984766ec2030e63983c528 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Sun, 20 Sep 2015 18:28:18 +0200 Subject: [PATCH] Bug 1195400 - Check ancestor geometry roots when determining scrollability of a layer. r=mattwoodrow --- layout/base/FrameLayerBuilder.cpp | 36 ++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 78ff5618c4e..af833bf8474 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2097,18 +2097,30 @@ ContainerState::GetLayerCreationHint(const nsIFrame* aAnimatedGeometryRoot) if (mParameters.mInLowPrecisionDisplayPort) { return LayerManager::SCROLLABLE; } - nsIFrame* animatedGeometryRootParent = aAnimatedGeometryRoot->GetParent(); - nsIScrollableFrame* scrollable = do_QueryFrame(animatedGeometryRootParent); - if (scrollable -#ifdef MOZ_B2G - && scrollable->WantAsyncScroll() -#endif - ) { - // WantAsyncScroll() returns false when the frame has overflow:hidden, - // so we won't create tiled layers for overflow:hidden frames even if - // they have a display port. The main purpose of the WantAsyncScroll check - // is to allow the B2G camera app to use hardware composer for compositing. - return LayerManager::SCROLLABLE; + + // Check whether there's any active scroll frame on the animated geometry + // root chain. + nsIFrame* fParent; + for (const nsIFrame* f = aAnimatedGeometryRoot; + f != mContainerAnimatedGeometryRoot; + f = nsLayoutUtils::GetAnimatedGeometryRootForFrame(mBuilder, + fParent, mContainerAnimatedGeometryRoot)) { + fParent = nsLayoutUtils::GetCrossDocParentFrame(f); + if (!fParent) { + break; + } + nsIScrollableFrame* scrollable = do_QueryFrame(fParent); + if (scrollable + #ifdef MOZ_B2G + && scrollable->WantAsyncScroll() + #endif + ) { + // WantAsyncScroll() returns false when the frame has overflow:hidden, + // so we won't create tiled layers for overflow:hidden frames even if + // they have a display port. The main purpose of the WantAsyncScroll check + // is to allow the B2G camera app to use hardware composer for compositing. + return LayerManager::SCROLLABLE; + } } return LayerManager::NONE; }