From d69b71e3290bd67257a6a39fc085a0666e7f7dcf Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Wed, 30 Dec 2015 23:00:47 -0600 Subject: [PATCH] Bug 1235696. The animated geometry root of a transfromed and sticky pos frame should be the frame itself. r=mattwoodrow Both sticky pos and transforms make a frame into an AGR. The transform item is nested inside the sticky pos item, so it should have the same AGR as the sticky pos item. --- layout/base/nsDisplayList.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index a4f52875a768..10d04db34ff9 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1062,6 +1062,9 @@ IsStickyFrameActive(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsIFrame* // Find the nearest scrollframe. nsIFrame* cursor = aFrame; nsIFrame* parent = aParent; + if (!parent) { + parent = nsLayoutUtils::GetCrossDocParentFrame(aFrame); + } while (parent->GetType() != nsGkAtoms::scrollFrame) { cursor = parent; if ((parent = nsLayoutUtils::GetCrossDocParentFrame(cursor)) == nullptr) { @@ -4952,6 +4955,12 @@ nsDisplayTransform::SetReferenceFrameToAncestor(nsDisplayListBuilder* aBuilder) // determine if we are inside a fixed pos subtree. If we use the outer AGR // from outside the fixed pos subtree FLB can't tell that we are fixed pos. mAnimatedGeometryRoot = mAnimatedGeometryRootForChildren; + } else if (mFrame->StyleDisplay()->mPosition == NS_STYLE_POSITION_STICKY && + IsStickyFrameActive(aBuilder, mFrame, nullptr)) { + // Similar to the IsFixedPosFrameInDisplayPort case we are our own AGR. + // We are inside the sticky position, so our AGR is the sticky positioned + // frame, which is our AGR, not the parent AGR. + mAnimatedGeometryRoot = mAnimatedGeometryRootForChildren; } else if (mAnimatedGeometryRoot->mParentAGR) { mAnimatedGeometryRoot = mAnimatedGeometryRoot->mParentAGR; }