Bug 114365 - Add CSS properties for -moz-math-variant. r=heycam
authorJames Kitchener <jkitch.bug@gmail.com>
Mon, 02 Dec 2013 11:49:00 -0500
changeset 172973 ab78b049fa04481812453d8d3c499ee48a64525b
parent 172972 2be8f1640e213b315ea99d833e74b1f71bb1d702
child 172974 67e38708a5e94501280098d255e27e1516a0992a
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs114365
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 114365 - Add CSS properties for -moz-math-variant. r=heycam
layout/style/nsCSSKeywordList.h
layout/style/nsCSSPropList.h
layout/style/nsCSSProps.cpp
layout/style/nsCSSProps.h
layout/style/nsRuleNode.cpp
layout/style/nsStyleConsts.h
layout/style/nsStyleSet.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/style/test/ListCSSProperties.cpp
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -174,16 +174,20 @@ CSS_KEY(backwards, backwards)
 CSS_KEY(balance, balance)
 CSS_KEY(baseline, baseline)
 CSS_KEY(bidi-override, bidi_override)
 CSS_KEY(blink, blink)
 CSS_KEY(block, block)
 CSS_KEY(block-axis, block_axis)
 CSS_KEY(blur, blur)
 CSS_KEY(bold, bold)
+CSS_KEY(bold-fraktur, bold_fraktur)
+CSS_KEY(bold-italic, bold_italic)
+CSS_KEY(bold-sans-serif, bold_sans_serif)
+CSS_KEY(bold-script, bold_script)
 CSS_KEY(bolder, bolder)
 CSS_KEY(border-box, border_box)
 CSS_KEY(both, both)
 CSS_KEY(bottom, bottom)
 CSS_KEY(bottom-outside, bottom_outside)
 CSS_KEY(bounding-box, bounding_box)
 CSS_KEY(break-all, break_all)
 CSS_KEY(break-word, break_word)
