diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index e9bbfd941995..4d1c5b9b49be 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -267,7 +267,10 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, const Matrix4x4& aCurrentTransformForRoot, const LayerMargin& aFixedLayerMargins) { + // If aLayer == aTransformedSubtreeRoot, then treat aLayer as fixed relative + // to the ancestor scrollable layer rather than relative to itself. bool isRootFixed = aLayer->GetIsFixedPosition() && + aLayer != aTransformedSubtreeRoot && !aLayer->GetParent()->GetIsFixedPosition(); bool isStickyForSubtree = aLayer->GetIsStickyPosition() && aLayer->GetStickyScrollContainerId() == aTransformScrollId;