From 54adf0f5355143292a0a7c91565e875b57da319d Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Mon, 25 Sep 2006 22:33:01 +0000 Subject: [PATCH] Fix bug 354144 -- absolute positioning against the ICB is broken. r+sr=roc git-svn-id: svn://10.0.0.236/trunk@212339 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 9 +++++++-- mozilla/layout/base/nsCSSFrameConstructor.h | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 4e57dd67b6c..bb19c5febd8 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -1946,6 +1946,7 @@ nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument *aDocument, , mUpdateCount(0) , mQuotesDirty(PR_FALSE) , mCountersDirty(PR_FALSE) + , mInitialContainingBlockIsAbsPosContainer(PR_FALSE) { if (!gGotXBLFormPrefs) { gGotXBLFormPrefs = PR_TRUE; @@ -4643,6 +4644,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsFrameConstructorState& aState, *aNewFrame = contentFrame; mInitialContainingBlock = contentFrame; + mInitialContainingBlockIsAbsPosContainer = PR_FALSE; // if it was a table then we don't need to process our children. if (!docElemIsTable) { @@ -4655,6 +4657,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsFrameConstructorState& aState, PRBool haveFirstLetterStyle, haveFirstLineStyle; HaveSpecialBlockStyle(aDocElement, styleContext, &haveFirstLetterStyle, &haveFirstLineStyle); + mInitialContainingBlockIsAbsPosContainer = PR_TRUE; aState.PushAbsoluteContainingBlock(contentFrame, absoluteSaveState); aState.PushFloatContainingBlock(contentFrame, floatSaveState, haveFirstLetterStyle, @@ -8332,8 +8335,9 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIFrame* aFrame) return AdjustAbsoluteContainingBlock(mPresShell->GetPresContext(), containingBlock); - // If we didn't find it, then there isn't one. - return nsnull; + // If we didn't find it, then use the initial containing block if it + // supports abs pos kids. + return mInitialContainingBlockIsAbsPosContainer ? mInitialContainingBlock : nsnull; } nsIFrame* @@ -10075,6 +10079,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer, if (mInitialContainingBlock == childFrame) { mInitialContainingBlock = nsnull; + mInitialContainingBlockIsAbsPosContainer = PR_FALSE; } if (haveFLS && mInitialContainingBlock) { diff --git a/mozilla/layout/base/nsCSSFrameConstructor.h b/mozilla/layout/base/nsCSSFrameConstructor.h index 00c3d9f114f..7f3827634b4 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.h +++ b/mozilla/layout/base/nsCSSFrameConstructor.h @@ -1051,8 +1051,9 @@ private: nsQuoteList mQuoteList; nsCounterManager mCounterManager; PRUint16 mUpdateCount; - PRPackedBool mQuotesDirty; - PRPackedBool mCountersDirty; + PRPackedBool mQuotesDirty : 1; + PRPackedBool mCountersDirty : 1; + PRPackedBool mInitialContainingBlockIsAbsPosContainer : 1; nsRevocableEventPtr mRestyleEvent;