From f616596d4121e43aa8b6dfa99aac0a2309b2d006 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Thu, 2 Apr 2015 14:28:42 -0400 Subject: [PATCH] Bug 1148022 - When frame metrics are attached to the container layer of the root scroll frame, make sure that its scroll frame is active. r=tn --- layout/generic/nsGfxScrollFrame.cpp | 11 ++++++++++- layout/generic/nsGfxScrollFrame.h | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 2a66c8e56b1..dd4c761c80e 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1937,6 +1937,7 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter, , mHasBeenScrolledRecently(false) , mCollapsedResizer(false) , mShouldBuildScrollableLayer(false) + , mIsScrollableLayerInRootContainer(false) , mHasBeenScrolled(false) , mIsResolutionSet(false) , mIgnoreMomentumScroll(false) @@ -2940,6 +2941,14 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder, // adjusted by the APZC automatically. bool usingDisplayPort = aBuilder->IsPaintingToWindow() && nsLayoutUtils::GetDisplayPort(mOuter->GetContent()); + + if (usingDisplayPort) { + // There is a display port for this frame, so we want to appear as having + // active scrolling, so that animated geometry roots are assigned correctly. + mShouldBuildScrollableLayer = true; + mIsScrollableLayerInRootContainer = true; + } + bool addScrollBars = mIsRoot && usingDisplayPort && !aBuilder->IsForEventDelivery(); if (addScrollBars) { @@ -3221,7 +3230,7 @@ ScrollFrameHelper::ComputeFrameMetrics(Layer* aLayer, *aClipRect = scrollport; } - if (!mShouldBuildScrollableLayer) { + if (!mShouldBuildScrollableLayer || mIsScrollableLayerInRootContainer) { return; } diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 26ce5b8b2b7..a0cc47d6f09 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -500,6 +500,12 @@ public: // scrollable layer. Used for asynchronous scrolling. bool mShouldBuildScrollableLayer:1; + // Whether we are the root scroll frame that is used for containerful + // scrolling with a display port. If true, the scrollable frame + // shouldn't attach frame metrics to its layers because the container + // will already have the necessary frame metrics. + bool mIsScrollableLayerInRootContainer:1; + // If true, add clipping in ScrollFrameHelper::ComputeFrameMetrics. bool mAddClipRectToLayer:1;