From 9123b70f1785bed166b1b90b68ac6f173e0a1cd0 Mon Sep 17 00:00:00 2001 From: Chris Lord Date: Wed, 15 Jan 2014 12:15:50 +0000 Subject: [PATCH] Bug 950993 - Fix async scrolling of fixed layers within scrollable sub-layers. r=roc Fixed layers are relative to their nearest scrollable ancestor, so when we encounter a scrollable layer in AlignFixedAndStickyLayers, reset the transform and sub-tree root to start from that scrollable layer. This fixes async scrolling of the fixed header in the Firefox marketplace on B2G. --- gfx/layers/composite/AsyncCompositionManager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 6cbb354ad29f..4ec126a5d4cb 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -326,6 +326,16 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, return; } + // Fixed layers are relative to their nearest scrollable layer, so when we + // encounter a scrollable layer, reset the transform to that layer and remove + // the fixed margins. + if (aLayer->AsContainerLayer() && + aLayer->AsContainerLayer()->GetFrameMetrics().IsScrollable() && + aLayer != aTransformedSubtreeRoot) { + AlignFixedAndStickyLayers(aLayer, aLayer, aLayer->GetTransform(), LayerMargin(0, 0, 0, 0)); + return; + } + for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) { AlignFixedAndStickyLayers(child, aTransformedSubtreeRoot,