From cddf1ab18779ee3e1e752c19df7da6c0ffb14a44 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 10 May 2013 17:35:08 -0700 Subject: [PATCH] Bug 828312 patch 2: Make list renumbering code set NS_FRAME_HAS_DIRTY_CHILDREN correctly on intermediate blocks and inlines, and NS_FRAME_IS_DIRTY correctly on the bullets. r=bzbarsky The change to mark NS_FRAME_IS_DIRTY on the bullets fixes a failure in layout/reftests/bugs/418574-1.html exposed by patch 3. --- layout/generic/nsBlockFrame.cpp | 23 +++++++++++++++++++++-- layout/generic/nsContainerFrame.cpp | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 3e31004d48f4..b5bf32c1aebc 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -6660,6 +6660,15 @@ nsBlockFrame::RenumberListsInBlock(nsPresContext* aPresContext, } } while (bifLineIter.Next()); + // We need to set NS_FRAME_HAS_DIRTY_CHILDREN bits up the tree between + // the bullet and the caller of RenumberLists. But the caller itself + // has to be responsible for setting the bit itself, since that caller + // might be making a FrameNeedsReflow call, which requires that the + // bit not be set yet. + if (renumberedABullet && aDepth != 0) { + aBlockFrame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN); + } + return renumberedABullet; } @@ -6704,8 +6713,18 @@ nsBlockFrame::RenumberListsFor(nsPresContext* aPresContext, if (changed) { kidRenumberedABullet = true; - // The ordinal changed - mark the bullet frame dirty. - listItem->ChildIsDirty(bullet); + // The ordinal changed - mark the bullet frame, and any + // intermediate frames between it and the block (are there + // ever any?), dirty. + // The calling code will make the necessary FrameNeedsReflow + // call for the list ancestor. + bullet->AddStateBits(NS_FRAME_IS_DIRTY); + nsIFrame *f = bullet; + do { + nsIFrame *parent = f->GetParent(); + parent->ChildIsDirty(f); + f = parent; + } while (f != listItem); } } diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 81f9c41deae8..16bf2ad7354c 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -360,6 +360,8 @@ nsContainerFrame::BuildDisplayListForNonBlockChildren(nsDisplayListBuilder* aB /* virtual */ void nsContainerFrame::ChildIsDirty(nsIFrame* aChild) { + NS_ASSERTION(NS_SUBTREE_DIRTY(aChild), "child isn't actually dirty"); + AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN); }