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 d33541dea1
commit 32f64d3ccb

View File

@ -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,