Bug 1100140 - When a scrollable layer is marked as fixed-position, don't treat it as fixed relative to itself. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 19 Nov 2014 13:41:48 -0500
changeset 216518 613266d6f6ecbf2a2ebd07f88ec4c841fb93324a
parent 216517 fd343a8b5cfedc263d0d611fbedc6716071a0983
child 216519 919f1447246549a8837674dff1c72fc4d02fe11c
push idunknown
push userunknown
push dateunknown
reviewersbotond
bugs1100140
milestone36.0a1
Bug 1100140 - When a scrollable layer is marked as fixed-position, don't treat it as fixed relative to itself. r=botond
gfx/layers/composite/AsyncCompositionManager.cpp
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -262,17 +262,20 @@ IntervalOverlap(gfxFloat aTranslation, g
 void
 AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
                                                    Layer* aTransformedSubtreeRoot,
                                                    FrameMetrics::ViewID aTransformScrollId,
                                                    const Matrix4x4& aPreviousTransformForRoot,
                                                    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;
   bool isFixedOrSticky = (isRootFixed || isStickyForSubtree);
 
   // We want to process all the fixed and sticky children of
   // aTransformedSubtreeRoot. Also, once we do encounter such a child, we don't
   // need to recurse any deeper because the fixed layers are relative to their