From e604e45e4ec8c038a8fac948a6bce9e0b526c825 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 10 Oct 2006 14:44:34 +0000 Subject: [PATCH] Don't allow positioning or floating . Bug 355993, r=bernd, sr=rbs git-svn-id: svn://10.0.0.236/trunk@213426 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 27 +++++++++++++------ mozilla/layout/base/nsCSSFrameConstructor.h | 5 +++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index d0dabaecf68..d9417ca8d79 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -2835,7 +2835,7 @@ nsCSSFrameConstructor::CreatePseudoTableFrame(nsTableCreator& aTableCre nsFrameItems items; rv = ConstructTableFrame(aState, parentContent, parentFrame, childStyle, aTableCreator, - PR_TRUE, items, pseudoOuter.mFrame, + PR_TRUE, items, PR_TRUE, pseudoOuter.mFrame, pseudoInner.mFrame); if (NS_FAILED(rv)) return rv; @@ -3538,6 +3538,7 @@ nsCSSFrameConstructor::ConstructTableFrame(nsFrameConstructorState& aState, nsTableCreator& aTableCreator, PRBool aIsPseudo, nsFrameItems& aChildItems, + PRBool aAllowOutOfFlow, nsIFrame*& aNewOuterFrame, nsIFrame*& aNewInnerFrame) { @@ -3575,7 +3576,12 @@ nsCSSFrameConstructor::ConstructTableFrame(nsFrameConstructorState& aState, } const nsStyleDisplay* disp = outerStyleContext->GetStyleDisplay(); - nsIFrame* geometricParent = aState.GetGeometricParent(disp, parentFrame); + // We need the aAllowOutOfFlow thing for MathML. See bug 355993. + // Once bug 348577 is fixed, we should remove this code. At that + // point, the aAllowOutOfFlow arg can go away. + nsIFrame* geometricParent = + aAllowOutOfFlow ? aState.GetGeometricParent(disp, parentFrame) : + parentFrame; // Init the table outer frame and see if we need to create a view, e.g. // the frame is absolutely positioned @@ -3592,8 +3598,10 @@ nsCSSFrameConstructor::ConstructTableFrame(nsFrameConstructorState& aState, if (!aIsPseudo) { // Put the newly created frames into the right child list aNewOuterFrame->SetInitialChildList(nsnull, aNewInnerFrame); + rv = aState.AddChild(aNewOuterFrame, *frameItems, disp, aContent, - outerStyleContext, parentFrame); + outerStyleContext, parentFrame, aAllowOutOfFlow, + aAllowOutOfFlow); if (NS_FAILED(rv)) { return rv; } @@ -4193,7 +4201,7 @@ nsCSSFrameConstructor::TableProcessChild(nsFrameConstructorState& aState, rv = ConstructTableFrame(aState, aChildContent, aParentFrame, childStyleContext, aTableCreator, PR_FALSE, aChildItems, - childFrame, innerTableFrame); + PR_TRUE, childFrame, innerTableFrame); if (NS_SUCCEEDED(rv) && pageBreakAfter) { // Construct the page break after ConstructPageBreakFrame(aState, aChildContent, aParentFrame, @@ -6860,8 +6868,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta nsIFrame* innerTable; rv = ConstructTableFrame(aState, aContent, aParentFrame, aStyleContext, - *tableCreator, PR_FALSE, aFrameItems, newFrame, - innerTable); + *tableCreator, PR_FALSE, aFrameItems, PR_TRUE, + newFrame, innerTable); addedToFrameList = PR_TRUE; // Note: table construction function takes care of initializing // the frame, processing children, and setting the initial child @@ -7164,9 +7172,12 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsFrameConstructorState& aState, nsIFrame* outerTable; nsIFrame* innerTable; nsMathMLmtableCreator mathTableCreator(mPresShell); + // Pass PR_FALSE for aAllowOutOfFlow so that the resulting table will be + // guaranteed to be in-flow (and in particular, a descendant of the + // in the _frame_ tree). rv = ConstructTableFrame(aState, aContent, blockFrame, tableContext, - mathTableCreator, PR_FALSE, tempItems, outerTable, - innerTable); + mathTableCreator, PR_FALSE, tempItems, PR_FALSE, + outerTable, innerTable); // Note: table construction function takes care of initializing the frame, // processing children, and setting the initial child list diff --git a/mozilla/layout/base/nsCSSFrameConstructor.h b/mozilla/layout/base/nsCSSFrameConstructor.h index 9e8cfda7da3..fc2721fb840 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.h +++ b/mozilla/layout/base/nsCSSFrameConstructor.h @@ -286,7 +286,9 @@ private: * the child list of the outer frame, and will put any pseudo frames it had * to create into aChildItems. The newly-created outer frame will either be * in aChildItems or a descendant of a pseudo in aChildItems (unless it's - * positioned, in which case its placeholder will be in aChildItems). + * positioned or floated, in which case its placeholder will be in + * aChildItems). If aAllowOutOfFlow is false, the table frame will be forced + * to be in-flow no matter what its float or position values are. */ nsresult ConstructTableFrame(nsFrameConstructorState& aState, nsIContent* aContent, @@ -295,6 +297,7 @@ private: nsTableCreator& aTableCreator, PRBool aIsPseudo, nsFrameItems& aChildItems, + PRBool aAllowOutOfFlow, nsIFrame*& aNewOuterFrame, nsIFrame*& aNewInnerFrame);