@@ -243,16 +247,17 @@ CSS_KEY(diagonal-fractions, diagonal_fra
 CSS_KEY(dialog, dialog)
 CSS_KEY(difference, difference)
 CSS_KEY(digits, digits)
 CSS_KEY(disabled, disabled)
 CSS_KEY(disc, disc)
 CSS_KEY(discretionary-ligatures, discretionary_ligatures)
 CSS_KEY(dotted, dotted)
 CSS_KEY(double, double)
+CSS_KEY(double-struck, double_struck)
 CSS_KEY(drop-shadow, drop_shadow)
 CSS_KEY(e-resize, e_resize)
 CSS_KEY(each-box, each_box)
 CSS_KEY(ease, ease)
 CSS_KEY(ease-in, ease_in)
 CSS_KEY(ease-in-out, ease_in_out)
 CSS_KEY(ease-out, ease_out)
 CSS_KEY(element, element)
@@ -274,16 +279,17 @@ CSS_KEY(farthest-corner, farthest_corner
 CSS_KEY(fill, fill)
 CSS_KEY(fixed, fixed)
 CSS_KEY(flat, flat)
 CSS_KEY(flex, flex)
 CSS_KEY(flex-end, flex_end)
 CSS_KEY(flex-start, flex_start)
 CSS_KEY(flip, flip)
 CSS_KEY(forwards, forwards)
+CSS_KEY(fraktur, fraktur)
 CSS_KEY(from-image, from_image)
 CSS_KEY(full-width, full_width)
 CSS_KEY(georgian, georgian)
 CSS_KEY(grab, grab)
 CSS_KEY(grabbing, grabbing)
 CSS_KEY(grad, grad)
 CSS_KEY(grayscale, grayscale)
 CSS_KEY(graytext, graytext)
@@ -343,16 +349,17 @@ CSS_KEY(left, left)
 CSS_KEY(lighten, lighten)
 CSS_KEY(lighter, lighter)
 CSS_KEY(line-through, line_through)
 CSS_KEY(linear, linear)
 CSS_KEY(lining-nums, lining_nums)
 CSS_KEY(list-item, list_item)
 CSS_KEY(local, local)
 CSS_KEY(logical, logical)
+CSS_KEY(looped, looped)
 CSS_KEY(lower-alpha, lower_alpha)
 CSS_KEY(lower-greek, lower_greek)
 CSS_KEY(lower-latin, lower_latin)
 CSS_KEY(lower-roman, lower_roman)
 CSS_KEY(lowercase, lowercase)
 CSS_KEY(ltr, ltr)
 CSS_KEY(luminance, luminance)
 CSS_KEY(luminosity, luminosity)
@@ -363,16 +370,17 @@ CSS_KEY(matrix, matrix)
 CSS_KEY(matrix3d, matrix3d)
 CSS_KEY(medium, medium)
 CSS_KEY(menu, menu)
 CSS_KEY(menutext, menutext)
 CSS_KEY(message-box, message_box)
 CSS_KEY(middle, middle)
 CSS_KEY(mix, mix)
 CSS_KEY(mm, mm)
+CSS_KEY(monospace, monospace)
 CSS_KEY(move, move)
 CSS_KEY(ms, ms)
 CSS_KEY(multiply, multiply)
 CSS_KEY(n-resize, n_resize)
 CSS_KEY(narrower, narrower)
 CSS_KEY(ne-resize, ne_resize)
 CSS_KEY(nesw-resize, nesw_resize)
 CSS_KEY(no-close-quote, no_close_quote)
@@ -446,16 +454,17 @@ CSS_KEY(s-resize, s_resize)
 CSS_KEY(saturate, saturate)
 CSS_KEY(saturation, saturation)
 CSS_KEY(scale, scale)
 CSS_KEY(scale3d, scale3d)
 CSS_KEY(scalex, scalex)
 CSS_KEY(scaley, scaley)
 CSS_KEY(scalez, scalez)
 CSS_KEY(screen, screen)
+CSS_KEY(script, script)
 CSS_KEY(scroll, scroll)
 CSS_KEY(scrollbar, scrollbar)
 CSS_KEY(scrollbar-small, scrollbar_small)
 CSS_KEY(se-resize, se_resize)
 CSS_KEY(select-after, select_after)
 CSS_KEY(select-all, select_all)
 CSS_KEY(select-before, select_before)
 CSS_KEY(select-menu, select_menu)
@@ -485,16 +494,17 @@ CSS_KEY(stacked-fractions, stacked_fract
 CSS_KEY(start, start)
 CSS_KEY(static, static)
 CSS_KEY(status-bar, status_bar)
 CSS_KEY(step-end, step_end)
 CSS_KEY(step-start, step_start)
 CSS_KEY(sticky, sticky)
 CSS_KEY(stretch, stretch)
 CSS_KEY(stretch-to-fit, stretch_to_fit)
+CSS_KEY(stretched, stretched)
 CSS_KEY(stroke, stroke)
 CSS_KEY(style, style)
 CSS_KEY(styleset, styleset)
 CSS_KEY(stylistic, stylistic)
 CSS_KEY(sub, sub)
 CSS_KEY(super, super)
 CSS_KEY(sw-resize, sw_resize)
 CSS_KEY(swash, swash)
@@ -503,16 +513,17 @@ CSS_KEY(table-caption, table_caption)
 CSS_KEY(table-cell, table_cell)
 CSS_KEY(table-column, table_column)
 CSS_KEY(table-column-group, table_column_group)
 CSS_KEY(table-footer-group, table_footer_group)
 CSS_KEY(table-header-group, table_header_group)
 CSS_KEY(table-row, table_row)
 CSS_KEY(table-row-group, table_row_group)
 CSS_KEY(tabular-nums, tabular_nums)
+CSS_KEY(tailed, tailed)
 CSS_KEY(text, text)
 CSS_KEY(text-bottom, text_bottom)
 CSS_KEY(text-top, text_top)
 CSS_KEY(thick, thick)
 CSS_KEY(thin, thin)
 CSS_KEY(threeddarkshadow, threeddarkshadow)
 CSS_KEY(threedface, threedface)
 CSS_KEY(threedhighlight, threedhighlight)
@@ -636,16 +647,19 @@ CSS_KEY(menuitemtext, menuitemtext)
 CSS_KEY(menulist, menulist)
 CSS_KEY(menulist-button, menulist_button)
 CSS_KEY(menulist-text, menulist_text)
 CSS_KEY(menulist-textfield, menulist_textfield)
 CSS_KEY(meterbar, meterbar)
 CSS_KEY(meterchunk, meterchunk)
 CSS_KEY(range, range)
 CSS_KEY(range-thumb, range_thumb)
+CSS_KEY(sans-serif, sans_serif)
+CSS_KEY(sans-serif-bold-italic, sans_serif_bold_italic)
+CSS_KEY(sans-serif-italic, sans_serif_italic)
 CSS_KEY(scale-horizontal, scale_horizontal)
 CSS_KEY(scale-vertical, scale_vertical)
 CSS_KEY(scalethumb-horizontal, scalethumb_horizontal)
 CSS_KEY(scalethumb-vertical, scalethumb_vertical)
 CSS_KEY(scalethumbstart, scalethumbstart)
 CSS_KEY(scalethumbend, scalethumbend)
 CSS_KEY(scalethumbtick, scalethumbtick)
 CSS_KEY(groupbox, groupbox)
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -3348,16 +3348,26 @@ CSS_PROP_FONT(
     ScriptMinSize,
     // REVIEW: no range restriction?
     CSS_PROPERTY_PARSE_INACCESSIBLE,
     "",
     0,
     nullptr,
     CSS_PROP_NO_OFFSET,
     eStyleAnimType_None)
+CSS_PROP_FONT(
+    -moz-math-variant,
+    math_variant,
+    MathVariant,
+    CSS_PROPERTY_PARSE_INACCESSIBLE,
+    "",
+    VARIANT_HK,
+    kMathVariantKTable,
+    CSS_PROP_NO_OFFSET,
+    eStyleAnimType_None)
 #endif // !defined(CSS_PROP_LIST_EXCLUDE_INTERNAL)
 #endif // !defined(CSS_PROP_LIST_ONLY_COMPONENTS_OF_ALL_SHORTHAND)
 
 CSS_PROP_SVGRESET(
     clip-path,
     clip_path,
     ClipPath,
     CSS_PROPERTY_PARSE_VALUE,
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1265,16 +1265,39 @@ const int32_t nsCSSProps::kListStyleKTab
   eCSSKeyword__moz_ethiopic_halehame, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME,
   eCSSKeyword__moz_ethiopic_numeric, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC,
   eCSSKeyword__moz_ethiopic_halehame_am, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM,
   eCSSKeyword__moz_ethiopic_halehame_ti_er, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER,
   eCSSKeyword__moz_ethiopic_halehame_ti_et, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET,
   eCSSKeyword_UNKNOWN,-1
 };
 
+const int32_t nsCSSProps::kMathVariantKTable[] = {
+  eCSSKeyword_none, NS_MATHML_MATHVARIANT_NONE,
+  eCSSKeyword_normal, NS_MATHML_MATHVARIANT_NORMAL,
+  eCSSKeyword_bold, NS_MATHML_MATHVARIANT_BOLD,
+  eCSSKeyword_italic, NS_MATHML_MATHVARIANT_ITALIC,
+  eCSSKeyword_bold_italic, NS_MATHML_MATHVARIANT_BOLD_ITALIC,
+  eCSSKeyword_script, NS_MATHML_MATHVARIANT_SCRIPT,
+  eCSSKeyword_bold_script, NS_MATHML_MATHVARIANT_BOLD_SCRIPT,
+  eCSSKeyword_fraktur, NS_MATHML_MATHVARIANT_FRAKTUR,
+  eCSSKeyword_double_struck, NS_MATHML_MATHVARIANT_DOUBLE_STRUCK,
+  eCSSKeyword_bold_fraktur, NS_MATHML_MATHVARIANT_BOLD_FRAKTUR,
+  eCSSKeyword_sans_serif, NS_MATHML_MATHVARIANT_SANS_SERIF,
+  eCSSKeyword_bold_sans_serif, NS_MATHML_MATHVARIANT_BOLD_SANS_SERIF,
+  eCSSKeyword_sans_serif_italic, NS_MATHML_MATHVARIANT_SANS_SERIF_ITALIC,
+  eCSSKeyword_sans_serif_bold_italic, NS_MATHML_MATHVARIANT_SANS_SERIF_BOLD_ITALIC,
+  eCSSKeyword_monospace, NS_MATHML_MATHVARIANT_MONOSPACE,
+  eCSSKeyword_initial, NS_MATHML_MATHVARIANT_INITIAL,
+  eCSSKeyword_tailed, NS_MATHML_MATHVARIANT_TAILED,
+  eCSSKeyword_looped, NS_MATHML_MATHVARIANT_LOOPED,
+  eCSSKeyword_stretched, NS_MATHML_MATHVARIANT_STRETCHED,
+  eCSSKeyword_UNKNOWN,-1
+};
+
 const int32_t nsCSSProps::kContextOpacityKTable[] = {
   eCSSKeyword_context_fill_opacity, NS_STYLE_CONTEXT_FILL_OPACITY,
   eCSSKeyword_context_stroke_opacity, NS_STYLE_CONTEXT_STROKE_OPACITY,
   eCSSKeyword_UNKNOWN,-1
 };
 
 const int32_t nsCSSProps::kContextPatternKTable[] = {
   eCSSKeyword_context_fill, NS_COLOR_CONTEXT_FILL,
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -503,16 +503,17 @@ public:
   static const int32_t kFontWeightKTable[];
   static const int32_t kImageOrientationKTable[];
   static const int32_t kImageOrientationFlipKTable[];
   static const int32_t kIMEModeKTable[];
   static const int32_t kLineHeightKTable[];
   static const int32_t kListStylePositionKTable[];
   static const int32_t kListStyleKTable[];
   static const int32_t kMaskTypeKTable[];
+  static const int32_t kMathVariantKTable[];
   static const int32_t kContextOpacityKTable[];
   static const int32_t kContextPatternKTable[];
   static const int32_t kOrientKTable[];
   static const int32_t kOutlineStyleKTable[];
   static const int32_t kOutlineColorKTable[];
   static const int32_t kOverflowKTable[];
   static const int32_t kOverflowSubKTable[];
   static const int32_t kPageBreakKTable[];
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1829,17 +1829,18 @@ static const CheckCallbackFn gCheckCallb
 
 #ifdef DEBUG
 static bool
 AreAllMathMLPropertiesUndefined(const nsRuleData* aRuleData)
 {
   return
     aRuleData->ValueForScriptLevel()->GetUnit() == eCSSUnit_Null &&
     aRuleData->ValueForScriptSizeMultiplier()->GetUnit() == eCSSUnit_Null &&
-    aRuleData->ValueForScriptMinSize()->GetUnit() == eCSSUnit_Null;
+    aRuleData->ValueForScriptMinSize()->GetUnit() == eCSSUnit_Null &&
+    aRuleData->ValueForMathVariant()->GetUnit() == eCSSUnit_Null;
 }
 #endif
 
 inline nsRuleNode::RuleDetail
 nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
                                      const nsRuleData* aRuleData)
 {
   // Build a count of the:
@@ -1879,23 +1880,23 @@ nsRuleNode::CheckSpecifiedProperties(con
    * Return the most specific information we can: prefer None or Full
    * over Partial, and Reset or Inherited over Mixed, since we can
    * optimize based on the edge cases and not the in-between cases.
    */
   nsRuleNode::RuleDetail result;
   if (inherited == total)
     result = eRuleFullInherited;
   else if (specified == total
-           // MathML defines 3 properties in Font that will never be set when
-           // MathML is not in use. Therefore if all but three
+           // MathML defines 4 properties in Font that will never be set when
+           // MathML is not in use. Therefore if all but four
            // properties have been set, and MathML is not enabled, we can treat
            // this as fully specified. Code in nsMathMLElementFactory will
            // rebuild the rule tree and style data when MathML is first enabled
            // (see nsMathMLElement::BindToTree).
-           || (aSID == eStyleStruct_Font && specified + 3 == total &&
+           || (aSID == eStyleStruct_Font && specified + 4 == total &&
                !mPresContext->Document()->GetMathMLEnabled())
           ) {
     if (inherited == 0)
       result = eRuleFullReset;
     else
       result = eRuleFullMixed;
   } else if (specified == 0)
     result = eRuleNone;
@@ -3242,44 +3243,59 @@ nsRuleNode::SetFont(nsPresContext* aPres
   // When we're in the loop in SetGenericFont, we must ensure that we
   // always keep aFont->mFlags set to the correct generic.  But we have
   // to be careful not to touch it when we're called directly from
   // ComputeFontData, because we could have a start struct.
   if (aGenericFontID != kGenericFont_NONE) {
     aFont->mGenericID = aGenericFontID;
   }
 
+  // -moz-math-variant: enum, inherit, initial
+  SetDiscrete(*aRuleData->ValueForMathVariant(), aFont->mMathVariant,
+              aCanStoreInRuleTree,
+              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
+              aParentFont->mMathVariant, NS_MATHML_MATHVARIANT_NONE,
+              0, 0, 0, 0);
+
   // font-smoothing: enum, inherit, initial
   SetDiscrete(*aRuleData->ValueForOSXFontSmoothing(),
               aFont->mFont.smoothing, aCanStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
               aParentFont->mFont.smoothing,
               defaultVariableFont->smoothing,
               0, 0, 0, 0);
 
   // font-style: enum, inherit, initial, -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontStyle(),
-              aFont->mFont.style, aCanStoreInRuleTree,
-              SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT | SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.style,
-              defaultVariableFont->style,
-              0, 0, 0, systemFont.style);
+  if (aFont->mMathVariant != NS_MATHML_MATHVARIANT_NONE) {
+    // -moz-math-variant overrides font-style
+    aFont->mFont.style = NS_FONT_STYLE_NORMAL;
+  } else {
+    SetDiscrete(*aRuleData->ValueForFontStyle(),
+                aFont->mFont.style, aCanStoreInRuleTree,
+                SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT | SETDSC_UNSET_INHERIT,
+                aParentFont->mFont.style,
+                defaultVariableFont->style,
+                0, 0, 0, systemFont.style);
+  }
 
   // font-variant: enum, inherit, initial, -moz-system-font
   SetDiscrete(*aRuleData->ValueForFontVariant(),
               aFont->mFont.variant, aCanStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT | SETDSC_UNSET_INHERIT,
               aParentFont->mFont.variant,
               defaultVariableFont->variant,
               0, 0, 0, systemFont.variant);
 
   // font-weight: int, enum, inherit, initial, -moz-system-font
   // special handling for enum
   const nsCSSValue* weightValue = aRuleData->ValueForFontWeight();
-  if (eCSSUnit_Enumerated == weightValue->GetUnit()) {
+  if (aFont->mMathVariant != NS_MATHML_MATHVARIANT_NONE) {
+    // -moz-math-variant overrides font-weight
+    aFont->mFont.weight = NS_FONT_WEIGHT_NORMAL;
+  } else if (eCSSUnit_Enumerated == weightValue->GetUnit()) {
     int32_t value = weightValue->GetIntValue();
     switch (value) {
       case NS_STYLE_FONT_WEIGHT_NORMAL:
       case NS_STYLE_FONT_WEIGHT_BOLD:
         aFont->mFont.weight = value;
         break;
       case NS_STYLE_FONT_WEIGHT_BOLDER: {
         aCanStoreInRuleTree = false;
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -515,16 +515,37 @@ static inline mozilla::css::Side operato
 #define NS_STYLE_FONT_PULL_DOWN_MENU            14
 #define NS_STYLE_FONT_LIST                      15
 #define NS_STYLE_FONT_FIELD                     16
 
 // defaults per MathML spec
 #define NS_MATHML_DEFAULT_SCRIPT_SIZE_MULTIPLIER 0.71f
 #define NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT 8
 
+// See nsStyleFont
+#define NS_MATHML_MATHVARIANT_NONE                     0
+#define NS_MATHML_MATHVARIANT_NORMAL                   1
+#define NS_MATHML_MATHVARIANT_BOLD                     2
+#define NS_MATHML_MATHVARIANT_ITALIC                   3
+#define NS_MATHML_MATHVARIANT_BOLD_ITALIC              4
+#define NS_MATHML_MATHVARIANT_SCRIPT                   5
+#define NS_MATHML_MATHVARIANT_BOLD_SCRIPT              6
+#define NS_MATHML_MATHVARIANT_FRAKTUR                  7
+#define NS_MATHML_MATHVARIANT_DOUBLE_STRUCK            8
+#define NS_MATHML_MATHVARIANT_BOLD_FRAKTUR             9
+#define NS_MATHML_MATHVARIANT_SANS_SERIF              10
+#define NS_MATHML_MATHVARIANT_BOLD_SANS_SERIF         11
+#define NS_MATHML_MATHVARIANT_SANS_SERIF_ITALIC       12
+#define NS_MATHML_MATHVARIANT_SANS_SERIF_BOLD_ITALIC  13
+#define NS_MATHML_MATHVARIANT_MONOSPACE               14
+#define NS_MATHML_MATHVARIANT_INITIAL                 15
+#define NS_MATHML_MATHVARIANT_TAILED                  16
+#define NS_MATHML_MATHVARIANT_LOOPED                  17
+#define NS_MATHML_MATHVARIANT_STRETCHED               18
+
 // See nsStylePosition::mWidth, mMinWidth, mMaxWidth
 #define NS_STYLE_WIDTH_MAX_CONTENT              0
 #define NS_STYLE_WIDTH_MIN_CONTENT              1
 #define NS_STYLE_WIDTH_FIT_CONTENT              2
 #define NS_STYLE_WIDTH_AVAILABLE                3
 
 // See nsStylePosition.mPosition
 #define NS_STYLE_POSITION_STATIC                0
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -74,17 +74,19 @@ nsInitialStyleRule::MapRuleInfoInto(nsRu
         if (sid == eStyleStruct_Font &&
             !aRuleData->mPresContext->Document()->GetMathMLEnabled()) {
           size_t index = value - value_start;
           if (index == nsCSSProps::PropertyIndexInStruct(
                           eCSSProperty_script_level) ||
               index == nsCSSProps::PropertyIndexInStruct(
                           eCSSProperty_script_size_multiplier) ||
               index == nsCSSProps::PropertyIndexInStruct(
-                          eCSSProperty_script_min_size)) {
+                          eCSSProperty_script_min_size) ||
+              index == nsCSSProps::PropertyIndexInStruct(
+                          eCSSProperty_math_variant)) {
             continue;
           }
         }
         if (value->GetUnit() == eCSSUnit_Null) {
           value->SetInitialValue();
         }
       }
     }
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -96,16 +96,17 @@ nsStyleFont::nsStyleFont(const nsFont& a
   Init(aPresContext);
 }
 
 nsStyleFont::nsStyleFont(const nsStyleFont& aSrc)
   : mFont(aSrc.mFont)
   , mSize(aSrc.mSize)
   , mGenericID(aSrc.mGenericID)
   , mScriptLevel(aSrc.mScriptLevel)
+  , mMathVariant(aSrc.mMathVariant)
   , mExplicitLanguage(aSrc.mExplicitLanguage)
   , mAllowZoom(aSrc.mAllowZoom)
   , mScriptUnconstrainedSize(aSrc.mScriptUnconstrainedSize)
   , mScriptMinSize(aSrc.mScriptMinSize)
   , mScriptSizeMultiplier(aSrc.mScriptSizeMultiplier)
   , mLanguage(aSrc.mLanguage)
 {
   MOZ_COUNT_CTOR(nsStyleFont);
@@ -126,16 +127,17 @@ void
 nsStyleFont::Init(nsPresContext* aPresContext)
 {
   mSize = mFont.size = nsStyleFont::ZoomText(aPresContext, mFont.size);
   mScriptUnconstrainedSize = mSize;
   mScriptMinSize = aPresContext->CSSTwipsToAppUnits(
       NS_POINTS_TO_TWIPS(NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT));
   mScriptLevel = 0;
   mScriptSizeMultiplier = NS_MATHML_DEFAULT_SCRIPT_SIZE_MULTIPLIER;
+  mMathVariant = NS_MATHML_MATHVARIANT_NONE;
   mAllowZoom = true;
 
   nsAutoString language;
   aPresContext->Document()->GetContentLanguage(language);
   language.StripWhitespace();
 
   // Content-Language may be a comma-separated list of language codes,
   // in which case the HTML5 spec says to treat it as unknown
@@ -186,17 +188,18 @@ nsStyleFont::EnableZoom(nsPresContext* a
 }
 
 nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aOther) const
 {
   MOZ_ASSERT(mAllowZoom == aOther.mAllowZoom,
              "expected mAllowZoom to be the same on both nsStyleFonts");
   if (mSize != aOther.mSize ||
       mLanguage != aOther.mLanguage ||
-      mExplicitLanguage != aOther.mExplicitLanguage) {
+      mExplicitLanguage != aOther.mExplicitLanguage ||
+      mMathVariant != aOther.mMathVariant) {
     return NS_STYLE_HINT_REFLOW;
   }
   return CalcFontDifference(mFont, aOther.mFont);
 }
 
 /* static */ nscoord
 nsStyleFont::ZoomText(nsPresContext *aPresContext, nscoord aSize)
 {
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -96,16 +96,18 @@ public:
                         // mFont.size should be used for display purposes
                         // while mSize is the value to return in
                         // getComputedStyle() for example.
   uint8_t mGenericID;   // [inherited] generic CSS font family, if any;
                         // value is a kGenericFont_* constant, see nsFont.h.
 
   // MathML scriptlevel support
   int8_t  mScriptLevel;          // [inherited]
+  // MathML  mathvariant support
+  uint8_t mMathVariant;          // [inherited]
 
   // was mLanguage set based on a lang attribute in the document?
   bool mExplicitLanguage;        // [inherited]
 
   // should calls to ZoomText() and UnZoomText() be made to the font
   // size on this nsStyleFont?
   bool mAllowZoom;               // [inherited]
 
--- a/layout/style/test/ListCSSProperties.cpp
+++ b/layout/style/test/ListCSSProperties.cpp
@@ -141,17 +141,18 @@ const char *gInaccessibleProperties[] = 
     "padding-right-value",
     "padding-start-value",
     "padding-left-ltr-source",
     "padding-left-rtl-source",
     "padding-right-ltr-source",
     "padding-right-rtl-source",
     "-moz-script-level", // parsed by UA sheets only
     "-moz-script-size-multiplier",
-    "-moz-script-min-size"
+    "-moz-script-min-size",
+    "-moz-math-variant"
 };
 
 inline int
 is_inaccessible(const char* aPropName)
 {
     for (unsigned j = 0; j < ARRAY_LENGTH(gInaccessibleProperties); ++j) {
         if (strcmp(aPropName, gInaccessibleProperties[j]) == 0)
             return 1;