Frames from dynamic MathML table children are not made with the right creator, b=348153, r+sr=bzbarsky

This commit is contained in:
rbs%maths.uq.edu.au 2006-08-14 07:44:13 +00:00
Родитель e18f6d285a
Коммит 5fe07a307d
3 изменённых файлов: 62 добавлений и 11 удалений

Просмотреть файл

@ -3546,8 +3546,14 @@ nsCSSFrameConstructor::AdjustParentFrame(nsFrameConstructorState& aState,
// Also need to create a pseudo-parent if the child is going to end up
// with a frame based on something other than display.
IsSpecialContent(aChildContent, aTag, aNameSpaceID, aChildStyle))) {
nsTableCreator tableCreator(aState.mPresShell);
nsresult rv = GetPseudoCellFrame(tableCreator, aState, *aParentFrame);
nsTableCreator theTableCreator(aState.mPresShell);
nsTableCreator* tableCreator = &theTableCreator;
#ifdef MOZ_MATHML
nsMathMLmtableCreator mtableCreator(aState.mPresShell);
if (aNameSpaceID == kNameSpaceID_MathML)
tableCreator = &mtableCreator;
#endif
nsresult rv = GetPseudoCellFrame(*tableCreator, aState, *aParentFrame);
if (NS_FAILED(rv)) {
return rv;
}
@ -6737,7 +6743,6 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
{
PRBool primaryFrameSet = PR_FALSE;
nsIFrame* newFrame = nsnull; // the frame we construct
nsTableCreator tableCreator(mPresShell); // Used to make table frames.
PRBool addToHashTable = PR_TRUE;
PRBool addedToFrameList = PR_FALSE;
nsresult rv = NS_OK;
@ -6922,6 +6927,15 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
// XXX This section now only handles table frames; should be
// factored out probably
// Used to make table frames.
nsTableCreator theTableCreator(mPresShell);
nsTableCreator* tableCreator = &theTableCreator;
#ifdef MOZ_MATHML
nsMathMLmtableCreator mtableCreator(mPresShell);
if (aNameSpaceID == kNameSpaceID_MathML)
tableCreator = &mtableCreator;
#endif
// Use the 'display' property to choose a frame type
switch (aDisplay->mDisplay) {
case NS_STYLE_DISPLAY_TABLE:
@ -6934,7 +6948,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
nsIFrame* innerTable;
rv = ConstructTableFrame(aState, aContent,
aParentFrame, aStyleContext,
tableCreator, PR_FALSE, aFrameItems, newFrame,
*tableCreator, PR_FALSE, aFrameItems, newFrame,
innerTable);
addedToFrameList = PR_TRUE;
// Note: table construction function takes care of initializing
@ -6957,7 +6971,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
}
}
rv = ConstructTableCaptionFrame(aState, aContent, parentFrame,
aStyleContext, tableCreator, aFrameItems,
aStyleContext, *tableCreator, aFrameItems,
newFrame, aHasPseudoParent);
if (NS_SUCCEEDED(rv) && !aHasPseudoParent) {
aFrameItems.AddChild(newFrame);
@ -6969,7 +6983,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
case NS_STYLE_DISPLAY_TABLE_HEADER_GROUP:
case NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP:
rv = ConstructTableRowGroupFrame(aState, aContent,
aParentFrame, aStyleContext, tableCreator,
aParentFrame, aStyleContext, *tableCreator,
PR_FALSE, aFrameItems, newFrame, aHasPseudoParent);
if (NS_SUCCEEDED(rv) && !aHasPseudoParent) {
aFrameItems.AddChild(newFrame);
@ -6978,7 +6992,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
case NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP:
rv = ConstructTableColGroupFrame(aState, aContent, aParentFrame,
aStyleContext, tableCreator,
aStyleContext, *tableCreator,
PR_FALSE, aFrameItems, newFrame,
aHasPseudoParent);
if (NS_SUCCEEDED(rv) && !aHasPseudoParent) {
@ -6988,7 +7002,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
case NS_STYLE_DISPLAY_TABLE_COLUMN:
rv = ConstructTableColFrame(aState, aContent, aParentFrame,
aStyleContext, tableCreator, PR_FALSE,
aStyleContext, *tableCreator, PR_FALSE,
aFrameItems, newFrame, aHasPseudoParent);
if (NS_SUCCEEDED(rv) && !aHasPseudoParent) {
aFrameItems.AddChild(newFrame);
@ -6997,7 +7011,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
case NS_STYLE_DISPLAY_TABLE_ROW:
rv = ConstructTableRowFrame(aState, aContent, aParentFrame,
aStyleContext, tableCreator, PR_FALSE,
aStyleContext, *tableCreator, PR_FALSE,
aFrameItems, newFrame, aHasPseudoParent);
if (NS_SUCCEEDED(rv) && !aHasPseudoParent) {
aFrameItems.AddChild(newFrame);
@ -7008,7 +7022,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsFrameConstructorState& aSta
{
nsIFrame* innerTable;
rv = ConstructTableCellFrame(aState, aContent, aParentFrame,
aStyleContext, tableCreator,
aStyleContext, *tableCreator,
PR_FALSE, aFrameItems, newFrame,
innerTable, aHasPseudoParent);
if (NS_SUCCEEDED(rv) && !aHasPseudoParent) {
@ -7202,7 +7216,8 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsFrameConstructorState& aState,
// <mtable> 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
// XXXbz this is wrong if the <mtable> is positioned or floated.
// This assumes that the <mtable> is not positioned or floated.
// (MathML does not allow/support positioned or floated elements at all.)
nsStyleContext* parentContext = aParentFrame->GetStyleContext();
nsStyleSet *styleSet = mPresShell->StyleSet();

Просмотреть файл

@ -434,12 +434,45 @@ nsMathMLmtableOuterFrame::GetRowFrameAt(nsPresContext* aPresContext,
return nsnull;
}
#ifdef NS_DEBUG
void
nsMathMLmtableOuterFrame::DEBUG_VerifyTableRelatedFrames()
{
PRInt32 rowCount, colCount;
GetTableSize(rowCount, colCount);
nsTableIteration dir = eTableLTR;
nsIFrame* innerTableFrame = mFrames.FirstChild();
nsTableIterator rowgroupIter(*innerTableFrame, dir);
nsIFrame* rowgroupFrame = rowgroupIter.First();
for ( ; rowgroupFrame; rowgroupFrame = rowgroupIter.Next()) {
nsTableIterator rowIter(*rowgroupFrame, dir);
nsIFrame* rowFrame = rowIter.First();
for ( ; rowFrame; rowFrame = rowIter.Next()) {
DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TABLE_ROW);
//XXX uncomment this if <mtr> ever gets its own MathML frame implementation
//NS_ASSERTION(rowFrame->IsFrameOfType(nsIFrame::eMathML),
// "non MathML row frame");
nsTableIterator cellIter(*rowFrame, dir);
nsIFrame* cellFrame = cellIter.First();
for ( ; cellFrame; cellFrame = cellIter.Next()) {
DEBUG_VERIFY_THAT_FRAME_IS(cellFrame, TABLE_CELL);
NS_ASSERTION(cellFrame->IsFrameOfType(nsIFrame::eMathML),
"non MathML cell frame");
}
}
}
}
#endif
NS_IMETHODIMP
nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
#ifdef NS_DEBUG
DEBUG_VerifyTableRelatedFrames();
#endif
nsresult rv;
nsAutoString value;
// we want to return a table that is anchored according to the align attribute

Просмотреть файл

@ -92,6 +92,9 @@ public:
virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
#ifdef NS_DEBUG
void DEBUG_VerifyTableRelatedFrames();
#endif
protected:
nsMathMLmtableOuterFrame(nsStyleContext* aContext) : nsTableOuterFrame(aContext) {}
virtual ~nsMathMLmtableOuterFrame();