зеркало из 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)) {
|
||||
auto str = value->GetStringValue();
|
||||
static const char displaystyles[][6] = {"false", "true"};
|
||||
static const uint8_t mathStyle[MOZ_ARRAY_LENGTH(displaystyles)] = {
|
||||
NS_STYLE_MATH_STYLE_COMPACT, NS_STYLE_MATH_STYLE_NORMAL};
|
||||
static const StyleMathStyle mathStyle[MOZ_ARRAY_LENGTH(displaystyles)] = {
|
||||
StyleMathStyle::Compact, StyleMathStyle::Normal};
|
||||
for (uint32_t i = 0; i < ArrayLength(displaystyles); ++i) {
|
||||
if (str.LowerCaseEqualsASCII(displaystyles[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 (IsToDraw(NOTATION_LONGDIV) || IsToDraw(NOTATION_RADICAL)) {
|
||||
GetRadicalParameters(fm,
|
||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL,
|
||||
GetRadicalParameters(fm, StyleFont()->mMathStyle == StyleMathStyle::Normal,
|
||||
mRadicalRuleThickness, leading, psi);
|
||||
|
||||
// make sure that the rule appears on on screen
|
||||
|
|
|
@ -43,7 +43,7 @@ eMathMLFrameType nsMathMLmfracFrame::GetMathMLFrameType() {
|
|||
}
|
||||
|
||||
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)) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ nsMathMLmfracFrame::TransmitAutomaticData() {
|
|||
|
||||
// If displaystyle is false, then scriptlevel is incremented, so notify the
|
||||
// children of this.
|
||||
if (StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT) {
|
||||
if (StyleFont()->mMathStyle == StyleMathStyle::Compact) {
|
||||
PropagateFrameFlagFor(mFrames.FirstChild(),
|
||||
NS_FRAME_MATHML_SCRIPT_DESCENDANT);
|
||||
PropagateFrameFlagFor(mFrames.LastChild(),
|
||||
|
@ -197,7 +197,7 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
|||
CalcLineThickness(presContext, mComputedStyle, value, onePixel,
|
||||
defaultRuleThickness, fontSizeInflation);
|
||||
|
||||
bool displayStyle = StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL;
|
||||
bool displayStyle = StyleFont()->mMathStyle == StyleMathStyle::Compact;
|
||||
|
||||
mLineRect.height = mLineThickness;
|
||||
|
||||
|
|
|
@ -229,8 +229,7 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
|||
|
||||
// get sup script shift depending on current script level and display style
|
||||
// Rule 18c, App. G, TeXbook
|
||||
if (font->mMathDepth == 0 &&
|
||||
font->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL &&
|
||||
if (font->mMathDepth == 0 && font->mMathStyle == StyleMathStyle::Normal &&
|
||||
!NS_MATHML_IS_COMPRESSED(presentationData.flags)) {
|
||||
// Style D in TeXbook
|
||||
supScriptShift = supScriptShift1;
|
||||
|
|
|
@ -553,7 +553,7 @@ static uint32_t GetStretchHint(nsOperatorFlags aFlags,
|
|||
// stretchy are true or false (see bug 69325).
|
||||
// . largeopOnly is taken if largeop=true and stretchy=false
|
||||
// . 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)) {
|
||||
stretchHint = NS_STRETCH_LARGEOP; // (largeopOnly, not mask!)
|
||||
if (NS_MATHML_OPERATOR_IS_STRETCHY(aFlags)) {
|
||||
|
@ -946,7 +946,7 @@ nsresult nsMathMLmoFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
|||
Stretch() method.
|
||||
*/
|
||||
|
||||
if (!aPlaceOrigin && StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL &&
|
||||
if (!aPlaceOrigin && StyleFont()->mMathStyle == StyleMathStyle::Normal &&
|
||||
NS_MATHML_OPERATOR_IS_LARGEOP(mFlags) && UseMathMLChar()) {
|
||||
nsBoundingMetrics newMetrics;
|
||||
rv = mMathMLChar.Stretch(
|
||||
|
|
|
@ -228,8 +228,7 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
|
||||
nscoord ruleThickness, leading, psi;
|
||||
GetRadicalParameters(fm,
|
||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL,
|
||||
GetRadicalParameters(fm, StyleFont()->mMathStyle == StyleMathStyle::Normal,
|
||||
ruleThickness, leading, psi);
|
||||
|
||||
// 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
|
||||
// subscript-superscript pair
|
||||
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;
|
||||
} else {
|
||||
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 =
|
||||
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
|
||||
if (subsupDisplay) {
|
||||
|
@ -351,7 +351,7 @@ The REC says:
|
|||
|
||||
i.e.,:
|
||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishDataflags) &&
|
||||
StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_COMPACT) {
|
||||
StyleFont()->mMathStyle == StyleMathStyle::Compact) {
|
||||
// place like subscript-superscript pair
|
||||
}
|
||||
else {
|
||||
|
@ -365,7 +365,7 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
|||
ReflowOutput& aDesiredSize) {
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
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
|
||||
if (mContent->IsMathMLElement(nsGkAtoms::munderover_)) {
|
||||
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
|
|
|
@ -110,6 +110,7 @@ rusty-enums = [
|
|||
"mozilla::StyleShapeSourceType",
|
||||
"mozilla::StyleVisibility",
|
||||
"mozilla::StyleBasicShapeType",
|
||||
"mozilla::StyleMathStyle",
|
||||
"nsStyleImageLayers_Size_DimensionType",
|
||||
"mozilla::StyleBorderCollapse",
|
||||
"mozilla::StyleBorderImageRepeat",
|
||||
|
|
|
@ -390,8 +390,7 @@ enum class StyleMathVariant : uint8_t {
|
|||
};
|
||||
|
||||
// See nsStyleFont::mMathStyle
|
||||
#define NS_STYLE_MATH_STYLE_COMPACT 0
|
||||
#define NS_STYLE_MATH_STYLE_NORMAL 1
|
||||
enum class StyleMathStyle : uint8_t { Compact = 0, Normal = 1 };
|
||||
|
||||
// See nsStyleDisplay.mPosition
|
||||
enum class StylePositionProperty : uint8_t {
|
||||
|
|
|
@ -232,7 +232,7 @@ nsStyleFont::nsStyleFont(const Document& aDocument)
|
|||
mFontPalette(StyleFontPalette::Normal()),
|
||||
mMathDepth(0),
|
||||
mMathVariant(StyleMathVariant::None),
|
||||
mMathStyle(NS_STYLE_MATH_STYLE_NORMAL),
|
||||
mMathStyle(StyleMathStyle::Normal),
|
||||
mMinFontSizeRatio(100), // 100%
|
||||
mExplicitLanguage(false),
|
||||
mAllowZoomAndMinSize(true),
|
||||
|
|
|
@ -140,7 +140,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
|
|||
// MathML mathvariant support
|
||||
mozilla::StyleMathVariant mMathVariant;
|
||||
// math-style support (used for MathML displaystyle)
|
||||
uint8_t mMathStyle;
|
||||
mozilla::StyleMathStyle mMathStyle;
|
||||
|
||||
// allow different min font-size for certain cases
|
||||
uint8_t mMinFontSizeRatio; // percent * 100
|
||||
|
|
|
@ -269,6 +269,7 @@ ${helpers.single_keyword(
|
|||
"math-style",
|
||||
"normal compact",
|
||||
engines="gecko",
|
||||
gecko_enum_prefix="StyleMathStyle",
|
||||
gecko_pref="layout.css.math-style.enabled",
|
||||
spec="https://mathml-refresh.github.io/mathml-core/#the-math-style-property",
|
||||
has_effect_on_gecko_scrollbars=False,
|
||||
|
|
Загрузка…
Ссылка в новой задаче