зеркало из https://github.com/mozilla/gecko-dev.git
non-spacing marks in munder are off center or too long. b=428863 r+sr=roc
This commit is contained in:
Родитель
2467b27e9f
Коммит
eb17c7530a
|
@ -308,6 +308,14 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsIRenderingContext& aRenderingC
|
|||
// vertically and fire an horizontal stretch on each them. This is the case
|
||||
// for \munder, \mover, \munderover. We just sum-up the size vertically.
|
||||
bm.descent += bmChild.ascent + bmChild.descent;
|
||||
// Sometimes non-spacing marks (when width is zero) are positioned
|
||||
// to the left of the origin, but it is the distance between left
|
||||
// and right bearing that is important rather than the offsets from
|
||||
// the origin.
|
||||
if (bmChild.width == 0) {
|
||||
bmChild.rightBearing -= bmChild.leftBearing;
|
||||
bmChild.leftBearing = 0;
|
||||
}
|
||||
if (bm.leftBearing > bmChild.leftBearing)
|
||||
bm.leftBearing = bmChild.leftBearing;
|
||||
if (bm.rightBearing < bmChild.rightBearing)
|
||||
|
|
|
@ -317,13 +317,21 @@ nsMathMLmunderFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
// empty under?
|
||||
if (!(bmUnder.ascent + bmUnder.descent)) delta1 = 0;
|
||||
|
||||
nscoord dxBase, dxUnder;
|
||||
nscoord maxWidth = PR_MAX(bmBase.width, bmUnder.width);
|
||||
nscoord dxBase, dxUnder = 0;
|
||||
|
||||
// Width of non-spacing marks is zero so use left and right bearing.
|
||||
nscoord underWidth = bmUnder.width;
|
||||
if (!underWidth) {
|
||||
underWidth = bmUnder.rightBearing - bmUnder.leftBearing;
|
||||
dxUnder = -bmUnder.leftBearing;
|
||||
}
|
||||
|
||||
nscoord maxWidth = PR_MAX(bmBase.width, underWidth);
|
||||
if (NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
|
||||
dxUnder = (maxWidth - bmUnder.width)/2;
|
||||
dxUnder += (maxWidth - underWidth)/2;
|
||||
}
|
||||
else {
|
||||
dxUnder = -correction/2 + (maxWidth - bmUnder.width)/2;
|
||||
dxUnder += -correction/2 + (maxWidth - underWidth)/2;
|
||||
}
|
||||
dxBase = (maxWidth - bmBase.width)/2;
|
||||
|
||||
|
|
|
@ -436,12 +436,19 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
GetItalicCorrection(bmAnonymousBase, correction);
|
||||
|
||||
nscoord maxWidth = PR_MAX(bmAnonymousBase.width, bmUnder.width);
|
||||
if (NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
|
||||
dxUnder = (maxWidth - bmUnder.width)/2;;
|
||||
// Width of non-spacing marks is zero so use left and right bearing.
|
||||
nscoord underWidth = bmUnder.width;
|
||||
if (!underWidth) {
|
||||
underWidth = bmUnder.rightBearing - bmUnder.leftBearing;
|
||||
dxUnder = -bmUnder.leftBearing;
|
||||
}
|
||||
|
||||
nscoord maxWidth = PR_MAX(bmAnonymousBase.width, underWidth);
|
||||
if (NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) {
|
||||
dxUnder += (maxWidth - underWidth)/2;;
|
||||
}
|
||||
else {
|
||||
dxUnder = -correction/2 + (maxWidth - bmUnder.width)/2;
|
||||
dxUnder += -correction/2 + (maxWidth - underWidth)/2;
|
||||
}
|
||||
nscoord dxAnonymousBase = (maxWidth - bmAnonymousBase.width)/2;
|
||||
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
== mi-mathvariant-2.xhtml mi-mathvariant-2-ref.xhtml
|
||||
== table-width-1.xhtml table-width-1-ref.xhtml
|
||||
== overbar-width-1.xhtml overbar-width-1-ref.xhtml
|
||||
== underbar-width-1.xhtml underbar-width-1-ref.xhtml
|
||||
!= non-spacing-accent-1.xhtml non-spacing-accent-1-ref.xhtml
|
||||
!= stretchy-underbar-1.xhtml stretchy-underbar-1-ref.xhtml
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
html { background-color: grey; }
|
||||
div { display: inline-block;
|
||||
font-size: 30px;
|
||||
line-height: 60px; /* Ensure space for underbar */
|
||||
border: 1px solid white;
|
||||
padding: 2px; /* 10% error allowed in char selection */
|
||||
background-color: black;
|
||||
color: red; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mphantom>
|
||||
<munder>
|
||||
<mn>1</mn>
|
||||
<mo>̲</mo>
|
||||
</munder>
|
||||
</mphantom>
|
||||
</math>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Check width of stretchy OverBar</title>
|
||||
<style type="text/css">
|
||||
html { background-color: grey; }
|
||||
div { display: inline-block;
|
||||
font-size: 30px;
|
||||
line-height: 60px; /* Ensure space for underbar */
|
||||
border: 1px solid white;
|
||||
padding: 2px; /* 10% error allowed in char selection */
|
||||
background-color: black;
|
||||
color: black; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<munder>
|
||||
<mn>1</mn>
|
||||
<mo>̲</mo>
|
||||
</munder>
|
||||
</math>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче