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