From 32b18f407b3a68d3ecd50b51ab05ba3c28b7c5c4 Mon Sep 17 00:00:00 2001 From: "Kearwood (Kip) Gilbert" Date: Fri, 25 Apr 2014 15:29:56 -0700 Subject: [PATCH] Bug 926728 - Only pass the first continuation or or-split-sibling of the sticky element to StickyScrollContainer::PositionContinuation. r=dbaron, r=corey - RestyleManager::RecomputePosition now calls StickyScrollContainer::PositionContinuation with the first continuation or ib-split-sibling of the passed frame, as PositionContinuations will update all continuations at once, and expects the first continuation to be passed in. --- layout/base/RestyleManager.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index f4ec5b32554e..db6cd8a16756 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -350,13 +350,20 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame) // Move the frame if (display->mPosition == NS_STYLE_POSITION_STICKY) { - // Update sticky positioning for an entire element at once when - // RecomputePosition is called with the first continuation in a chain. - StickyScrollContainer::ComputeStickyOffsets(aFrame); + // Update sticky positioning for an entire element at once, starting with + // the first continuation or ib-split sibling. + // It's rare that the frame we already have isn't already the first + // continuation or ib-split sibling, but it can happen when styles differ + // across continuations such as ::first-line or ::first-letter, and in + // those cases we will generally (but maybe not always) do the work twice. + nsIFrame *firstContinuation = + nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame); + + StickyScrollContainer::ComputeStickyOffsets(firstContinuation); StickyScrollContainer* ssc = - StickyScrollContainer::GetStickyScrollContainerForFrame(aFrame); + StickyScrollContainer::GetStickyScrollContainerForFrame(firstContinuation); if (ssc) { - ssc->PositionContinuations(aFrame); + ssc->PositionContinuations(firstContinuation); } } else { MOZ_ASSERT(NS_STYLE_POSITION_RELATIVE == display->mPosition,