Bug 459363 - Fix computation of intrinsic width for <mspace> and <mpadded> elements. r=karlt

This commit is contained in:
Frédéric Wang 2012-11-29 17:52:02 -05:00
parent 9240046253
commit 250b89bc6a
12 changed files with 137 additions and 36 deletions

View File

@ -444,3 +444,11 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
return NS_OK;
}
/* virtual */ nsresult
nsMathMLmpaddedFrame::MeasureForWidth(nsRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize)
{
ProcessAttributes();
return Place(aRenderingContext, false, aDesiredSize);
}

View File

@ -45,6 +45,10 @@ protected:
virtual int GetSkipSides() const { return 0; }
virtual nsresult
MeasureForWidth(nsRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
private:
nsCSSValue mWidth;
nsCSSValue mHeight;

View File

@ -125,3 +125,15 @@ nsMathMLmspaceFrame::Reflow(nsPresContext* aPresContext,
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
}
/* virtual */ nsresult
nsMathMLmspaceFrame::MeasureForWidth(nsRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize)
{
ProcessAttributes(PresContext());
mBoundingMetrics = nsBoundingMetrics();
mBoundingMetrics.width = NS_MAX(0, mWidth);
aDesiredSize.width = mBoundingMetrics.width;
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
return NS_OK;
}

View File

@ -42,6 +42,10 @@ protected:
virtual int GetSkipSides() const { return 0; }
virtual nsresult
MeasureForWidth(nsRenderingContext& aRenderingContext,
nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
private:
nscoord mWidth;
nscoord mHeight;

View File

@ -73,7 +73,7 @@
<mspace width="20px" height="20px" mathbackground="yellow"/>
<mspace width="20px" height="20px" mathbackground="grey"/>
</munderover>
</math>
</math><br/>
<!-- mfrac (bevelled=true) -->
<math dir="rtl">
<mstyle mathcolor="white">
@ -91,7 +91,7 @@
<mspace width="20px" height="20px"/>
</mroot>
</mstyle>
</math>
</math><br/>
<!-- msqrt -->
<math dir="rtl">
<mstyle mathcolor="white">

View File

@ -9,35 +9,35 @@
</tr>
<tr>
<td align="center"></td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over</mi>
<mo>&lt;</mo>
<mi>Base</mi>
<mo>&lt;</mo>
<mi>Under<mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over</mi>
<mo>&gt;</mo>
<mi>Base</mi>
<mo>&gt;</mo>
<mi>Under</mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over = Under</mi>
<mo>&lt;</mo>
<mi>Base</mi>
</mrow>
</mrow></math>
</td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over = Under</mi>
<mo>&gt;</mo>
<mi>Base</mi>
</mrow></td>
</mrow></math></td>
</tr>
<tr>
<th>

View File

@ -9,35 +9,35 @@
</tr>
<tr>
<td align="center"></td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over</mi>
<mo>&lt;</mo>
<mi>Base</mi>
<mo>&lt;</mo>
<mi>Under<mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over</mi>
<mo>&gt;</mo>
<mi>Base</mi>
<mo>&gt;</mo>
<mi>Under</mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over = Under</mi>
<mo>&lt;</mo>
<mi>Base</mi>
</mrow>
</mrow></math>
</td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over = Under</mi>
<mo>&gt;</mo>
<mi>Base</mi>
</mrow></td>
</mrow></math></td>
</tr>
<tr>
<th>
@ -49,7 +49,7 @@
<mspace height="15px" width="50px" mathbackground="blue"/>
<mspace height="15px" width="75px" mathbackground="red"/>
<mspace height="15px" width="25px" mathbackground="red"/>
</mover>
</moverover>
</math>
</td>
<td align="center">

View File

@ -9,35 +9,35 @@
</tr>
<tr>
<td align="center"></td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over</mi>
<mo>&lt;</mo>
<mi>Base</mi>
<mo>&lt;</mo>
<mi>Under<mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over</mi>
<mo>&gt;</mo>
<mi>Base</mi>
<mo>&gt;</mo>
<mi>Under</mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over = Under</mi>
<mo>&lt;</mo>
<mi>Base</mi>
</mrow>
</mrow></math>
</td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over = Under</mi>
<mo>&gt;</mo>
<mi>Base</mi>
</mrow></td>
</mrow></math></td>
</tr>
<tr>
<th>

View File

@ -9,35 +9,35 @@
</tr>
<tr>
<td align="center"></td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over</mi>
<mo>&lt;</mo>
<mi>Base</mi>
<mo>&lt;</mo>
<mi>Under<mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over</mi>
<mo>&gt;</mo>
<mi>Base</mi>
<mo>&gt;</mo>
<mi>Under</mi>
</mrow>
</mrow></math>
</td>
<td align="center">
<mrow>
<math><mrow>
<mi>Over = Under</mi>
<mo>&lt;</mo>
<mi>Base</mi>
</mrow>
</mrow></math>
</td>
<td align="center"><mrow>
<td align="center"><math><mrow>
<mi>Over = Under</mi>
<mo>&gt;</mo>
<mi>Base</mi>
</mrow></td>
</mrow></math></td>
</tr>
<tr>
<th>
@ -49,7 +49,7 @@
<mspace height="15px" width="50px" mathbackground="blue"/>
<mspace height="15px" width="75px" mathbackground="red"/>
<mspace height="15px" width="25px" mathbackground="red"/>
</mover>
</munderover>
</math>
</td>
<td align="center">

View File

@ -37,6 +37,7 @@ fails-if(winWidget) == mfenced-10.html mfenced-10-ref.html
== quotes-1.xhtml quotes-1-ref.xhtml
!= stretchy-underbar-1.xhtml stretchy-underbar-1-ref.xhtml
== table-width-1.xhtml table-width-1-ref.xhtml
== table-width-2.html table-width-2-ref.html
== underbar-width-1.xhtml underbar-width-1-ref.xhtml
== mathml-type-supported.xhtml mathml-type-supported-ref.xml
== mtable-align-negative-rownumber.html mtable-align-negative-rownumber-ref.html

View File

@ -0,0 +1,36 @@
<!doctype>
<html>
<head>
<title>table-width-2</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<!-- See bug 459363 -->
<p>
<math>
<mtable>
<mtr>
<mtd><mtext>|</mtext></mtd>
<mtd><mrow style="width: 5em;"></mrow></mtd>
<mtd><mtext>|</mtext></mtd>
</mtr>
</mtable>
</math>
</p>
<p>
<math>
<mtable>
<mtr>
<mtd><mtext>|</mtext></mtd>
<mtd><mrow style="width: 5em;"></mrow></mtd>
<mtd><mtext>|</mtext></mtd>
</mtr>
</mtable>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!doctype>
<html>
<head>
<title>table-width-2</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<!-- See bug 459363 -->
<p>
<math>
<mtable>
<mtr>
<mtd><mtext>|</mtext></mtd>
<mtd><mspace width="5em"></mspace></mtd>
<mtd><mtext>|</mtext></mtd>
</mtr>
</mtable>
</math>
</p>
<p>
<math>
<mtable>
<mtr>
<mtd><mtext>|</mtext></mtd>
<mtd><mpadded width="5em"></mpadded></mtd>
<mtd><mtext>|</mtext></mtd>
</mtr>
</mtable>
</math>
</p>
</body>
</html>