mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 518592 - Fix single char <mi> frame type and add a test for dotless i. r=karlt
This commit is contained in:
parent
0cd6b453f9
commit
9151ac2d1d
@ -527,12 +527,12 @@ nsMathMLContainerFrame::FinalizeReflow(nsRenderingContext& aRenderingContext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if we should fix the spacing
|
|
||||||
FixInterFrameSpacing(aDesiredSize);
|
|
||||||
|
|
||||||
// Also return our bounding metrics
|
// Also return our bounding metrics
|
||||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||||
|
|
||||||
|
// see if we should fix the spacing
|
||||||
|
FixInterFrameSpacing(aDesiredSize);
|
||||||
|
|
||||||
if (!parentWillFireStretch) {
|
if (!parentWillFireStretch) {
|
||||||
// Not expecting a stretch.
|
// Not expecting a stretch.
|
||||||
// Finished with these:
|
// Finished with these:
|
||||||
@ -971,6 +971,9 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static nscoord AddInterFrameSpacingToSize(nsHTMLReflowMetrics& aDesiredSize,
|
||||||
|
nsMathMLContainerFrame* aFrame);
|
||||||
|
|
||||||
/* virtual */ nscoord
|
/* virtual */ nscoord
|
||||||
nsMathMLContainerFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
nsMathMLContainerFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
||||||
{
|
{
|
||||||
@ -978,10 +981,12 @@ nsMathMLContainerFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
|||||||
DISPLAY_MIN_WIDTH(this, result);
|
DISPLAY_MIN_WIDTH(this, result);
|
||||||
nsHTMLReflowMetrics desiredSize(GetWritingMode());
|
nsHTMLReflowMetrics desiredSize(GetWritingMode());
|
||||||
GetIntrinsicWidthMetrics(aRenderingContext, desiredSize);
|
GetIntrinsicWidthMetrics(aRenderingContext, desiredSize);
|
||||||
nsBoundingMetrics bm = desiredSize.mBoundingMetrics;
|
|
||||||
// We include the overflow to compensate for FixInterFrameSpacing.
|
// Include the additional width added by FixInterFrameSpacing to ensure
|
||||||
result = std::max(bm.width, bm.rightBearing) - std::min(0, bm.leftBearing);
|
// consistent width calculations.
|
||||||
return result;
|
AddInterFrameSpacingToSize(desiredSize, this);
|
||||||
|
|
||||||
|
return desiredSize.Width();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ nscoord
|
/* virtual */ nscoord
|
||||||
@ -991,10 +996,12 @@ nsMathMLContainerFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
|||||||
DISPLAY_MIN_WIDTH(this, result);
|
DISPLAY_MIN_WIDTH(this, result);
|
||||||
nsHTMLReflowMetrics desiredSize(GetWritingMode());
|
nsHTMLReflowMetrics desiredSize(GetWritingMode());
|
||||||
GetIntrinsicWidthMetrics(aRenderingContext, desiredSize);
|
GetIntrinsicWidthMetrics(aRenderingContext, desiredSize);
|
||||||
nsBoundingMetrics bm = desiredSize.mBoundingMetrics;
|
|
||||||
// We include the overflow to compensate for FixInterFrameSpacing.
|
// Include the additional width added by FixInterFrameSpacing to ensure
|
||||||
result = std::max(bm.width, bm.rightBearing) - std::min(0, bm.leftBearing);
|
// consistent width calculations.
|
||||||
return result;
|
AddInterFrameSpacingToSize(desiredSize, this);
|
||||||
|
|
||||||
|
return desiredSize.Width();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ void
|
/* virtual */ void
|
||||||
@ -1385,40 +1392,54 @@ GetInterFrameSpacingFor(int32_t aScriptLevel,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
static nscoord
|
||||||
nsMathMLContainerFrame::FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize)
|
AddInterFrameSpacingToSize(nsHTMLReflowMetrics& aDesiredSize,
|
||||||
|
nsMathMLContainerFrame* aFrame)
|
||||||
{
|
{
|
||||||
nscoord gap = 0;
|
nscoord gap = 0;
|
||||||
nsIContent* parentContent = mParent->GetContent();
|
nsIFrame* parent = aFrame->GetParent();
|
||||||
|
nsIContent* parentContent = parent->GetContent();
|
||||||
if (MOZ_UNLIKELY(!parentContent)) {
|
if (MOZ_UNLIKELY(!parentContent)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
nsIAtom *parentTag = parentContent->Tag();
|
nsIAtom *parentTag = parentContent->Tag();
|
||||||
if (parentContent->GetNameSpaceID() == kNameSpaceID_MathML &&
|
if (parentContent->GetNameSpaceID() == kNameSpaceID_MathML &&
|
||||||
(parentTag == nsGkAtoms::math || parentTag == nsGkAtoms::mtd_)) {
|
(parentTag == nsGkAtoms::math || parentTag == nsGkAtoms::mtd_)) {
|
||||||
gap = GetInterFrameSpacingFor(StyleFont()->mScriptLevel, mParent, this);
|
gap = GetInterFrameSpacingFor(aFrame->StyleFont()->mScriptLevel,
|
||||||
|
parent, aFrame);
|
||||||
// add our own italic correction
|
// add our own italic correction
|
||||||
nscoord leftCorrection = 0, italicCorrection = 0;
|
nscoord leftCorrection = 0, italicCorrection = 0;
|
||||||
GetItalicCorrection(mBoundingMetrics, leftCorrection, italicCorrection);
|
aFrame->GetItalicCorrection(aDesiredSize.mBoundingMetrics,
|
||||||
|
leftCorrection, italicCorrection);
|
||||||
gap += leftCorrection;
|
gap += leftCorrection;
|
||||||
// see if we should shift our children to account for the correction
|
|
||||||
if (gap) {
|
if (gap) {
|
||||||
nsIFrame* childFrame = mFrames.FirstChild();
|
aDesiredSize.mBoundingMetrics.leftBearing += gap;
|
||||||
while (childFrame) {
|
aDesiredSize.mBoundingMetrics.rightBearing += gap;
|
||||||
childFrame->SetPosition(childFrame->GetPosition() + nsPoint(gap, 0));
|
aDesiredSize.mBoundingMetrics.width += gap;
|
||||||
childFrame = childFrame->GetNextSibling();
|
|
||||||
}
|
|
||||||
mBoundingMetrics.leftBearing += gap;
|
|
||||||
mBoundingMetrics.rightBearing += gap;
|
|
||||||
mBoundingMetrics.width += gap;
|
|
||||||
aDesiredSize.Width() += gap;
|
aDesiredSize.Width() += gap;
|
||||||
}
|
}
|
||||||
mBoundingMetrics.width += italicCorrection;
|
aDesiredSize.mBoundingMetrics.width += italicCorrection;
|
||||||
aDesiredSize.Width() += italicCorrection;
|
aDesiredSize.Width() += italicCorrection;
|
||||||
}
|
}
|
||||||
return gap;
|
return gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nscoord
|
||||||
|
nsMathMLContainerFrame::FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize)
|
||||||
|
{
|
||||||
|
nscoord gap = 0;
|
||||||
|
gap = AddInterFrameSpacingToSize(aDesiredSize, this);
|
||||||
|
if (gap) {
|
||||||
|
// Shift our children to account for the correction
|
||||||
|
nsIFrame* childFrame = mFrames.FirstChild();
|
||||||
|
while (childFrame) {
|
||||||
|
childFrame->SetPosition(childFrame->GetPosition() + nsPoint(gap, 0));
|
||||||
|
childFrame = childFrame->GetNextSibling();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gap;
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
nsMathMLContainerFrame::DidReflowChildren(nsIFrame* aFirst, nsIFrame* aStop)
|
nsMathMLContainerFrame::DidReflowChildren(nsIFrame* aFirst, nsIFrame* aStop)
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ nsMathMLTokenFrame::MarkTextFramesAsTokenMathML()
|
|||||||
|
|
||||||
if (isSingleCharacter) {
|
if (isSingleCharacter) {
|
||||||
child->AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI);
|
child->AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI);
|
||||||
|
AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,14 @@
|
|||||||
<mtext>Ϝϝ</mtext>
|
<mtext>Ϝϝ</mtext>
|
||||||
</mrow>
|
</mrow>
|
||||||
</math>
|
</math>
|
||||||
|
<p>
|
||||||
|
<math>
|
||||||
|
<mrow>
|
||||||
|
<mi mathvariant="italic">ı</mi>
|
||||||
|
<mi mathvariant="italic">ȷ</mi>
|
||||||
|
<mi mathvariant="normal">ıı</mi>
|
||||||
|
<mi mathvariant="normal">ȷȷ</mi>
|
||||||
|
</mrow>
|
||||||
|
</math>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -12,5 +12,14 @@
|
|||||||
<mtext mathvariant="italic">Ϝϝ</mtext>
|
<mtext mathvariant="italic">Ϝϝ</mtext>
|
||||||
</mrow>
|
</mrow>
|
||||||
</math>
|
</math>
|
||||||
|
<p>
|
||||||
|
<math>
|
||||||
|
<mrow>
|
||||||
|
<mi>ı</mi>
|
||||||
|
<mi>ȷ</mi>
|
||||||
|
<mi>ıı</mi>
|
||||||
|
<mi>ȷȷ</mi>
|
||||||
|
</mrow>
|
||||||
|
</math>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
td { border: 1px solid white;
|
td { border: 1px solid white;
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
padding-right: 1px;
|
padding-right: 2px;
|
||||||
padding-left: 1px;
|
padding-left: 1px;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
color: black; }
|
color: black; }
|
||||||
@ -51,6 +51,13 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<math><mphantom><mi mathvariant="script">l</mi><mi>i</mi></mphantom></math>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
td { border: 1px solid white;
|
td { border: 1px solid white;
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
padding-right: 1px;
|
padding-right: 2px;
|
||||||
padding-left: 1px;
|
padding-left: 1px;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
color: black; }
|
color: black; }
|
||||||
@ -51,6 +51,14 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<math><mi mathvariant="script">l</mi>
|
||||||
|
<mi mathvariant="italic">i</mi></math>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user