From 0578f2967b5a9d1c44134be63f8f93ecd646c28a Mon Sep 17 00:00:00 2001 From: "bzbarsky@mit.edu" Date: Wed, 10 Oct 2007 21:36:48 -0700 Subject: [PATCH] Don't allow first-letter on the block inside a mathml table cell. Bug 398510, r+sr+a=roc --- layout/base/nsCSSFrameConstructor.cpp | 22 ++++++++++++++++------ layout/generic/nsBlockFrame.cpp | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 1efa4daccd9d..a189bf20e281 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -4013,12 +4013,18 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsFrameConstructorState& aState, nsCSSAnonBoxes::cellContent, aStyleContext); // Create a block frame that will format the cell's content + PRBool isBlock; #ifdef MOZ_MATHML - if (kNameSpaceID_MathML == aNameSpaceID) + if (kNameSpaceID_MathML == aNameSpaceID) { aNewCellInnerFrame = NS_NewMathMLmtdInnerFrame(mPresShell, innerPseudoStyle); + isBlock = PR_FALSE; + } else #endif + { aNewCellInnerFrame = NS_NewTableCellInnerFrame(mPresShell, innerPseudoStyle); + isBlock = PR_TRUE; + } if (NS_UNLIKELY(!aNewCellInnerFrame)) { @@ -4031,18 +4037,22 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsFrameConstructorState& aState, if (!aIsPseudo) { PRBool haveFirstLetterStyle, haveFirstLineStyle; - ShouldHaveSpecialBlockStyle(aContent, aStyleContext, - &haveFirstLetterStyle, &haveFirstLineStyle); + if (isBlock) { + ShouldHaveSpecialBlockStyle(aContent, aStyleContext, + &haveFirstLetterStyle, &haveFirstLineStyle); + } // The block frame is a float container nsFrameConstructorSaveState floatSaveState; - aState.PushFloatContainingBlock(aNewCellInnerFrame, floatSaveState, - haveFirstLetterStyle, haveFirstLineStyle); + if (isBlock) { + aState.PushFloatContainingBlock(aNewCellInnerFrame, floatSaveState, + haveFirstLetterStyle, haveFirstLineStyle); + } // Process the child content nsFrameItems childItems; rv = ProcessChildren(aState, aContent, aNewCellInnerFrame, - PR_TRUE, childItems, PR_TRUE); + PR_TRUE, childItems, PR_FALSE); if (NS_FAILED(rv)) { // Clean up diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index f109d7ab8850..850dd74406d3 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -6290,6 +6290,7 @@ nsBlockFrame::SetInitialChildList(nsIAtom* aListName, pseudo == nsCSSAnonBoxes::fieldsetContent || pseudo == nsCSSAnonBoxes::scrolledContent || pseudo == nsCSSAnonBoxes::columnContent) && + !IsFrameOfType(eMathML) && nsRefPtr(GetFirstLetterStyle(presContext)) != nsnull; NS_ASSERTION(haveFirstLetterStyle == ((mState & NS_BLOCK_HAS_FIRST_LETTER_STYLE) != 0),