зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1797012 - Change NS_STYLE_MATH_STYLE_* macros to enum StyleMathStyle. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160016
This commit is contained in:
Родитель
5bc9f5b9ac
Коммит
15eb00a7bf
|
@ -593,8 +593,8 @@ void MathMLElement::MapMathMLAttributesInto(
|
||||||
!aDecls.PropertyIsSet(eCSSProperty_math_style)) {
|
!aDecls.PropertyIsSet(eCSSProperty_math_style)) {
|
||||||
auto str = value->GetStringValue();
|
auto str = value->GetStringValue();
|
||||||
static const char displaystyles[][6] = {"false", "true"};
|
static const char displaystyles[][6] = {"false", "true"};
|
||||||
static const uint8_t mathStyle[MOZ_ARRAY_LENGTH(displaystyles)] = {
|
static const StyleMathStyle mathStyle[MOZ_ARRAY_LENGTH(displaystyles)] = {
|
||||||
NS_STYLE_MATH_STYLE_COMPACT, NS_STYLE_MATH_STYLE_NORMAL};
|
StyleMathStyle::Compact, StyleMathStyle::Normal};
|
||||||
for (uint32_t i = 0; i < ArrayLength(displaystyles); ++i) {
|
for (uint32_t i = 0; i < ArrayLength(displaystyles); ++i) {
|
||||||
if (str.LowerCaseEqualsASCII(displaystyles[i])) {
|
if (str.LowerCaseEqualsASCII(displaystyles[i])) {
|
||||||
aDecls.SetKeywordValue(eCSSProperty_math_style, mathStyle[i]);
|
aDecls.SetKeywordValue(eCSSProperty_math_style, mathStyle[i]);
|
||||||
|
|
|
@ -362,8 +362,7 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||||
if (delta) padding += onePixel - delta; // round up
|
if (delta) padding += onePixel - delta; // round up
|
||||||
|
|
||||||
if (IsToDraw(NOTATION_LONGDIV) || IsToDraw(NOTATION_RADICAL)) {
|
if (IsToDraw(NOTATION_LONGDIV) || IsToDraw(NOTATION_RADICAL)) {
|
||||||
GetRadicalParameters(fm,
|
GetRadicalParameters(fm, StyleFont()->mMathStyle == StyleMathStyle::Normal,
|
||||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL,
|
|
||||||
mRadicalRuleThickness, leading, psi);
|
mRadicalRuleThickness, leading, psi);
|
||||||
|
|
||||||
// make sure that the rule appears on on screen
|
// make sure that the rule appears on on screen
|
||||||
|
|
|
@ -43,7 +43,7 @@ eMathMLFrameType nsMathMLmfracFrame::GetMathMLFrameType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t nsMathMLmfracFrame::ScriptIncrement(nsIFrame* aFrame) {
|
uint8_t nsMathMLmfracFrame::ScriptIncrement(nsIFrame* aFrame) {
|
||||||
if (StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT && aFrame &&
|
if (StyleFont()->mMathStyle == StyleMathStyle::Compact && aFrame &&
|
||||||
(mFrames.FirstChild() == aFrame || mFrames.LastChild() == aFrame)) {
|
(mFrames.FirstChild() == aFrame || mFrames.LastChild() == aFrame)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ nsMathMLmfracFrame::TransmitAutomaticData() {
|
||||||
|
|
||||||
// If displaystyle is false, then scriptlevel is incremented, so notify the
|
// If displaystyle is false, then scriptlevel is incremented, so notify the
|
||||||
// children of this.
|
// children of this.
|
||||||
if (StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT) {
|
if (StyleFont()->mMathStyle == StyleMathStyle::Compact) {
|
||||||
PropagateFrameFlagFor(mFrames.FirstChild(),
|
PropagateFrameFlagFor(mFrames.FirstChild(),
|
||||||
NS_FRAME_MATHML_SCRIPT_DESCENDANT);
|
NS_FRAME_MATHML_SCRIPT_DESCENDANT);
|
||||||
PropagateFrameFlagFor(mFrames.LastChild(),
|
PropagateFrameFlagFor(mFrames.LastChild(),
|
||||||
|
@ -197,7 +197,7 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||||
CalcLineThickness(presContext, mComputedStyle, value, onePixel,
|
CalcLineThickness(presContext, mComputedStyle, value, onePixel,
|
||||||
defaultRuleThickness, fontSizeInflation);
|
defaultRuleThickness, fontSizeInflation);
|
||||||
|
|
||||||
bool displayStyle = StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL;
|
bool displayStyle = StyleFont()->mMathStyle == StyleMathStyle::Compact;
|
||||||
|
|
||||||
mLineRect.height = mLineThickness;
|
mLineRect.height = mLineThickness;
|
||||||
|
|
||||||
|
|
|
@ -229,8 +229,7 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||||
|
|
||||||
// get sup script shift depending on current script level and display style
|
// get sup script shift depending on current script level and display style
|
||||||
// Rule 18c, App. G, TeXbook
|
// Rule 18c, App. G, TeXbook
|
||||||
if (font->mMathDepth == 0 &&
|
if (font->mMathDepth == 0 && font->mMathStyle == StyleMathStyle::Normal &&
|
||||||
font->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL &&
|
|
||||||
!NS_MATHML_IS_COMPRESSED(presentationData.flags)) {
|
!NS_MATHML_IS_COMPRESSED(presentationData.flags)) {
|
||||||
// Style D in TeXbook
|
// Style D in TeXbook
|
||||||
supScriptShift = supScriptShift1;
|
supScriptShift = supScriptShift1;
|
||||||
|
|
|
@ -553,7 +553,7 @@ static uint32_t GetStretchHint(nsOperatorFlags aFlags,
|
||||||
// stretchy are true or false (see bug 69325).
|
// stretchy are true or false (see bug 69325).
|
||||||
// . largeopOnly is taken if largeop=true and stretchy=false
|
// . largeopOnly is taken if largeop=true and stretchy=false
|
||||||
// . largeop is taken if largeop=true and stretchy=true
|
// . largeop is taken if largeop=true and stretchy=true
|
||||||
if (aStyleFont->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL &&
|
if (aStyleFont->mMathStyle == StyleMathStyle::Normal &&
|
||||||
NS_MATHML_OPERATOR_IS_LARGEOP(aFlags)) {
|
NS_MATHML_OPERATOR_IS_LARGEOP(aFlags)) {
|
||||||
stretchHint = NS_STRETCH_LARGEOP; // (largeopOnly, not mask!)
|
stretchHint = NS_STRETCH_LARGEOP; // (largeopOnly, not mask!)
|
||||||
if (NS_MATHML_OPERATOR_IS_STRETCHY(aFlags)) {
|
if (NS_MATHML_OPERATOR_IS_STRETCHY(aFlags)) {
|
||||||
|
@ -946,7 +946,7 @@ nsresult nsMathMLmoFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||||
Stretch() method.
|
Stretch() method.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!aPlaceOrigin && StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL &&
|
if (!aPlaceOrigin && StyleFont()->mMathStyle == StyleMathStyle::Normal &&
|
||||||
NS_MATHML_OPERATOR_IS_LARGEOP(mFlags) && UseMathMLChar()) {
|
NS_MATHML_OPERATOR_IS_LARGEOP(mFlags) && UseMathMLChar()) {
|
||||||
nsBoundingMetrics newMetrics;
|
nsBoundingMetrics newMetrics;
|
||||||
rv = mMathMLChar.Stretch(
|
rv = mMathMLChar.Stretch(
|
||||||
|
|
|
@ -228,8 +228,7 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||||
|
|
||||||
nscoord ruleThickness, leading, psi;
|
nscoord ruleThickness, leading, psi;
|
||||||
GetRadicalParameters(fm,
|
GetRadicalParameters(fm, StyleFont()->mMathStyle == StyleMathStyle::Normal,
|
||||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL,
|
|
||||||
ruleThickness, leading, psi);
|
ruleThickness, leading, psi);
|
||||||
|
|
||||||
// built-in: adjust clearance psi to emulate \mathstrut using '1' (TexBook,
|
// built-in: adjust clearance psi to emulate \mathstrut using '1' (TexBook,
|
||||||
|
|
|
@ -57,7 +57,7 @@ nsMathMLmunderoverFrame::UpdatePresentationData(uint32_t aFlagsValues,
|
||||||
// disable the stretch-all flag if we are going to act like a
|
// disable the stretch-all flag if we are going to act like a
|
||||||
// subscript-superscript pair
|
// subscript-superscript pair
|
||||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
||||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT) {
|
StyleFont()->mMathStyle == StyleMathStyle::Compact) {
|
||||||
mPresentationData.flags &= ~NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
mPresentationData.flags &= ~NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||||
} else {
|
} else {
|
||||||
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY;
|
||||||
|
@ -257,7 +257,7 @@ XXX The winner is the outermost setting in conflicting settings like these:
|
||||||
|
|
||||||
bool subsupDisplay =
|
bool subsupDisplay =
|
||||||
NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
||||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT;
|
StyleFont()->mMathStyle == StyleMathStyle::Compact;
|
||||||
|
|
||||||
// disable the stretch-all flag if we are going to act like a superscript
|
// disable the stretch-all flag if we are going to act like a superscript
|
||||||
if (subsupDisplay) {
|
if (subsupDisplay) {
|
||||||
|
@ -351,7 +351,7 @@ The REC says:
|
||||||
|
|
||||||
i.e.,:
|
i.e.,:
|
||||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishDataflags) &&
|
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishDataflags) &&
|
||||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT) {
|
StyleFont()->mMathStyle == StyleMathStyle::Compact) {
|
||||||
// place like subscript-superscript pair
|
// place like subscript-superscript pair
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -365,7 +365,7 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||||
ReflowOutput& aDesiredSize) {
|
ReflowOutput& aDesiredSize) {
|
||||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
||||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT) {
|
StyleFont()->mMathStyle == StyleMathStyle::Compact) {
|
||||||
// place like sub sup or subsup
|
// place like sub sup or subsup
|
||||||
if (mContent->IsMathMLElement(nsGkAtoms::munderover_)) {
|
if (mContent->IsMathMLElement(nsGkAtoms::munderover_)) {
|
||||||
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||||
|
|
|
@ -110,6 +110,7 @@ rusty-enums = [
|
||||||
"mozilla::StyleShapeSourceType",
|
"mozilla::StyleShapeSourceType",
|
||||||
"mozilla::StyleVisibility",
|
"mozilla::StyleVisibility",
|
||||||
"mozilla::StyleBasicShapeType",
|
"mozilla::StyleBasicShapeType",
|
||||||
|
"mozilla::StyleMathStyle",
|
||||||
"nsStyleImageLayers_Size_DimensionType",
|
"nsStyleImageLayers_Size_DimensionType",
|
||||||
"mozilla::StyleBorderCollapse",
|
"mozilla::StyleBorderCollapse",
|
||||||
"mozilla::StyleBorderImageRepeat",
|
"mozilla::StyleBorderImageRepeat",
|
||||||
|
|
|
@ -390,8 +390,7 @@ enum class StyleMathVariant : uint8_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
// See nsStyleFont::mMathStyle
|
// See nsStyleFont::mMathStyle
|
||||||
#define NS_STYLE_MATH_STYLE_COMPACT 0
|
enum class StyleMathStyle : uint8_t { Compact = 0, Normal = 1 };
|
||||||
#define NS_STYLE_MATH_STYLE_NORMAL 1
|
|
||||||
|
|
||||||
// See nsStyleDisplay.mPosition
|
// See nsStyleDisplay.mPosition
|
||||||
enum class StylePositionProperty : uint8_t {
|
enum class StylePositionProperty : uint8_t {
|
||||||
|
|
|
@ -232,7 +232,7 @@ nsStyleFont::nsStyleFont(const Document& aDocument)
|
||||||
mFontPalette(StyleFontPalette::Normal()),
|
mFontPalette(StyleFontPalette::Normal()),
|
||||||
mMathDepth(0),
|
mMathDepth(0),
|
||||||
mMathVariant(StyleMathVariant::None),
|
mMathVariant(StyleMathVariant::None),
|
||||||
mMathStyle(NS_STYLE_MATH_STYLE_NORMAL),
|
mMathStyle(StyleMathStyle::Normal),
|
||||||
mMinFontSizeRatio(100), // 100%
|
mMinFontSizeRatio(100), // 100%
|
||||||
mExplicitLanguage(false),
|
mExplicitLanguage(false),
|
||||||
mAllowZoomAndMinSize(true),
|
mAllowZoomAndMinSize(true),
|
||||||
|
|
|
@ -140,7 +140,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
|
||||||
// MathML mathvariant support
|
// MathML mathvariant support
|
||||||
mozilla::StyleMathVariant mMathVariant;
|
mozilla::StyleMathVariant mMathVariant;
|
||||||
// math-style support (used for MathML displaystyle)
|
// math-style support (used for MathML displaystyle)
|
||||||
uint8_t mMathStyle;
|
mozilla::StyleMathStyle mMathStyle;
|
||||||
|
|
||||||
// allow different min font-size for certain cases
|
// allow different min font-size for certain cases
|
||||||
uint8_t mMinFontSizeRatio; // percent * 100
|
uint8_t mMinFontSizeRatio; // percent * 100
|
||||||
|
|
|
@ -269,6 +269,7 @@ ${helpers.single_keyword(
|
||||||
"math-style",
|
"math-style",
|
||||||
"normal compact",
|
"normal compact",
|
||||||
engines="gecko",
|
engines="gecko",
|
||||||
|
gecko_enum_prefix="StyleMathStyle",
|
||||||
gecko_pref="layout.css.math-style.enabled",
|
gecko_pref="layout.css.math-style.enabled",
|
||||||
spec="https://mathml-refresh.github.io/mathml-core/#the-math-style-property",
|
spec="https://mathml-refresh.github.io/mathml-core/#the-math-style-property",
|
||||||
has_effect_on_gecko_scrollbars=False,
|
has_effect_on_gecko_scrollbars=False,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче