From b6b950f3703eadc604fe1986e2eb0fe6160778ca Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 11 Jun 2009 13:09:35 -0400 Subject: [PATCH] Bug 495350. Do a better job of keeping track of our line participant count. r+sr=roc --- layout/base/crashtests/495350-1.html | 9 +++++++++ layout/base/crashtests/crashtests.list | 1 + layout/base/nsCSSFrameConstructor.cpp | 13 ++++++++++--- layout/base/nsCSSFrameConstructor.h | 5 ++++- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 layout/base/crashtests/495350-1.html diff --git a/layout/base/crashtests/495350-1.html b/layout/base/crashtests/495350-1.html new file mode 100644 index 000000000000..ccab5b373182 --- /dev/null +++ b/layout/base/crashtests/495350-1.html @@ -0,0 +1,9 @@ + + + + +
+
+
+ + \ No newline at end of file diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 1e49a1ae5a29..a0f079eef936 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -237,3 +237,4 @@ load 490747.html load 492014.xhtml load 492112-1.xhtml load 492163-1.xhtml +load 495350-1.html diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 52fa02d32642..f238b92f2d42 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5421,7 +5421,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState // it's conservative in the sense that anything that will really end up // as an in-flow non-inline will have false mIsAllInline. It just might // be that even an inline that has mIsAllInline false doesn't need an - // {ib} split. So this is just an optimization to keep from doint to + // {ib} split. So this is just an optimization to keep from doing too // much work when that happens. (!(bits & FCDATA_DISALLOW_OUT_OF_FLOW) && aState.GetGeometricParent(display, nsnull)) || @@ -5433,7 +5433,14 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState aItems.InlineItemAdded(); } - if (bits & FCDATA_IS_LINE_PARTICIPANT) { + // Our item should be treated as a line participant if we have the relevant + // bit and are going to be in-flow. Note that this really only matters if + // our ancestor is a box or some such, so the fact that we might have an + // inline ancestor that might become a containing block is not relevant here. + if ((bits & FCDATA_IS_LINE_PARTICIPANT) && + ((bits & FCDATA_DISALLOW_OUT_OF_FLOW) || + !aState.GetGeometricParent(display, nsnull))) { + item->mIsLineParticipant = PR_TRUE; aItems.LineParticipantItemAdded(); } } @@ -11550,7 +11557,7 @@ AdjustCountsForItem(FrameConstructionItem* aItem, PRInt32 aDelta) if (aItem->mIsAllInline) { mInlineCount += aDelta; } - if (aItem->mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) { + if (aItem->mIsLineParticipant) { mLineParticipantCount += aDelta; } mDesiredParentCounts[aItem->DesiredParentType()] += aDelta; diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 48ffe82479a3..8ab44da08833 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -841,7 +841,8 @@ private: mNameSpaceID(aNameSpaceID), mStyleContext(aStyleContext), mIsText(PR_FALSE), mIsGeneratedContent(PR_FALSE), mIsRootPopupgroup(PR_FALSE), mIsAllInline(PR_FALSE), - mHasInlineEnds(PR_FALSE), mIsPopup(PR_FALSE) + mHasInlineEnds(PR_FALSE), mIsPopup(PR_FALSE), + mIsLineParticipant(PR_FALSE) {} ~FrameConstructionItem() { if (mIsGeneratedContent) { @@ -887,6 +888,8 @@ private: // Whether construction from this item will create a popup that needs to // go into the global popup items. PRPackedBool mIsPopup; + // Whether this item should be treated as a line participant + PRPackedBool mIsLineParticipant; // Child frame construction items. FrameConstructionItemList mChildItems;