mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Bug 1002526 - Part 1 - Pass the font inflation parameter to nsLayoutUtils::GetFontMetricsFor* methods. b=1002526. r=karl
This commit is contained in:
1 parent
94c4b1847c
commit
1988927944
17 files changed
+115
-56
No files matched your search
@@ -52,7 +52,9 @@ nsMathMLContainerFrame::ReflowError(nsRenderingContext& aRenderingContext,
|
||||
///////////////
|
||||
// Set font
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
|
||||
// bounding metrics
|
||||
nsAutoString errorMsg; errorMsg.AssignLiteral("invalid-markup");
|
||||
|
||||
@@ -212,7 +212,8 @@ nsMathMLFrame::GetAxisHeight(nsRenderingContext& aRenderingContext,
|
||||
/* static */ nscoord
|
||||
nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
const nsCSSValue& aCSSValue)
|
||||
const nsCSSValue& aCSSValue,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
NS_ASSERTION(aCSSValue.IsLengthUnit(), "not a length unit");
|
||||
|
||||
@@ -232,7 +233,8 @@ nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
|
||||
else if (eCSSUnit_XHeight == unit) {
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
|
||||
getter_AddRefs(fm));
|
||||
getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
nscoord xHeight = fm->XHeight();
|
||||
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)xHeight);
|
||||
}
|
||||
@@ -247,7 +249,8 @@ nsMathMLFrame::ParseNumericValue(const nsString& aString,
|
||||
nscoord* aLengthValue,
|
||||
uint32_t aFlags,
|
||||
nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext)
|
||||
nsStyleContext* aStyleContext,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
nsCSSValue cssValue;
|
||||
|
||||
@@ -269,7 +272,8 @@ nsMathMLFrame::ParseNumericValue(const nsString& aString,
|
||||
}
|
||||
|
||||
// Absolute units.
|
||||
*aLengthValue = CalcLength(aPresContext, aStyleContext, cssValue);
|
||||
*aLengthValue = CalcLength(aPresContext, aStyleContext, cssValue,
|
||||
aFontSizeInflation);
|
||||
}
|
||||
|
||||
// ================
|
||||
|
||||
@@ -147,12 +147,14 @@ public:
|
||||
nscoord* aLengthValue,
|
||||
uint32_t aFlags,
|
||||
nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext);
|
||||
nsStyleContext* aStyleContext,
|
||||
float aFontSizeInflation);
|
||||
|
||||
static nscoord
|
||||
CalcLength(nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
const nsCSSValue& aCSSValue);
|
||||
const nsCSSValue& aCSSValue,
|
||||
float aFontSizeInflation);
|
||||
|
||||
static eMathMLFrameType
|
||||
GetMathMLFrameTypeFor(nsIFrame* aFrame)
|
||||
@@ -194,19 +196,23 @@ public:
|
||||
// helper methods for getting sup/subdrop's from a child
|
||||
static void
|
||||
GetSubDropFromChild(nsIFrame* aChild,
|
||||
nscoord& aSubDrop)
|
||||
nscoord& aSubDrop,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
GetSubDrop(fm, aSubDrop);
|
||||
}
|
||||
|
||||
static void
|
||||
GetSupDropFromChild(nsIFrame* aChild,
|
||||
nscoord& aSupDrop)
|
||||
nscoord& aSupDrop,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aChild, getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
GetSupDrop(fm, aSupDrop);
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,9 @@ nsMathMLTokenFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
}
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
nscoord ascent = fm->MaxAscent();
|
||||
nscoord descent = fm->MaxDescent();
|
||||
|
||||
|
||||
@@ -344,7 +344,9 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
GetRuleThickness(aRenderingContext, fm, mRuleThickness);
|
||||
if (mRuleThickness < onePixel) {
|
||||
mRuleThickness = onePixel;
|
||||
|
||||
@@ -220,7 +220,9 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
int32_t i;
|
||||
const nsStyleFont* font = StyleFont();
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
nscoord axisHeight, em;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
GetEmHeight(fm, em);
|
||||
@@ -596,7 +598,9 @@ nsMathMLmfencedFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingCon
|
||||
nsPresContext* presContext = PresContext();
|
||||
const nsStyleFont* font = StyleFont();
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
nscoord em;
|
||||
GetEmHeight(fm, em);
|
||||
|
||||
|
||||
@@ -88,7 +88,8 @@ nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsString& aThicknessAttribute,
|
||||
nscoord onePixel,
|
||||
nscoord aDefaultRuleThickness)
|
||||
nscoord aDefaultRuleThickness,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
nscoord defaultThickness = aDefaultRuleThickness;
|
||||
nscoord lineThickness = aDefaultRuleThickness;
|
||||
@@ -126,7 +127,7 @@ nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext,
|
||||
lineThickness = defaultThickness;
|
||||
ParseNumericValue(aThicknessAttribute, &lineThickness,
|
||||
nsMathMLElement::PARSE_ALLOW_UNITLESS,
|
||||
aPresContext, aStyleContext);
|
||||
aPresContext, aStyleContext, aFontSizeInflation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,8 +215,10 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
nsPresContext* presContext = PresContext();
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
|
||||
nscoord defaultRuleThickness, axisHeight;
|
||||
nscoord oneDevPixel = fm->AppUnitsPerDevPixel();
|
||||
@@ -240,7 +243,8 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
nsAutoString value;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::linethickness_, value);
|
||||
mLineThickness = CalcLineThickness(presContext, mStyleContext, value,
|
||||
onePixel, defaultRuleThickness);
|
||||
onePixel, defaultRuleThickness,
|
||||
fontSizeInflation);
|
||||
|
||||
// bevelled attribute
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::bevelled_, value);
|
||||
|
||||
@@ -83,7 +83,8 @@ public:
|
||||
nsStyleContext* aStyleContext,
|
||||
nsString& aThicknessAttribute,
|
||||
nscoord onePixel,
|
||||
nscoord aDefaultRuleThickness);
|
||||
nscoord aDefaultRuleThickness,
|
||||
float aFontSizeInflation);
|
||||
|
||||
uint8_t
|
||||
ScriptIncrement(nsIFrame* aFrame) MOZ_OVERRIDE;
|
||||
|
||||
@@ -97,6 +97,7 @@ nsMathMLmmultiscriptsFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
nscoord subScriptShift = 0;
|
||||
nscoord supScriptShift = 0;
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
|
||||
// subscriptshift
|
||||
//
|
||||
@@ -114,7 +115,7 @@ nsMathMLmmultiscriptsFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::subscriptshift_, value);
|
||||
if (!value.IsEmpty()) {
|
||||
ParseNumericValue(value, &subScriptShift, 0, PresContext(),
|
||||
mStyleContext);
|
||||
mStyleContext, fontSizeInflation);
|
||||
}
|
||||
}
|
||||
// superscriptshift
|
||||
@@ -132,11 +133,12 @@ nsMathMLmmultiscriptsFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::superscriptshift_, value);
|
||||
if (!value.IsEmpty()) {
|
||||
ParseNumericValue(value, &supScriptShift, 0, PresContext(),
|
||||
mStyleContext);
|
||||
mStyleContext, fontSizeInflation);
|
||||
}
|
||||
}
|
||||
return PlaceMultiScript(PresContext(), aRenderingContext, aPlaceOrigin,
|
||||
aDesiredSize, this, subScriptShift, supScriptShift);
|
||||
aDesiredSize, this, subScriptShift, supScriptShift,
|
||||
fontSizeInflation);
|
||||
}
|
||||
|
||||
// exported routine that both munderover and mmultiscripts share.
|
||||
@@ -148,7 +150,8 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
nsMathMLContainerFrame* aFrame,
|
||||
nscoord aUserSubScriptShift,
|
||||
nscoord aUserSupScriptShift)
|
||||
nscoord aUserSupScriptShift,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
nsIAtom* tag = aFrame->GetContent()->Tag();
|
||||
|
||||
@@ -184,7 +187,8 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
|
||||
// get x-height (an ex)
|
||||
const nsStyleFont* font = aFrame->StyleFont();
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(baseFrame, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(baseFrame, getter_AddRefs(fm),
|
||||
aFontSizeInflation);
|
||||
|
||||
nscoord xHeight = fm->XHeight();
|
||||
|
||||
@@ -389,7 +393,7 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
|
||||
subScriptFrame = childFrame;
|
||||
GetReflowAndBoundingMetricsFor(subScriptFrame, subScriptSize, bmSubScript);
|
||||
// get the subdrop from the subscript font
|
||||
GetSubDropFromChild (subScriptFrame, subDrop);
|
||||
GetSubDropFromChild (subScriptFrame, subDrop, aFontSizeInflation);
|
||||
// parameter v, Rule 18a, App. G, TeXbook
|
||||
minSubScriptShift = bmBase.descent + subDrop;
|
||||
trySubScriptShift = std::max(minSubScriptShift,subScriptShift);
|
||||
@@ -430,7 +434,7 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
|
||||
supScriptFrame = childFrame;
|
||||
GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize, bmSupScript);
|
||||
// get the supdrop from the supscript font
|
||||
GetSupDropFromChild (supScriptFrame, supDrop);
|
||||
GetSupDropFromChild (supScriptFrame, supDrop, aFontSizeInflation);
|
||||
// parameter u, Rule 18a, App. G, TeXbook
|
||||
minSupScriptShift = bmBase.ascent - supDrop;
|
||||
nscoord superscriptBottomMin;
|
||||
|
||||
@@ -37,7 +37,8 @@ public:
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
nsMathMLContainerFrame* aForFrame,
|
||||
nscoord aUserSubScriptShift,
|
||||
nscoord aUserSupScriptShift);
|
||||
nscoord aUserSupScriptShift,
|
||||
float aFontSizeInflation);
|
||||
|
||||
uint8_t
|
||||
ScriptIncrement(nsIFrame* aFrame) MOZ_OVERRIDE;
|
||||
|
||||
@@ -206,6 +206,7 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
// if we have been here before, we will just use our cached form
|
||||
nsOperatorFlags form = NS_MATHML_OPERATOR_GET_FORM(mFlags);
|
||||
nsAutoString value;
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
|
||||
// special bits are always kept in mFlags.
|
||||
// remember the mutable bit from ProcessTextData().
|
||||
@@ -364,7 +365,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
// since these values are relative to the 'em' unit, convert to twips now
|
||||
nscoord em;
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
GetEmHeight(fm, em);
|
||||
|
||||
mEmbellishData.leadingSpace = NSToCoordRound(lspace * em);
|
||||
@@ -405,7 +407,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
|
||||
leadingSpace = 0;
|
||||
else if (cssValue.IsLengthUnit())
|
||||
leadingSpace = CalcLength(presContext, mStyleContext, cssValue);
|
||||
leadingSpace = CalcLength(presContext, mStyleContext, cssValue,
|
||||
fontSizeInflation);
|
||||
mFlags |= NS_MATHML_OPERATOR_LSPACE_ATTR;
|
||||
}
|
||||
}
|
||||
@@ -431,7 +434,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
|
||||
trailingSpace = 0;
|
||||
else if (cssValue.IsLengthUnit())
|
||||
trailingSpace = CalcLength(presContext, mStyleContext, cssValue);
|
||||
trailingSpace = CalcLength(presContext, mStyleContext, cssValue,
|
||||
fontSizeInflation);
|
||||
mFlags |= NS_MATHML_OPERATOR_RSPACE_ATTR;
|
||||
}
|
||||
}
|
||||
@@ -514,7 +518,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
else if (eCSSUnit_Percent == unit)
|
||||
mMinSize = cssValue.GetPercentValue();
|
||||
else if (eCSSUnit_Null != unit) {
|
||||
mMinSize = float(CalcLength(presContext, mStyleContext, cssValue));
|
||||
mMinSize = float(CalcLength(presContext, mStyleContext, cssValue,
|
||||
fontSizeInflation));
|
||||
mFlags |= NS_MATHML_OPERATOR_MINSIZE_ABSOLUTE;
|
||||
}
|
||||
}
|
||||
@@ -546,7 +551,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
else if (eCSSUnit_Percent == unit)
|
||||
mMaxSize = cssValue.GetPercentValue();
|
||||
else if (eCSSUnit_Null != unit) {
|
||||
mMaxSize = float(CalcLength(presContext, mStyleContext, cssValue));
|
||||
mMaxSize = float(CalcLength(presContext, mStyleContext, cssValue,
|
||||
fontSizeInflation));
|
||||
mFlags |= NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE;
|
||||
}
|
||||
}
|
||||
@@ -610,7 +616,9 @@ nsMathMLmoFrame::Stretch(nsRenderingContext& aRenderingContext,
|
||||
|
||||
// get the axis height;
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
nscoord axisHeight, height;
|
||||
GetAxisHeight(aRenderingContext, fm, axisHeight);
|
||||
|
||||
|
||||
@@ -256,7 +256,8 @@ nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
|
||||
int32_t aPseudoUnit,
|
||||
const nsCSSValue& aCSSValue,
|
||||
const nsHTMLReflowMetrics& aDesiredSize,
|
||||
nscoord& aValueToUpdate) const
|
||||
nscoord& aValueToUpdate,
|
||||
float aFontSizeInflation) const
|
||||
{
|
||||
nsCSSUnit unit = aCSSValue.GetUnit();
|
||||
if (NS_MATHML_SIGN_INVALID != aSign && eCSSUnit_Null != unit) {
|
||||
@@ -289,7 +290,8 @@ nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
|
||||
else if (eCSSUnit_Percent == unit)
|
||||
amount = NSToCoordRound(float(scaler) * aCSSValue.GetPercentValue());
|
||||
else
|
||||
amount = CalcLength(PresContext(), mStyleContext, aCSSValue);
|
||||
amount = CalcLength(PresContext(), mStyleContext, aCSSValue,
|
||||
aFontSizeInflation);
|
||||
|
||||
if (NS_MATHML_SIGN_PLUS == aSign)
|
||||
aValueToUpdate += amount;
|
||||
@@ -359,40 +361,41 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
|
||||
int32_t pseudoUnit;
|
||||
nscoord initialWidth = width;
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
|
||||
// update width
|
||||
pseudoUnit = (mWidthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
||||
? NS_MATHML_PSEUDO_UNIT_WIDTH : mWidthPseudoUnit;
|
||||
UpdateValue(mWidthSign, pseudoUnit, mWidth,
|
||||
aDesiredSize, width);
|
||||
aDesiredSize, width, fontSizeInflation);
|
||||
width = std::max(0, width);
|
||||
|
||||
// update "height" (this is the ascent in the terminology of the REC)
|
||||
pseudoUnit = (mHeightPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
||||
? NS_MATHML_PSEUDO_UNIT_HEIGHT : mHeightPseudoUnit;
|
||||
UpdateValue(mHeightSign, pseudoUnit, mHeight,
|
||||
aDesiredSize, height);
|
||||
aDesiredSize, height, fontSizeInflation);
|
||||
height = std::max(0, height);
|
||||
|
||||
// update "depth" (this is the descent in the terminology of the REC)
|
||||
pseudoUnit = (mDepthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
||||
? NS_MATHML_PSEUDO_UNIT_DEPTH : mDepthPseudoUnit;
|
||||
UpdateValue(mDepthSign, pseudoUnit, mDepth,
|
||||
aDesiredSize, depth);
|
||||
aDesiredSize, depth, fontSizeInflation);
|
||||
depth = std::max(0, depth);
|
||||
|
||||
// update lspace
|
||||
if (mLeadingSpacePseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
||||
pseudoUnit = mLeadingSpacePseudoUnit;
|
||||
UpdateValue(mLeadingSpaceSign, pseudoUnit, mLeadingSpace,
|
||||
aDesiredSize, lspace);
|
||||
aDesiredSize, lspace, fontSizeInflation);
|
||||
}
|
||||
|
||||
// update voffset
|
||||
if (mVerticalOffsetPseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
||||
pseudoUnit = mVerticalOffsetPseudoUnit;
|
||||
UpdateValue(mVerticalOffsetSign, pseudoUnit, mVerticalOffset,
|
||||
aDesiredSize, voffset);
|
||||
aDesiredSize, voffset, fontSizeInflation);
|
||||
}
|
||||
// do the padding now that we have everything
|
||||
// The idea here is to maintain the invariant that <mpadded>...</mpadded> (i.e.,
|
||||
|
||||
@@ -86,7 +86,8 @@ private:
|
||||
int32_t aPseudoUnit,
|
||||
const nsCSSValue& aCSSValue,
|
||||
const nsHTMLReflowMetrics& aDesiredSize,
|
||||
nscoord& aValueToUpdate) const;
|
||||
nscoord& aValueToUpdate,
|
||||
float aFontSizeInflation) const;
|
||||
};
|
||||
|
||||
#endif /* nsMathMLmpaddedFrame_h___ */
|
||||
@@ -224,7 +224,9 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
// Prepare the radical symbol and the overline bar
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
|
||||
nscoord ruleThickness, leading, psi;
|
||||
GetRadicalParameters(fm, StyleFont()->mMathDisplay ==
|
||||
@@ -375,7 +377,9 @@ nsMathMLmrootFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingConte
|
||||
|
||||
nscoord dxSqr;
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
GetRadicalXOffsets(indexWidth, sqrWidth, fm, nullptr, &dxSqr);
|
||||
|
||||
nscoord width = dxSqr + sqrWidth + baseWidth;
|
||||
|
||||
@@ -35,6 +35,7 @@ void
|
||||
nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext)
|
||||
{
|
||||
nsAutoString value;
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
|
||||
// width
|
||||
//
|
||||
@@ -53,7 +54,7 @@ nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext)
|
||||
if (!value.IsEmpty()) {
|
||||
ParseNumericValue(value, &mWidth,
|
||||
nsMathMLElement::PARSE_ALLOW_NEGATIVE,
|
||||
aPresContext, mStyleContext);
|
||||
aPresContext, mStyleContext, fontSizeInflation);
|
||||
}
|
||||
|
||||
// height
|
||||
@@ -70,7 +71,7 @@ nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext)
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::height, value);
|
||||
if (!value.IsEmpty()) {
|
||||
ParseNumericValue(value, &mHeight, 0,
|
||||
aPresContext, mStyleContext);
|
||||
aPresContext, mStyleContext, fontSizeInflation);
|
||||
}
|
||||
|
||||
// depth
|
||||
@@ -87,7 +88,7 @@ nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext)
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::depth_, value);
|
||||
if (!value.IsEmpty()) {
|
||||
ParseNumericValue(value, &mDepth, 0,
|
||||
aPresContext, mStyleContext);
|
||||
aPresContext, mStyleContext, fontSizeInflation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,8 @@ ExtractSpacingValues(const nsAString& aString,
|
||||
nsTArray<nscoord>& aSpacingArray,
|
||||
nsIFrame* aFrame,
|
||||
nscoord aDefaultValue0,
|
||||
nscoord aDefaultValue1)
|
||||
nscoord aDefaultValue1,
|
||||
float aFontSizeInflation)
|
||||
{
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
nsStyleContext* styleContext = aFrame->StyleContext();
|
||||
@@ -444,7 +445,8 @@ ExtractSpacingValues(const nsAString& aString,
|
||||
}
|
||||
nsMathMLFrame::ParseNumericValue(valueString, &newValue,
|
||||
nsMathMLElement::PARSE_ALLOW_UNITLESS,
|
||||
presContext, styleContext);
|
||||
presContext, styleContext,
|
||||
aFontSizeInflation);
|
||||
aSpacingArray.AppendElement(newValue);
|
||||
|
||||
startIndex += count;
|
||||
@@ -478,8 +480,10 @@ ParseSpacingAttribute(nsMathMLmtableFrame* aFrame, nsIAtom* aAttribute)
|
||||
nscoord value;
|
||||
nscoord value2;
|
||||
// Set defaults
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(aFrame);
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
if (nsGkAtoms::rowspacing_ == aAttribute) {
|
||||
value = kDefaultRowspacingEx * fm->XHeight();
|
||||
value2 = 0;
|
||||
@@ -492,7 +496,8 @@ ParseSpacingAttribute(nsMathMLmtableFrame* aFrame, nsIAtom* aAttribute)
|
||||
}
|
||||
|
||||
nsTArray<nscoord> valueList;
|
||||
ExtractSpacingValues(attrValue, aAttribute, valueList, aFrame, value, value2);
|
||||
ExtractSpacingValues(attrValue, aAttribute, valueList, aFrame, value, value2,
|
||||
fontSizeInflation);
|
||||
if (valueList.Length() == 0) {
|
||||
if (frameContent->HasAttr(kNameSpaceID_None, aAttribute)) {
|
||||
ReportParseError(aFrame, aAttribute->GetUTF16String(),
|
||||
@@ -856,7 +861,9 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
default: {
|
||||
// XXX should instead use style data from the row of reference here ?
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::
|
||||
FontSizeInflationFor(this));
|
||||
nscoord axisHeight;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
if (rowFrame) {
|
||||
|
||||
@@ -305,6 +305,7 @@ nsMathMLmunderoverFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
bool aPlaceOrigin,
|
||||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
||||
StyleFont()->mMathDisplay == NS_MATHML_DISPLAYSTYLE_INLINE) {
|
||||
@@ -314,20 +315,23 @@ nsMathMLmunderoverFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
aRenderingContext,
|
||||
aPlaceOrigin,
|
||||
aDesiredSize,
|
||||
this, 0, 0);
|
||||
this, 0, 0,
|
||||
fontSizeInflation);
|
||||
} else if (tag == nsGkAtoms::munder_) {
|
||||
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(PresContext(),
|
||||
aRenderingContext,
|
||||
aPlaceOrigin,
|
||||
aDesiredSize,
|
||||
this, 0, 0);
|
||||
this, 0, 0,
|
||||
fontSizeInflation);
|
||||
} else {
|
||||
NS_ASSERTION(tag == nsGkAtoms::mover_, "mContent->Tag() not recognized");
|
||||
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(PresContext(),
|
||||
aRenderingContext,
|
||||
aPlaceOrigin,
|
||||
aDesiredSize,
|
||||
this, 0, 0);
|
||||
this, 0, 0,
|
||||
fontSizeInflation);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -395,7 +399,8 @@ nsMathMLmunderoverFrame::Place(nsRenderingContext& aRenderingContext,
|
||||
// Place Children
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
fontSizeInflation);
|
||||
|
||||
nscoord xHeight = fm->XHeight();
|
||||
nscoord oneDevPixel = fm->AppUnitsPerDevPixel();
|
||||
|
||||
Reference in new issue
Block a user