mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 685628 - Make mpadded apply height/depth to logical metrics. r=fredw, r=karlt
This commit is contained in:
parent
352ee59daf
commit
dfa6c41b87
@ -266,7 +266,7 @@ void
|
|||||||
nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
|
nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
|
||||||
int32_t aPseudoUnit,
|
int32_t aPseudoUnit,
|
||||||
const nsCSSValue& aCSSValue,
|
const nsCSSValue& aCSSValue,
|
||||||
const nsBoundingMetrics& aBoundingMetrics,
|
const nsHTMLReflowMetrics& aDesiredSize,
|
||||||
nscoord& aValueToUpdate) const
|
nscoord& aValueToUpdate) const
|
||||||
{
|
{
|
||||||
nsCSSUnit unit = aCSSValue.GetUnit();
|
nsCSSUnit unit = aCSSValue.GetUnit();
|
||||||
@ -276,15 +276,15 @@ nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
|
|||||||
if (eCSSUnit_Percent == unit || eCSSUnit_Number == unit) {
|
if (eCSSUnit_Percent == unit || eCSSUnit_Number == unit) {
|
||||||
switch(aPseudoUnit) {
|
switch(aPseudoUnit) {
|
||||||
case NS_MATHML_PSEUDO_UNIT_WIDTH:
|
case NS_MATHML_PSEUDO_UNIT_WIDTH:
|
||||||
scaler = aBoundingMetrics.width;
|
scaler = aDesiredSize.width;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_MATHML_PSEUDO_UNIT_HEIGHT:
|
case NS_MATHML_PSEUDO_UNIT_HEIGHT:
|
||||||
scaler = aBoundingMetrics.ascent;
|
scaler = aDesiredSize.ascent;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NS_MATHML_PSEUDO_UNIT_DEPTH:
|
case NS_MATHML_PSEUDO_UNIT_DEPTH:
|
||||||
scaler = aBoundingMetrics.descent;
|
scaler = aDesiredSize.height - aDesiredSize.ascent;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -339,8 +339,8 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord height = mBoundingMetrics.ascent;
|
nscoord height = aDesiredSize.ascent;
|
||||||
nscoord depth = mBoundingMetrics.descent;
|
nscoord depth = aDesiredSize.height - aDesiredSize.ascent;
|
||||||
// The REC says:
|
// The REC says:
|
||||||
//
|
//
|
||||||
// "The lspace attribute ('leading' space) specifies the horizontal location
|
// "The lspace attribute ('leading' space) specifies the horizontal location
|
||||||
@ -366,7 +366,7 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
|
|||||||
// refer "to the horizontal distance between the positioning point of the
|
// refer "to the horizontal distance between the positioning point of the
|
||||||
// mpadded and the positioning point for the following content". MathML2
|
// mpadded and the positioning point for the following content". MathML2
|
||||||
// doesn't make the distinction.
|
// doesn't make the distinction.
|
||||||
nscoord width = mBoundingMetrics.width;
|
nscoord width = aDesiredSize.width;
|
||||||
nscoord voffset = 0;
|
nscoord voffset = 0;
|
||||||
|
|
||||||
int32_t pseudoUnit;
|
int32_t pseudoUnit;
|
||||||
@ -376,35 +376,35 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
|
|||||||
pseudoUnit = (mWidthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
pseudoUnit = (mWidthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
||||||
? NS_MATHML_PSEUDO_UNIT_WIDTH : mWidthPseudoUnit;
|
? NS_MATHML_PSEUDO_UNIT_WIDTH : mWidthPseudoUnit;
|
||||||
UpdateValue(mWidthSign, pseudoUnit, mWidth,
|
UpdateValue(mWidthSign, pseudoUnit, mWidth,
|
||||||
mBoundingMetrics, width);
|
aDesiredSize, width);
|
||||||
width = std::max(0, width);
|
width = std::max(0, width);
|
||||||
|
|
||||||
// update "height" (this is the ascent in the terminology of the REC)
|
// update "height" (this is the ascent in the terminology of the REC)
|
||||||
pseudoUnit = (mHeightPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
pseudoUnit = (mHeightPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
||||||
? NS_MATHML_PSEUDO_UNIT_HEIGHT : mHeightPseudoUnit;
|
? NS_MATHML_PSEUDO_UNIT_HEIGHT : mHeightPseudoUnit;
|
||||||
UpdateValue(mHeightSign, pseudoUnit, mHeight,
|
UpdateValue(mHeightSign, pseudoUnit, mHeight,
|
||||||
mBoundingMetrics, height);
|
aDesiredSize, height);
|
||||||
height = std::max(0, height);
|
height = std::max(0, height);
|
||||||
|
|
||||||
// update "depth" (this is the descent in the terminology of the REC)
|
// update "depth" (this is the descent in the terminology of the REC)
|
||||||
pseudoUnit = (mDepthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
pseudoUnit = (mDepthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
||||||
? NS_MATHML_PSEUDO_UNIT_DEPTH : mDepthPseudoUnit;
|
? NS_MATHML_PSEUDO_UNIT_DEPTH : mDepthPseudoUnit;
|
||||||
UpdateValue(mDepthSign, pseudoUnit, mDepth,
|
UpdateValue(mDepthSign, pseudoUnit, mDepth,
|
||||||
mBoundingMetrics, depth);
|
aDesiredSize, depth);
|
||||||
depth = std::max(0, depth);
|
depth = std::max(0, depth);
|
||||||
|
|
||||||
// update lspace
|
// update lspace
|
||||||
if (mLeadingSpacePseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
if (mLeadingSpacePseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
||||||
pseudoUnit = mLeadingSpacePseudoUnit;
|
pseudoUnit = mLeadingSpacePseudoUnit;
|
||||||
UpdateValue(mLeadingSpaceSign, pseudoUnit, mLeadingSpace,
|
UpdateValue(mLeadingSpaceSign, pseudoUnit, mLeadingSpace,
|
||||||
mBoundingMetrics, lspace);
|
aDesiredSize, lspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update voffset
|
// update voffset
|
||||||
if (mVerticalOffsetPseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
if (mVerticalOffsetPseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
||||||
pseudoUnit = mVerticalOffsetPseudoUnit;
|
pseudoUnit = mVerticalOffsetPseudoUnit;
|
||||||
UpdateValue(mVerticalOffsetSign, pseudoUnit, mVerticalOffset,
|
UpdateValue(mVerticalOffsetSign, pseudoUnit, mVerticalOffset,
|
||||||
mBoundingMetrics, voffset);
|
aDesiredSize, voffset);
|
||||||
}
|
}
|
||||||
// do the padding now that we have everything
|
// do the padding now that we have everything
|
||||||
// The idea here is to maintain the invariant that <mpadded>...</mpadded> (i.e.,
|
// The idea here is to maintain the invariant that <mpadded>...</mpadded> (i.e.,
|
||||||
@ -427,13 +427,12 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
|
|||||||
mBoundingMetrics.rightBearing = mBoundingMetrics.width;
|
mBoundingMetrics.rightBearing = mBoundingMetrics.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord dy = height - mBoundingMetrics.ascent;
|
|
||||||
nscoord dx = (StyleVisibility()->mDirection ?
|
nscoord dx = (StyleVisibility()->mDirection ?
|
||||||
width - initialWidth - lspace : lspace);
|
width - initialWidth - lspace : lspace);
|
||||||
|
|
||||||
aDesiredSize.ascent += dy;
|
aDesiredSize.ascent = height;
|
||||||
aDesiredSize.width = mBoundingMetrics.width;
|
aDesiredSize.width = mBoundingMetrics.width;
|
||||||
aDesiredSize.height += dy + depth - mBoundingMetrics.descent;
|
aDesiredSize.height = depth + aDesiredSize.ascent;
|
||||||
mBoundingMetrics.ascent = height;
|
mBoundingMetrics.ascent = height;
|
||||||
mBoundingMetrics.descent = depth;
|
mBoundingMetrics.descent = depth;
|
||||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||||
|
@ -79,7 +79,7 @@ private:
|
|||||||
UpdateValue(int32_t aSign,
|
UpdateValue(int32_t aSign,
|
||||||
int32_t aPseudoUnit,
|
int32_t aPseudoUnit,
|
||||||
const nsCSSValue& aCSSValue,
|
const nsCSSValue& aCSSValue,
|
||||||
const nsBoundingMetrics& aBoundingMetrics,
|
const nsHTMLReflowMetrics& aDesiredSize,
|
||||||
nscoord& aValueToUpdate) const;
|
nscoord& aValueToUpdate) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
15
layout/reftests/mathml/mpadded-7-ref.html
Normal file
15
layout/reftests/mathml/mpadded-7-ref.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test mpadded</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<math>
|
||||||
|
<mpadded mathbackground="red" height="100height" depth="0">
|
||||||
|
<mphantom>
|
||||||
|
<mtext mathvariant="monospace">X</mtext>
|
||||||
|
</mphantom>
|
||||||
|
</mpadded>
|
||||||
|
</math>
|
||||||
|
</body>
|
||||||
|
</html>
|
16
layout/reftests/mathml/mpadded-7.html
Normal file
16
layout/reftests/mathml/mpadded-7.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test mpadded</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<math>
|
||||||
|
<!--height in term of height should not depend on the characters-->
|
||||||
|
<mpadded mathbackground="red" height="100height" depth="0">
|
||||||
|
<mphantom>
|
||||||
|
<mtext mathvariant="monospace">_</mtext>
|
||||||
|
</mphantom>
|
||||||
|
</mpadded>
|
||||||
|
</math>
|
||||||
|
</body>
|
||||||
|
</html>
|
15
layout/reftests/mathml/mpadded-8-ref.html
Normal file
15
layout/reftests/mathml/mpadded-8-ref.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test mpadded</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<math>
|
||||||
|
<mpadded mathbackground="red" height="100width" depth="0">
|
||||||
|
<mphantom>
|
||||||
|
<mtext mathvariant="monospace">X</mtext>
|
||||||
|
</mphantom>
|
||||||
|
</mpadded>
|
||||||
|
</math>
|
||||||
|
</body>
|
||||||
|
</html>
|
16
layout/reftests/mathml/mpadded-8.html
Normal file
16
layout/reftests/mathml/mpadded-8.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test mpadded</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<math>
|
||||||
|
<!--height in term of width should not depend on the characters-->
|
||||||
|
<mpadded mathbackground="red" height="100width" depth="0">
|
||||||
|
<mphantom>
|
||||||
|
<mtext mathvariant="monospace">|</mtext>
|
||||||
|
</mphantom>
|
||||||
|
</mpadded>
|
||||||
|
</math>
|
||||||
|
</body>
|
||||||
|
</html>
|
15
layout/reftests/mathml/mpadded-9-ref.html
Normal file
15
layout/reftests/mathml/mpadded-9-ref.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test mpadded</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<math>
|
||||||
|
<mpadded mathbackground="red" width="100width">
|
||||||
|
<mphantom>
|
||||||
|
<mtext mathvariant="monospace">X</mtext>
|
||||||
|
</mphantom>
|
||||||
|
</mpadded>
|
||||||
|
</math>
|
||||||
|
</body>
|
||||||
|
</html>
|
16
layout/reftests/mathml/mpadded-9.html
Normal file
16
layout/reftests/mathml/mpadded-9.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test mpadded</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<math>
|
||||||
|
<!--with fixed width, height + depth should not depend on the characters-->
|
||||||
|
<mpadded mathbackground="red" width="100width">
|
||||||
|
<mphantom>
|
||||||
|
<mtext mathvariant="monospace">|</mtext>
|
||||||
|
</mphantom>
|
||||||
|
</mpadded>
|
||||||
|
</math>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -92,6 +92,9 @@ fails == mstyle-5.xhtml mstyle-5-ref.xhtml # Bug 787215
|
|||||||
== mpadded-5.html mpadded-5-ref.html
|
== mpadded-5.html mpadded-5-ref.html
|
||||||
== mpadded-1-2.html mpadded-1-2-ref.html
|
== mpadded-1-2.html mpadded-1-2-ref.html
|
||||||
== mpadded-6.html mpadded-6-ref.html
|
== mpadded-6.html mpadded-6-ref.html
|
||||||
|
== mpadded-7.html mpadded-7-ref.html
|
||||||
|
== mpadded-8.html mpadded-8-ref.html
|
||||||
|
== mpadded-9.html mpadded-9-ref.html
|
||||||
== math-display.html math-display-ref.html
|
== math-display.html math-display-ref.html
|
||||||
== scriptlevel-movablelimits-1.html scriptlevel-movablelimits-1-ref.html
|
== scriptlevel-movablelimits-1.html scriptlevel-movablelimits-1-ref.html
|
||||||
== munderover-align-accent-false.html munderover-align-accent-false-ref.html
|
== munderover-align-accent-false.html munderover-align-accent-false-ref.html
|
||||||
|
Loading…
Reference in New Issue
Block a user