From b5e8dbc2d6a15dd53f23f400cde10677af38bcda Mon Sep 17 00:00:00 2001 From: "rbs%maths.uq.edu.au" Date: Sat, 16 Feb 2002 02:48:10 +0000 Subject: [PATCH] Fix bug 125404 - hang on certain mathml pages. The table code relies on the display propertyto build its frames and things went out of sync when just using MathML tag names without the display associations in mathml.css. r=karnaze, sr=attinasi --- layout/base/nsCSSFrameConstructor.cpp | 33 +++++++------------ .../html/style/src/nsCSSFrameConstructor.cpp | 33 +++++++------------ 2 files changed, 24 insertions(+), 42 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 98805946d0c..9c699d5cf8d 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -6503,6 +6503,10 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, nsIStyleContext* aStyleContext, nsFrameItems& aFrameItems) { + // Make sure that we remain confined in the MathML world + if (aNameSpaceID != nsMathMLAtoms::nameSpaceID) + return NS_OK; + PRBool processChildren = PR_TRUE; // Whether we should process child content. // MathML frames are inline frames. // processChildren = PR_TRUE for inline frames. @@ -6515,10 +6519,6 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, PRBool isReplaced = PR_FALSE; PRBool ignoreInterTagWhitespace = PR_TRUE; - // Make sure that we remain confined in the MathML world - if (aNameSpaceID != nsMathMLAtoms::nameSpaceID) - return NS_OK; - NS_ASSERTION(aTag != nsnull, "null MathML tag"); if (aTag == nsnull) return NS_OK; @@ -6583,7 +6583,8 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, aTag == nsMathMLAtoms::mprescripts_ ) rv = NS_NewMathMLmrowFrame(aPresShell, &newFrame); // CONSTRUCTION of MTABLE elements - else if (aTag == nsMathMLAtoms::mtable_) { + else if (aTag == nsMathMLAtoms::mtable_ && + disp->mDisplay == NS_STYLE_DISPLAY_TABLE) { // is an inline-table -- but this isn't yet supported. // What we do here is to wrap the table in an anonymous containing // block so that it can mix better with other surrounding MathML markups @@ -6601,8 +6602,6 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, getter_AddRefs(mrowContext)); InitAndRestoreFrame(aPresContext, aState, aContent, aParentFrame, mrowContext, nsnull, newFrame); - // add it to the flow - aFrameItems.AddChild(newFrame); // then, create a block frame that will wrap the table frame nsIFrame* blockFrame; @@ -6615,8 +6614,6 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, getter_AddRefs(blockContext)); InitAndRestoreFrame(aPresContext, aState, aContent, newFrame, blockContext, nsnull, blockFrame); - // set the block frame as the initial child of the mrow frame - newFrame->SetInitialChildList(aPresContext, nsnull, blockFrame); // then, create the table frame itself nsCOMPtr tableContext; @@ -6636,19 +6633,13 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, // set the outerTable as the initial child of the anonymous block blockFrame->SetInitialChildList(aPresContext, nsnull, outerTable); - return rv; - } - else if (aTag == nsMathMLAtoms::mtd_) { - nsIFrame* innerCell; - PRBool pseudoParent; - nsMathMLmtableCreator mathTableCreator(aPresShell); - rv = ConstructTableCellFrame(aPresShell, aPresContext, aState, aContent, - aParentFrame, aStyleContext, mathTableCreator, - PR_FALSE, aFrameItems, newFrame, innerCell, pseudoParent); - if (!pseudoParent) { + // set the block frame as the initial child of the mrow frame + newFrame->SetInitialChildList(aPresContext, nsnull, blockFrame); + + // add the new frame to the flow aFrameItems.AddChild(newFrame); - } - return rv; + + return rv; } // End CONSTRUCTION of MTABLE elements diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 98805946d0c..9c699d5cf8d 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -6503,6 +6503,10 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, nsIStyleContext* aStyleContext, nsFrameItems& aFrameItems) { + // Make sure that we remain confined in the MathML world + if (aNameSpaceID != nsMathMLAtoms::nameSpaceID) + return NS_OK; + PRBool processChildren = PR_TRUE; // Whether we should process child content. // MathML frames are inline frames. // processChildren = PR_TRUE for inline frames. @@ -6515,10 +6519,6 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, PRBool isReplaced = PR_FALSE; PRBool ignoreInterTagWhitespace = PR_TRUE; - // Make sure that we remain confined in the MathML world - if (aNameSpaceID != nsMathMLAtoms::nameSpaceID) - return NS_OK; - NS_ASSERTION(aTag != nsnull, "null MathML tag"); if (aTag == nsnull) return NS_OK; @@ -6583,7 +6583,8 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, aTag == nsMathMLAtoms::mprescripts_ ) rv = NS_NewMathMLmrowFrame(aPresShell, &newFrame); // CONSTRUCTION of MTABLE elements - else if (aTag == nsMathMLAtoms::mtable_) { + else if (aTag == nsMathMLAtoms::mtable_ && + disp->mDisplay == NS_STYLE_DISPLAY_TABLE) { // is an inline-table -- but this isn't yet supported. // What we do here is to wrap the table in an anonymous containing // block so that it can mix better with other surrounding MathML markups @@ -6601,8 +6602,6 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, getter_AddRefs(mrowContext)); InitAndRestoreFrame(aPresContext, aState, aContent, aParentFrame, mrowContext, nsnull, newFrame); - // add it to the flow - aFrameItems.AddChild(newFrame); // then, create a block frame that will wrap the table frame nsIFrame* blockFrame; @@ -6615,8 +6614,6 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, getter_AddRefs(blockContext)); InitAndRestoreFrame(aPresContext, aState, aContent, newFrame, blockContext, nsnull, blockFrame); - // set the block frame as the initial child of the mrow frame - newFrame->SetInitialChildList(aPresContext, nsnull, blockFrame); // then, create the table frame itself nsCOMPtr tableContext; @@ -6636,19 +6633,13 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, // set the outerTable as the initial child of the anonymous block blockFrame->SetInitialChildList(aPresContext, nsnull, outerTable); - return rv; - } - else if (aTag == nsMathMLAtoms::mtd_) { - nsIFrame* innerCell; - PRBool pseudoParent; - nsMathMLmtableCreator mathTableCreator(aPresShell); - rv = ConstructTableCellFrame(aPresShell, aPresContext, aState, aContent, - aParentFrame, aStyleContext, mathTableCreator, - PR_FALSE, aFrameItems, newFrame, innerCell, pseudoParent); - if (!pseudoParent) { + // set the block frame as the initial child of the mrow frame + newFrame->SetInitialChildList(aPresContext, nsnull, blockFrame); + + // add the new frame to the flow aFrameItems.AddChild(newFrame); - } - return rv; + + return rv; } // End CONSTRUCTION of MTABLE elements