Bug 1667118 - Rename -moz-math-script-level to math-depth. r=emilio
This renames the internal -moz-math-script-level property in order to prepare for full math-depth support. Currently, the property is guarded under a disabled-by-default flag, so there should be no observable behavior change. Differential Revision: https://phabricator.services.mozilla.com/D91285
This commit is contained in:
@@ -61,6 +61,15 @@ let whitelist = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (!Services.prefs.getBoolPref("layout.css.math-depth.enabled")) {
|
||||||
|
// mathml.css UA sheet rule for math-depth.
|
||||||
|
whitelist.push({
|
||||||
|
sourceName: /(?:res|gre-resources)\/mathml\.css$/i,
|
||||||
|
errorMessage: /Unknown property .*\bmath-depth\b/i,
|
||||||
|
isFromDevTools: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!Services.prefs.getBoolPref("layout.css.math-style.enabled")) {
|
if (!Services.prefs.getBoolPref("layout.css.math-style.enabled")) {
|
||||||
// mathml.css UA sheet rule for math-style.
|
// mathml.css UA sheet rule for math-style.
|
||||||
whitelist.push({
|
whitelist.push({
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
|
|||||||
"padding-block-start",
|
"padding-block-start",
|
||||||
"padding-inline-end",
|
"padding-inline-end",
|
||||||
"padding-inline-start",
|
"padding-inline-start",
|
||||||
"-moz-script-level",
|
"math-depth",
|
||||||
"-moz-top-layer",
|
"-moz-top-layer",
|
||||||
"transition-delay",
|
"transition-delay",
|
||||||
"transition-duration",
|
"transition-duration",
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ void MathMLElement::MapMathMLAttributesInto(
|
|||||||
//
|
//
|
||||||
value = aAttributes->GetAttr(nsGkAtoms::scriptlevel_);
|
value = aAttributes->GetAttr(nsGkAtoms::scriptlevel_);
|
||||||
if (value && value->Type() == nsAttrValue::eString &&
|
if (value && value->Type() == nsAttrValue::eString &&
|
||||||
!aDecls.PropertyIsSet(eCSSProperty__moz_script_level)) {
|
!aDecls.PropertyIsSet(eCSSProperty_math_depth)) {
|
||||||
auto str = value->GetStringValue();
|
auto str = value->GetStringValue();
|
||||||
str.CompressWhitespace();
|
str.CompressWhitespace();
|
||||||
if (str.Length() > 0) {
|
if (str.Length() > 0) {
|
||||||
@@ -452,11 +452,13 @@ void MathMLElement::MapMathMLAttributesInto(
|
|||||||
// then it's a relative value and we store the nsCSSValue as an
|
// then it's a relative value and we store the nsCSSValue as an
|
||||||
// Integer to indicate that. Otherwise we store it as a Number
|
// Integer to indicate that. Otherwise we store it as a Number
|
||||||
// to indicate that the scriptlevel is absolute.
|
// to indicate that the scriptlevel is absolute.
|
||||||
|
// XXX Bug 1667090: Use math-depth: add(<integer>) for relative values
|
||||||
|
// and and math-depth: <integer> for absolute values.
|
||||||
char16_t ch = str.CharAt(0);
|
char16_t ch = str.CharAt(0);
|
||||||
if (ch == '+' || ch == '-') {
|
if (ch == '+' || ch == '-') {
|
||||||
aDecls.SetIntValue(eCSSProperty__moz_script_level, intValue);
|
aDecls.SetIntValue(eCSSProperty_math_depth, intValue);
|
||||||
} else {
|
} else {
|
||||||
aDecls.SetNumberValue(eCSSProperty__moz_script_level, intValue);
|
aDecls.SetNumberValue(eCSSProperty_math_depth, intValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ReportParseErrorNoTag(str, nsGkAtoms::scriptlevel_, aDecls.Document());
|
ReportParseErrorNoTag(str, nsGkAtoms::scriptlevel_, aDecls.Document());
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ ms[rquote]:after {
|
|||||||
- mathvariant -> -moz-math-variant
|
- mathvariant -> -moz-math-variant
|
||||||
- scriptsizemultiplier -> -moz-script-size-multiplier
|
- scriptsizemultiplier -> -moz-script-size-multiplier
|
||||||
- scriptminsize -> -moz-script-min-size
|
- scriptminsize -> -moz-script-min-size
|
||||||
- scriptlevel -> -moz-script-level
|
- scriptlevel -> math-depth
|
||||||
- mathsize -> font-size
|
- mathsize -> font-size
|
||||||
- mathcolor -> color
|
- mathcolor -> color
|
||||||
- mathbackground -> background
|
- mathbackground -> background
|
||||||
@@ -226,14 +226,14 @@ mtable[framespacing] > mtr > mtd {
|
|||||||
insufficient to control when the scriptlevel should be incremented. All other
|
insufficient to control when the scriptlevel should be incremented. All other
|
||||||
cases can be described using regular CSS, so we do it this way because it's
|
cases can be described using regular CSS, so we do it this way because it's
|
||||||
more efficient and less code. */
|
more efficient and less code. */
|
||||||
:-moz-math-increment-script-level { -moz-script-level: +1; }
|
:-moz-math-increment-script-level { math-depth: +1; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The mfrac element sets displaystyle to "false", or if it was already false
|
The mfrac element sets displaystyle to "false", or if it was already false
|
||||||
increments scriptlevel by 1, within numerator and denominator.
|
increments scriptlevel by 1, within numerator and denominator.
|
||||||
*/
|
*/
|
||||||
mfrac > * {
|
mfrac > * {
|
||||||
-moz-script-level: auto;
|
math-depth: auto;
|
||||||
math-style: compact;
|
math-style: compact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ mfrac > * {
|
|||||||
The msqrt element leaves both attributes unchanged within its argument.
|
The msqrt element leaves both attributes unchanged within its argument.
|
||||||
*/
|
*/
|
||||||
mroot > :not(:first-child) {
|
mroot > :not(:first-child) {
|
||||||
-moz-script-level: +2;
|
math-depth: +2;
|
||||||
math-style: compact;
|
math-style: compact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ msub > :not(:first-child),
|
|||||||
msup > :not(:first-child),
|
msup > :not(:first-child),
|
||||||
msubsup > :not(:first-child),
|
msubsup > :not(:first-child),
|
||||||
mmultiscripts > :not(:first-child) {
|
mmultiscripts > :not(:first-child) {
|
||||||
-moz-script-level: +1;
|
math-depth: +1;
|
||||||
math-style: compact;
|
math-style: compact;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ mtable { math-style: compact; }
|
|||||||
scriptlevel by 1, so the children are typically displayed in a smaller font.
|
scriptlevel by 1, so the children are typically displayed in a smaller font.
|
||||||
XXXfredw: This element is not implemented yet. See bug 534967.
|
XXXfredw: This element is not implemented yet. See bug 534967.
|
||||||
mscarries {
|
mscarries {
|
||||||
-moz-script-level: +1;
|
math-depth: +1;
|
||||||
math-style: compact;
|
math-style: compact;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1142,7 +1142,7 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
|
|||||||
// add inter frame spacing
|
// add inter frame spacing
|
||||||
const nsStyleFont* font = mParentFrame->StyleFont();
|
const nsStyleFont* font = mParentFrame->StyleFont();
|
||||||
nscoord space =
|
nscoord space =
|
||||||
GetInterFrameSpacing(font->mScriptLevel, prevFrameType, mChildFrameType,
|
GetInterFrameSpacing(font->mMathDepth, prevFrameType, mChildFrameType,
|
||||||
&mFromFrameType, &mCarrySpace);
|
&mFromFrameType, &mCarrySpace);
|
||||||
mX += space * GetThinSpace(font);
|
mX += space * GetThinSpace(font);
|
||||||
return *this;
|
return *this;
|
||||||
@@ -1293,7 +1293,7 @@ static nscoord AddInterFrameSpacingToSize(ReflowOutput& aDesiredSize,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (parentContent->IsAnyOfMathMLElements(nsGkAtoms::math, nsGkAtoms::mtd_)) {
|
if (parentContent->IsAnyOfMathMLElements(nsGkAtoms::math, nsGkAtoms::mtd_)) {
|
||||||
gap = GetInterFrameSpacingFor(aFrame->StyleFont()->mScriptLevel, parent,
|
gap = GetInterFrameSpacingFor(aFrame->StyleFont()->mMathDepth, parent,
|
||||||
aFrame);
|
aFrame);
|
||||||
// add our own italic correction
|
// add our own italic correction
|
||||||
nscoord leftCorrection = 0, italicCorrection = 0;
|
nscoord leftCorrection = 0, italicCorrection = 0;
|
||||||
|
|||||||
@@ -333,19 +333,19 @@ void nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
/////////////////
|
/////////////////
|
||||||
// opening fence ...
|
// opening fence ...
|
||||||
ReflowChar(drawTarget, *fm, fontSizeInflation, mOpenChar,
|
ReflowChar(drawTarget, *fm, fontSizeInflation, mOpenChar,
|
||||||
NS_MATHML_OPERATOR_FORM_PREFIX, font->mScriptLevel, axisHeight,
|
NS_MATHML_OPERATOR_FORM_PREFIX, font->mMathDepth, axisHeight,
|
||||||
leading, em, containerSize, ascent, descent, isRTL);
|
leading, em, containerSize, ascent, descent, isRTL);
|
||||||
/////////////////
|
/////////////////
|
||||||
// separators ...
|
// separators ...
|
||||||
for (i = 0; i < mSeparatorsCount; i++) {
|
for (i = 0; i < mSeparatorsCount; i++) {
|
||||||
ReflowChar(drawTarget, *fm, fontSizeInflation, &mSeparatorsChar[i],
|
ReflowChar(drawTarget, *fm, fontSizeInflation, &mSeparatorsChar[i],
|
||||||
NS_MATHML_OPERATOR_FORM_INFIX, font->mScriptLevel, axisHeight,
|
NS_MATHML_OPERATOR_FORM_INFIX, font->mMathDepth, axisHeight,
|
||||||
leading, em, containerSize, ascent, descent, isRTL);
|
leading, em, containerSize, ascent, descent, isRTL);
|
||||||
}
|
}
|
||||||
/////////////////
|
/////////////////
|
||||||
// closing fence ...
|
// closing fence ...
|
||||||
ReflowChar(drawTarget, *fm, fontSizeInflation, mCloseChar,
|
ReflowChar(drawTarget, *fm, fontSizeInflation, mCloseChar,
|
||||||
NS_MATHML_OPERATOR_FORM_POSTFIX, font->mScriptLevel, axisHeight,
|
NS_MATHML_OPERATOR_FORM_POSTFIX, font->mMathDepth, axisHeight,
|
||||||
leading, em, containerSize, ascent, descent, isRTL);
|
leading, em, containerSize, ascent, descent, isRTL);
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
@@ -574,7 +574,7 @@ void nsMathMLmfencedFrame::GetIntrinsicISizeMetrics(
|
|||||||
if (mOpenChar) {
|
if (mOpenChar) {
|
||||||
width += GetMaxCharWidth(
|
width += GetMaxCharWidth(
|
||||||
this, aRenderingContext->GetDrawTarget(), fontSizeInflation, mOpenChar,
|
this, aRenderingContext->GetDrawTarget(), fontSizeInflation, mOpenChar,
|
||||||
NS_MATHML_OPERATOR_FORM_PREFIX, font->mScriptLevel, em);
|
NS_MATHML_OPERATOR_FORM_PREFIX, font->mMathDepth, em);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
@@ -586,10 +586,10 @@ void nsMathMLmfencedFrame::GetIntrinsicISizeMetrics(
|
|||||||
nsLayoutUtils::PREF_ISIZE);
|
nsLayoutUtils::PREF_ISIZE);
|
||||||
|
|
||||||
if (i < mSeparatorsCount) {
|
if (i < mSeparatorsCount) {
|
||||||
width += GetMaxCharWidth(this, aRenderingContext->GetDrawTarget(),
|
width +=
|
||||||
fontSizeInflation, &mSeparatorsChar[i],
|
GetMaxCharWidth(this, aRenderingContext->GetDrawTarget(),
|
||||||
NS_MATHML_OPERATOR_FORM_INFIX,
|
fontSizeInflation, &mSeparatorsChar[i],
|
||||||
font->mScriptLevel, em);
|
NS_MATHML_OPERATOR_FORM_INFIX, font->mMathDepth, em);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -597,7 +597,7 @@ void nsMathMLmfencedFrame::GetIntrinsicISizeMetrics(
|
|||||||
if (mCloseChar) {
|
if (mCloseChar) {
|
||||||
width += GetMaxCharWidth(
|
width += GetMaxCharWidth(
|
||||||
this, aRenderingContext->GetDrawTarget(), fontSizeInflation, mCloseChar,
|
this, aRenderingContext->GetDrawTarget(), fontSizeInflation, mCloseChar,
|
||||||
NS_MATHML_OPERATOR_FORM_POSTFIX, font->mScriptLevel, em);
|
NS_MATHML_OPERATOR_FORM_POSTFIX, font->mMathDepth, em);
|
||||||
}
|
}
|
||||||
|
|
||||||
aDesiredSize.Width() = width;
|
aDesiredSize.Width() = width;
|
||||||
|
|||||||
@@ -267,7 +267,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->mScriptLevel == 0 &&
|
if (font->mMathDepth == 0 &&
|
||||||
font->mMathStyle == NS_STYLE_MATH_STYLE_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
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ void nsMathMLmoFrame::ProcessOperatorData() {
|
|||||||
// tuning if we don't want too much extra space when we are a script.
|
// tuning if we don't want too much extra space when we are a script.
|
||||||
// (with its fonts, TeX sets lspace=0 & rspace=0 as soon as scriptlevel>0.
|
// (with its fonts, TeX sets lspace=0 & rspace=0 as soon as scriptlevel>0.
|
||||||
// Our fonts can be anything, so...)
|
// Our fonts can be anything, so...)
|
||||||
if (StyleFont()->mScriptLevel > 0 &&
|
if (StyleFont()->mMathDepth > 0 &&
|
||||||
!NS_MATHML_OPERATOR_HAS_EMBELLISH_ANCESTOR(mFlags)) {
|
!NS_MATHML_OPERATOR_HAS_EMBELLISH_ANCESTOR(mFlags)) {
|
||||||
mEmbellishData.leadingSpace /= 2;
|
mEmbellishData.leadingSpace /= 2;
|
||||||
mEmbellishData.trailingSpace /= 2;
|
mEmbellishData.trailingSpace /= 2;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ nsStyleFont::nsStyleFont(const nsStyleFont& aSrc)
|
|||||||
mFontSizeOffset(aSrc.mFontSizeOffset),
|
mFontSizeOffset(aSrc.mFontSizeOffset),
|
||||||
mFontSizeKeyword(aSrc.mFontSizeKeyword),
|
mFontSizeKeyword(aSrc.mFontSizeKeyword),
|
||||||
mGenericID(aSrc.mGenericID),
|
mGenericID(aSrc.mGenericID),
|
||||||
mScriptLevel(aSrc.mScriptLevel),
|
mMathDepth(aSrc.mMathDepth),
|
||||||
mMathVariant(aSrc.mMathVariant),
|
mMathVariant(aSrc.mMathVariant),
|
||||||
mMathStyle(aSrc.mMathStyle),
|
mMathStyle(aSrc.mMathStyle),
|
||||||
mMinFontSizeRatio(aSrc.mMinFontSizeRatio),
|
mMinFontSizeRatio(aSrc.mMinFontSizeRatio),
|
||||||
@@ -247,7 +247,7 @@ nsStyleFont::nsStyleFont(const Document& aDocument)
|
|||||||
mFontSizeOffset{0},
|
mFontSizeOffset{0},
|
||||||
mFontSizeKeyword(StyleFontSizeKeyword::Medium),
|
mFontSizeKeyword(StyleFontSizeKeyword::Medium),
|
||||||
mGenericID(StyleGenericFontFamily::None),
|
mGenericID(StyleGenericFontFamily::None),
|
||||||
mScriptLevel(0),
|
mMathDepth(0),
|
||||||
mMathVariant(NS_MATHML_MATHVARIANT_NONE),
|
mMathVariant(NS_MATHML_MATHVARIANT_NONE),
|
||||||
mMathStyle(NS_STYLE_MATH_STYLE_NORMAL),
|
mMathStyle(NS_STYLE_MATH_STYLE_NORMAL),
|
||||||
mMinFontSizeRatio(100), // 100%
|
mMinFontSizeRatio(100), // 100%
|
||||||
@@ -293,8 +293,7 @@ nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aNewData) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX Should any of these cause a non-nsChangeHint_NeutralChange change?
|
// XXX Should any of these cause a non-nsChangeHint_NeutralChange change?
|
||||||
if (mGenericID != aNewData.mGenericID ||
|
if (mGenericID != aNewData.mGenericID || mMathDepth != aNewData.mMathDepth ||
|
||||||
mScriptLevel != aNewData.mScriptLevel ||
|
|
||||||
mScriptUnconstrainedSize != aNewData.mScriptUnconstrainedSize ||
|
mScriptUnconstrainedSize != aNewData.mScriptUnconstrainedSize ||
|
||||||
mScriptMinSize != aNewData.mScriptMinSize ||
|
mScriptMinSize != aNewData.mScriptMinSize ||
|
||||||
mScriptSizeMultiplier != aNewData.mScriptSizeMultiplier) {
|
mScriptSizeMultiplier != aNewData.mScriptSizeMultiplier) {
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
|
|||||||
|
|
||||||
mozilla::StyleGenericFontFamily mGenericID;
|
mozilla::StyleGenericFontFamily mGenericID;
|
||||||
|
|
||||||
// MathML scriptlevel support
|
// math-depth support (used for MathML scriptlevel)
|
||||||
int8_t mScriptLevel;
|
int8_t mMathDepth;
|
||||||
// MathML mathvariant support
|
// MathML mathvariant support
|
||||||
uint8_t mMathVariant;
|
uint8_t mMathVariant;
|
||||||
// math-style support (used for MathML displaystyle)
|
// math-style support (used for MathML displaystyle)
|
||||||
|
|||||||
@@ -6060,6 +6060,14 @@
|
|||||||
mirror: always
|
mirror: always
|
||||||
rust: true
|
rust: true
|
||||||
|
|
||||||
|
# Is support for math-depth enabled?
|
||||||
|
# This must not be enabled until implementation is complete (see bug 1667090).
|
||||||
|
- name: layout.css.math-depth.enabled
|
||||||
|
type: RelaxedAtomicBool
|
||||||
|
value: false
|
||||||
|
mirror: always
|
||||||
|
rust: true
|
||||||
|
|
||||||
# Pref to control whether @-moz-document rules are enabled in content pages.
|
# Pref to control whether @-moz-document rules are enabled in content pages.
|
||||||
- name: layout.css.moz-document.content.enabled
|
- name: layout.css.moz-document.content.enabled
|
||||||
type: RelaxedAtomicBool
|
type: RelaxedAtomicBool
|
||||||
|
|||||||
@@ -963,7 +963,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||||||
fn handle_mathml_scriptlevel_if_needed(&mut self) {
|
fn handle_mathml_scriptlevel_if_needed(&mut self) {
|
||||||
use crate::values::generics::NonNegative;
|
use crate::values::generics::NonNegative;
|
||||||
|
|
||||||
if !self.seen.contains(LonghandId::MozScriptLevel) &&
|
if !self.seen.contains(LonghandId::MathDepth) &&
|
||||||
!self.seen.contains(LonghandId::MozScriptMinSize) &&
|
!self.seen.contains(LonghandId::MozScriptMinSize) &&
|
||||||
!self.seen.contains(LonghandId::MozScriptSizeMultiplier) {
|
!self.seen.contains(LonghandId::MozScriptSizeMultiplier) {
|
||||||
return;
|
return;
|
||||||
@@ -980,7 +980,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||||||
let parent_font = builder.get_parent_font().gecko();
|
let parent_font = builder.get_parent_font().gecko();
|
||||||
|
|
||||||
let delta =
|
let delta =
|
||||||
font.mScriptLevel.saturating_sub(parent_font.mScriptLevel);
|
font.mMathDepth.saturating_sub(parent_font.mMathDepth);
|
||||||
|
|
||||||
if delta == 0 {
|
if delta == 0 {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ class Longhand(object):
|
|||||||
"MasonryAutoFlow",
|
"MasonryAutoFlow",
|
||||||
"MozForceBrokenImageIcon",
|
"MozForceBrokenImageIcon",
|
||||||
"MozListReversed",
|
"MozListReversed",
|
||||||
"MozScriptLevel",
|
"MathDepth",
|
||||||
"MozScriptMinSize",
|
"MozScriptMinSize",
|
||||||
"MozScriptSizeMultiplier",
|
"MozScriptSizeMultiplier",
|
||||||
"TextDecorationSkipInk",
|
"TextDecorationSkipInk",
|
||||||
|
|||||||
@@ -228,14 +228,15 @@ ${helpers.predefined_type(
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"-moz-script-level",
|
"math-depth",
|
||||||
"MozScriptLevel",
|
"MathDepth",
|
||||||
"0",
|
"0",
|
||||||
engines="gecko",
|
engines="gecko",
|
||||||
|
gecko_pref="layout.css.math-depth.enabled",
|
||||||
|
has_effect_on_gecko_scrollbars=False,
|
||||||
animation_value_type="none",
|
animation_value_type="none",
|
||||||
enabled_in="ua",
|
enabled_in="ua",
|
||||||
gecko_ffi_name="mScriptLevel",
|
spec="https://mathml-refresh.github.io/mathml-core/#the-math-script-level-property",
|
||||||
spec="Internal (not web-exposed)",
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
${helpers.single_keyword(
|
${helpers.single_keyword(
|
||||||
|
|||||||
@@ -1342,8 +1342,8 @@ impl LonghandId {
|
|||||||
// preferences properly, see bug 1165538.
|
// preferences properly, see bug 1165538.
|
||||||
LonghandId::MozMinFontSizeRatio |
|
LonghandId::MozMinFontSizeRatio |
|
||||||
|
|
||||||
// Needed to do font-size for MathML. :(
|
// font-size depends on math-depth's computed value.
|
||||||
LonghandId::MozScriptLevel |
|
LonghandId::MathDepth |
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
// Needed to compute the first available font, in order to
|
// Needed to compute the first available font, in order to
|
||||||
|
|||||||
@@ -811,20 +811,20 @@ impl ToComputedValue for specified::MozScriptMinSize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The computed value of the -moz-script-level property.
|
/// The computed value of the math-depth property.
|
||||||
pub type MozScriptLevel = i8;
|
pub type MathDepth = i8;
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
impl ToComputedValue for specified::MozScriptLevel {
|
impl ToComputedValue for specified::MathDepth {
|
||||||
type ComputedValue = MozScriptLevel;
|
type ComputedValue = MathDepth;
|
||||||
|
|
||||||
fn to_computed_value(&self, cx: &Context) -> i8 {
|
fn to_computed_value(&self, cx: &Context) -> i8 {
|
||||||
use crate::properties::longhands::math_style::SpecifiedValue as MathStyleValue;
|
use crate::properties::longhands::math_style::SpecifiedValue as MathStyleValue;
|
||||||
use std::{cmp, i8};
|
use std::{cmp, i8};
|
||||||
|
|
||||||
let int = match *self {
|
let int = match *self {
|
||||||
specified::MozScriptLevel::Auto => {
|
specified::MathDepth::Auto => {
|
||||||
let parent = cx.builder.get_parent_font().clone__moz_script_level() as i32;
|
let parent = cx.builder.get_parent_font().clone_math_depth() as i32;
|
||||||
let style = cx.builder.get_parent_font().clone_math_style();
|
let style = cx.builder.get_parent_font().clone_math_style();
|
||||||
if style == MathStyleValue::Compact {
|
if style == MathStyleValue::Compact {
|
||||||
parent + 1
|
parent + 1
|
||||||
@@ -832,17 +832,17 @@ impl ToComputedValue for specified::MozScriptLevel {
|
|||||||
parent
|
parent
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
specified::MozScriptLevel::Relative(rel) => {
|
specified::MathDepth::Relative(rel) => {
|
||||||
let parent = cx.builder.get_parent_font().clone__moz_script_level();
|
let parent = cx.builder.get_parent_font().clone_math_depth();
|
||||||
parent as i32 + rel
|
parent as i32 + rel
|
||||||
},
|
},
|
||||||
specified::MozScriptLevel::MozAbsolute(abs) => abs,
|
specified::MathDepth::MozAbsolute(abs) => abs,
|
||||||
};
|
};
|
||||||
cmp::min(int, i8::MAX as i32) as i8
|
cmp::min(int, i8::MAX as i32) as i8
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_computed_value(other: &i8) -> Self {
|
fn from_computed_value(other: &i8) -> Self {
|
||||||
specified::MozScriptLevel::MozAbsolute(*other as i32)
|
specified::MathDepth::MozAbsolute(*other as i32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumer
|
|||||||
pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis};
|
pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis};
|
||||||
pub use self::font::{FontVariantAlternates, FontWeight};
|
pub use self::font::{FontVariantAlternates, FontWeight};
|
||||||
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
||||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||||
pub use self::image::{Gradient, Image, LineDirection, MozImageRect};
|
pub use self::image::{Gradient, Image, LineDirection, MozImageRect};
|
||||||
pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength};
|
pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength};
|
||||||
pub use self::length::{Length, LengthOrNumber, LengthPercentage, NonNegativeLengthOrNumber};
|
pub use self::length::{Length, LengthOrNumber, LengthPercentage, NonNegativeLengthOrNumber};
|
||||||
|
|||||||
@@ -2303,7 +2303,7 @@ impl Parse for MozScriptMinSize {
|
|||||||
///
|
///
|
||||||
/// The main effect of scriptlevel is to control the font size.
|
/// The main effect of scriptlevel is to control the font size.
|
||||||
/// https://www.w3.org/TR/MathML3/chapter3.html#presm.scriptlevel
|
/// https://www.w3.org/TR/MathML3/chapter3.html#presm.scriptlevel
|
||||||
pub enum MozScriptLevel {
|
pub enum MathDepth {
|
||||||
/// Change `font-size` relatively.
|
/// Change `font-size` relatively.
|
||||||
Relative(i32),
|
Relative(i32),
|
||||||
/// Change `font-size` absolutely.
|
/// Change `font-size` absolutely.
|
||||||
@@ -2317,17 +2317,17 @@ pub enum MozScriptLevel {
|
|||||||
Auto,
|
Auto,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for MozScriptLevel {
|
impl Parse for MathDepth {
|
||||||
fn parse<'i, 't>(
|
fn parse<'i, 't>(
|
||||||
_: &ParserContext,
|
_: &ParserContext,
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<MozScriptLevel, ParseError<'i>> {
|
) -> Result<MathDepth, ParseError<'i>> {
|
||||||
// We don't bother to handle calc here.
|
// We don't bother to handle calc here.
|
||||||
if let Ok(i) = input.try_parse(|i| i.expect_integer()) {
|
if let Ok(i) = input.try_parse(|i| i.expect_integer()) {
|
||||||
return Ok(MozScriptLevel::Relative(i));
|
return Ok(MathDepth::Relative(i));
|
||||||
}
|
}
|
||||||
input.expect_ident_matching("auto")?;
|
input.expect_ident_matching("auto")?;
|
||||||
Ok(MozScriptLevel::Auto)
|
Ok(MathDepth::Auto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumer
|
|||||||
pub use self::font::{FontSize, FontSizeAdjust, FontSizeKeyword, FontStretch, FontSynthesis};
|
pub use self::font::{FontSize, FontSizeAdjust, FontSizeKeyword, FontStretch, FontSynthesis};
|
||||||
pub use self::font::{FontVariantAlternates, FontWeight};
|
pub use self::font::{FontVariantAlternates, FontWeight};
|
||||||
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
||||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||||
pub use self::image::{EndingShape as GradientEndingShape, Gradient};
|
pub use self::image::{EndingShape as GradientEndingShape, Gradient};
|
||||||
pub use self::image::{Image, MozImageRect};
|
pub use self::image::{Image, MozImageRect};
|
||||||
pub use self::length::{AbsoluteLength, CalcLengthPercentage, CharacterWidth};
|
pub use self::length::{AbsoluteLength, CalcLengthPercentage, CharacterWidth};
|
||||||
|
|||||||
@@ -4901,7 +4901,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetIntValue(
|
|||||||
property: nsCSSPropertyID,
|
property: nsCSSPropertyID,
|
||||||
value: i32,
|
value: i32,
|
||||||
) {
|
) {
|
||||||
use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
|
use style::properties::longhands::math_depth::SpecifiedValue as MathDepth;
|
||||||
use style::properties::PropertyDeclaration;
|
use style::properties::PropertyDeclaration;
|
||||||
use style::values::specified::Integer;
|
use style::values::specified::Integer;
|
||||||
|
|
||||||
@@ -4909,7 +4909,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetIntValue(
|
|||||||
let prop = match_wrap_declared! { long,
|
let prop = match_wrap_declared! { long,
|
||||||
XSpan => Integer::new(value),
|
XSpan => Integer::new(value),
|
||||||
// Gecko uses Integer values to signal that it is relative
|
// Gecko uses Integer values to signal that it is relative
|
||||||
MozScriptLevel => MozScriptLevel::Relative(value),
|
MathDepth => MathDepth::Relative(value),
|
||||||
};
|
};
|
||||||
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
|
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
|
||||||
decls.push(prop, Importance::Normal);
|
decls.push(prop, Importance::Normal);
|
||||||
@@ -5072,7 +5072,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(
|
|||||||
property: nsCSSPropertyID,
|
property: nsCSSPropertyID,
|
||||||
value: f32,
|
value: f32,
|
||||||
) {
|
) {
|
||||||
use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
|
use style::properties::longhands::math_depth::SpecifiedValue as MathDepth;
|
||||||
use style::properties::longhands::_moz_script_size_multiplier::SpecifiedValue as MozScriptSizeMultiplier;
|
use style::properties::longhands::_moz_script_size_multiplier::SpecifiedValue as MozScriptSizeMultiplier;
|
||||||
use style::properties::PropertyDeclaration;
|
use style::properties::PropertyDeclaration;
|
||||||
|
|
||||||
@@ -5081,7 +5081,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(
|
|||||||
let prop = match_wrap_declared! { long,
|
let prop = match_wrap_declared! { long,
|
||||||
MozScriptSizeMultiplier => MozScriptSizeMultiplier(value),
|
MozScriptSizeMultiplier => MozScriptSizeMultiplier(value),
|
||||||
// Gecko uses Number values to signal that it is absolute
|
// Gecko uses Number values to signal that it is absolute
|
||||||
MozScriptLevel => MozScriptLevel::MozAbsolute(value as i32),
|
MathDepth => MathDepth::MozAbsolute(value as i32),
|
||||||
};
|
};
|
||||||
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
|
write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
|
||||||
decls.push(prop, Importance::Normal);
|
decls.push(prop, Importance::Normal);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
-moz-list-reversed: initial;
|
-moz-list-reversed: initial;
|
||||||
-moz-font-smoothing-background-color: initial;
|
-moz-font-smoothing-background-color: initial;
|
||||||
-moz-min-font-size-ratio: initial;
|
-moz-min-font-size-ratio: initial;
|
||||||
-moz-script-level: initial;
|
math-depth: initial;
|
||||||
/* As long as inert implies pointer-events: none as it does now, we're
|
/* As long as inert implies pointer-events: none as it does now, we're
|
||||||
* good. */
|
* good. */
|
||||||
-moz-inert: initial;
|
-moz-inert: initial;
|
||||||
|
|||||||
Reference in New Issue
Block a user