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.
This commit is contained in:
Kearwood (Kip) Gilbert
2014-04-25 15:29:56 -07:00
parent 1fdf17434b
commit 32b18f407b

View File

@@ -350,13 +350,20 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
// Move the frame // Move the frame
if (display->mPosition == NS_STYLE_POSITION_STICKY) { if (display->mPosition == NS_STYLE_POSITION_STICKY) {
// Update sticky positioning for an entire element at once when // Update sticky positioning for an entire element at once, starting with
// RecomputePosition is called with the first continuation in a chain. // the first continuation or ib-split sibling.
StickyScrollContainer::ComputeStickyOffsets(aFrame); // 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* ssc =
StickyScrollContainer::GetStickyScrollContainerForFrame(aFrame); StickyScrollContainer::GetStickyScrollContainerForFrame(firstContinuation);
if (ssc) { if (ssc) {
ssc->PositionContinuations(aFrame); ssc->PositionContinuations(firstContinuation);
} }
} else { } else {
MOZ_ASSERT(NS_STYLE_POSITION_RELATIVE == display->mPosition, MOZ_ASSERT(NS_STYLE_POSITION_RELATIVE == display->mPosition,