Bug 1224918 part 0 - Rename SetDiscrete to SetValue so that we can catch any new use of the old pattern with a compilation error. r=dbaron
authorXidorn Quan <me@upsuper.org>
Fri, 03 Jun 2016 10:00:14 +1000
changeset 300322 8e8ef068956be4badbd8c75488145eaadd0756f1
parent 300321 a340f7b143e30ee0f8449855070b7232275ba1fd
child 300323 4e6d4982db0ba1ecb9eca96aad9db606a9714f47
push id30309
push usercbook@mozilla.com
push dateFri, 03 Jun 2016 10:00:40 +0000
treeherdermozilla-central@e27fe24a746f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1224918
milestone49.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 1224918 part 0 - Rename SetDiscrete to SetValue so that we can catch any new use of the old pattern with a compilation error. r=dbaron MozReview-Commit-ID: 5P0T70Ni4Vg
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1275,118 +1275,118 @@ static void SetStyleImage(nsStyleContext
       break;
     }
     default:
       MOZ_ASSERT_UNREACHABLE("Unexpected Unit type.");
       break;
   }
 }
 
-// flags for SetDiscrete - align values with SETCOORD_* constants
+// flags for SetValue - align values with SETCOORD_* constants
 // where possible
 
-#define SETDSC_NORMAL                 0x01   // N
-#define SETDSC_AUTO                   0x02   // A
-#define SETDSC_INTEGER                0x40   // I
-#define SETDSC_ENUMERATED             0x80   // E
-#define SETDSC_NONE                   0x100  // O
-#define SETDSC_SYSTEM_FONT            0x2000
-#define SETDSC_UNSET_INHERIT          0x00400000
-#define SETDSC_UNSET_INITIAL          0x00800000
+#define SETVAL_NORMAL                 0x01   // N
+#define SETVAL_AUTO                   0x02   // A
+#define SETVAL_INTEGER                0x40   // I
+#define SETVAL_ENUMERATED             0x80   // E
+#define SETVAL_NONE                   0x100  // O
+#define SETVAL_SYSTEM_FONT            0x2000
+#define SETVAL_UNSET_INHERIT          0x00400000
+#define SETVAL_UNSET_INITIAL          0x00800000
 
 // no caller cares whether aField was changed or not
 template <typename FieldT,
           typename T1, typename T2, typename T3, typename T4, typename T5>
 static void
-SetDiscrete(const nsCSSValue& aValue, FieldT & aField,
-            RuleNodeCacheConditions& aConditions, uint32_t aMask,
-            FieldT aParentValue,
-            T1 aInitialValue,
-            T2 aAutoValue,
-            T3 aNoneValue,
-            T4 aNormalValue,
-            T5 aSystemFontValue)
+SetValue(const nsCSSValue& aValue, FieldT & aField,
+         RuleNodeCacheConditions& aConditions, uint32_t aMask,
+         FieldT aParentValue,
+         T1 aInitialValue,
+         T2 aAutoValue,
+         T3 aNoneValue,
+         T4 aNormalValue,
+         T5 aSystemFontValue)
 {
   switch (aValue.GetUnit()) {
   case eCSSUnit_Null:
     return;
 
-    // every caller of SetDiscrete provides inherit and initial
+    // every caller of SetValue provides inherit and initial
     // alternatives, so we don't require them to say so in the mask
   case eCSSUnit_Inherit:
     aConditions.SetUncacheable();
     aField = aParentValue;
     return;
 
   case eCSSUnit_Initial:
     aField = aInitialValue;
     return;
 
     // every caller provides one or other of these alternatives,
     // but they have to say which
   case eCSSUnit_Enumerated:
-    if (aMask & SETDSC_ENUMERATED) {
+    if (aMask & SETVAL_ENUMERATED) {
       aField = FieldT(aValue.GetIntValue());
       return;
     }
     break;
 
   case eCSSUnit_Integer:
-    if (aMask & SETDSC_INTEGER) {
+    if (aMask & SETVAL_INTEGER) {
       aField = FieldT(aValue.GetIntValue());
       return;
     }
     break;
 
     // remaining possibilities in descending order of frequency of use
   case eCSSUnit_Auto:
-    if (aMask & SETDSC_AUTO) {
+    if (aMask & SETVAL_AUTO) {
       aField = aAutoValue;
       return;
     }
     break;
 
   case eCSSUnit_None:
-    if (aMask & SETDSC_NONE) {
+    if (aMask & SETVAL_NONE) {
       aField = aNoneValue;
       return;
     }
     break;
 
   case eCSSUnit_Normal:
-    if (aMask & SETDSC_NORMAL) {
+    if (aMask & SETVAL_NORMAL) {
       aField = aNormalValue;
       return;
     }
     break;
 
   case eCSSUnit_System_Font:
-    if (aMask & SETDSC_SYSTEM_FONT) {
+    if (aMask & SETVAL_SYSTEM_FONT) {
       aField = aSystemFontValue;
       return;
     }
     break;
 
   case eCSSUnit_Unset:
-    if (aMask & SETDSC_UNSET_INHERIT) {
+    if (aMask & SETVAL_UNSET_INHERIT) {
       aConditions.SetUncacheable();
       aField = aParentValue;
       return;
     }
-    if (aMask & SETDSC_UNSET_INITIAL) {
+    if (aMask & SETVAL_UNSET_INITIAL) {
       aField = aInitialValue;
       return;
     }
     break;
 
   default:
     break;
   }
 
-  NS_NOTREACHED("SetDiscrete: inappropriate unit");
+  NS_NOTREACHED("SetValue: inappropriate unit");
 }
 
 // flags for SetFactor
 #define SETFCT_POSITIVE 0x01        // assert value is >= 0.0f
 #define SETFCT_OPACITY  0x02        // clamp value to [0.0f .. 1.0f]
 #define SETFCT_NONE     0x04        // allow _None (uses aInitialValue).
 #define SETFCT_UNSET_INHERIT  0x00400000
 #define SETFCT_UNSET_INITIAL  0x00800000
@@ -3491,48 +3491,48 @@ nsRuleNode::SetFont(nsPresContext* aPres
   // 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,
-              aConditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              aParentFont->mMathVariant, NS_MATHML_MATHVARIANT_NONE,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForMathVariant(), aFont->mMathVariant,
+           aConditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           aParentFont->mMathVariant, NS_MATHML_MATHVARIANT_NONE,
+           0, 0, 0, 0);
 
   // -moz-math-display: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForMathDisplay(), aFont->mMathDisplay,
-              aConditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              aParentFont->mMathDisplay, NS_MATHML_DISPLAYSTYLE_INLINE,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForMathDisplay(), aFont->mMathDisplay,
+           aConditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           aParentFont->mMathDisplay, NS_MATHML_DISPLAYSTYLE_INLINE,
+           0, 0, 0, 0);
 
   // font-smoothing: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForOsxFontSmoothing(),
-              aFont->mFont.smoothing, aConditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.smoothing,
-              defaultVariableFont->smoothing,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForOsxFontSmoothing(),
+           aFont->mFont.smoothing, aConditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.smoothing,
+           defaultVariableFont->smoothing,
+           0, 0, 0, 0);
 
   // font-style: enum, inherit, initial, -moz-system-font
   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, aConditions,
-                SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT | SETDSC_UNSET_INHERIT,
-                aParentFont->mFont.style,
-                defaultVariableFont->style,
-                0, 0, 0, systemFont.style);
+    SetValue(*aRuleData->ValueForFontStyle(),
+             aFont->mFont.style, aConditions,
+             SETVAL_ENUMERATED | SETVAL_SYSTEM_FONT | SETVAL_UNSET_INHERIT,
+             aParentFont->mFont.style,
+             defaultVariableFont->style,
+             0, 0, 0, systemFont.style);
   }
 
   // font-weight: int, enum, inherit, initial, -moz-system-font
   // special handling for enum
   const nsCSSValue* weightValue = aRuleData->ValueForFontWeight();
   if (aFont->mMathVariant != NS_MATHML_MATHVARIANT_NONE) {
     // -moz-math-variant overrides font-weight
     aFont->mFont.weight = NS_FONT_WEIGHT_NORMAL;
@@ -3564,29 +3564,29 @@ nsRuleNode::SetFont(nsPresContext* aPres
           aFont->mFont.weight = 400;
         } else {
           aFont->mFont.weight = 700;
         }
         break;
       }
     }
   } else
-    SetDiscrete(*weightValue, aFont->mFont.weight, aConditions,
-                SETDSC_INTEGER | SETDSC_SYSTEM_FONT | SETDSC_UNSET_INHERIT,
-                aParentFont->mFont.weight,
-                defaultVariableFont->weight,
-                0, 0, 0, systemFont.weight);
+    SetValue(*weightValue, aFont->mFont.weight, aConditions,
+             SETVAL_INTEGER | SETVAL_SYSTEM_FONT | SETVAL_UNSET_INHERIT,
+             aParentFont->mFont.weight,
+             defaultVariableFont->weight,
+             0, 0, 0, systemFont.weight);
 
   // font-stretch: enum, inherit, initial, -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontStretch(),
-              aFont->mFont.stretch, aConditions,
-              SETDSC_SYSTEM_FONT | SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.stretch,
-              defaultVariableFont->stretch,
-              0, 0, 0, systemFont.stretch);
+  SetValue(*aRuleData->ValueForFontStretch(),
+           aFont->mFont.stretch, aConditions,
+           SETVAL_SYSTEM_FONT | SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.stretch,
+           defaultVariableFont->stretch,
+           0, 0, 0, systemFont.stretch);
 
   // Compute scriptlevel, scriptminsize and scriptsizemultiplier now so
   // they're available for font-size computation.
 
   // -moz-script-min-size: length
   const nsCSSValue* scriptMinSizeValue = aRuleData->ValueForScriptMinSize();
   if (scriptMinSizeValue->IsLengthUnit()) {
     // scriptminsize in font units (em, ex) has to be interpreted relative
@@ -3629,31 +3629,31 @@ nsRuleNode::SetFont(nsPresContext* aPres
     aConditions.SetUncacheable();
     aFont->mScriptLevel = aParentFont->mScriptLevel;
   }
   else if (eCSSUnit_Initial == scriptLevelValue->GetUnit()) {
     aFont->mScriptLevel = 0;
   }
 
   // font-kerning: none, enum, inherit, initial, -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontKerning(),
-              aFont->mFont.kerning, aConditions,
-              SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT | SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.kerning,
-              defaultVariableFont->kerning,
-              0, 0, 0, systemFont.kerning);
+  SetValue(*aRuleData->ValueForFontKerning(),
+           aFont->mFont.kerning, aConditions,
+           SETVAL_ENUMERATED | SETVAL_SYSTEM_FONT | SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.kerning,
+           defaultVariableFont->kerning,
+           0, 0, 0, systemFont.kerning);
 
   // font-synthesis: none, enum (bit field), inherit, initial, -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontSynthesis(),
-              aFont->mFont.synthesis, aConditions,
-              SETDSC_NONE | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT |
-                SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.synthesis,
-              defaultVariableFont->synthesis,
-              0, 0, 0, systemFont.synthesis);
+  SetValue(*aRuleData->ValueForFontSynthesis(),
+           aFont->mFont.synthesis, aConditions,
+           SETVAL_NONE | SETVAL_ENUMERATED | SETVAL_SYSTEM_FONT |
+           SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.synthesis,
+           defaultVariableFont->synthesis,
+           0, 0, 0, systemFont.synthesis);
 
   // font-variant-alternates: normal, enum (bit field) + functions, inherit,
   //                          initial, -moz-system-font
   const nsCSSValue* variantAlternatesValue =
     aRuleData->ValueForFontVariantAlternates();
   int32_t variantAlternates = 0;
 
   switch (variantAlternatesValue->GetUnit()) {
@@ -3692,63 +3692,63 @@ nsRuleNode::SetFont(nsPresContext* aPres
     }
     break;
 
   default:
     break;
   }
 
   // font-variant-caps: normal, enum, inherit, initial, -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontVariantCaps(),
-              aFont->mFont.variantCaps, aConditions,
-              SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT |
-                SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.variantCaps,
-              defaultVariableFont->variantCaps,
-              0, 0, 0, systemFont.variantCaps);
+  SetValue(*aRuleData->ValueForFontVariantCaps(),
+           aFont->mFont.variantCaps, aConditions,
+           SETVAL_NORMAL | SETVAL_ENUMERATED | SETVAL_SYSTEM_FONT |
+           SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.variantCaps,
+           defaultVariableFont->variantCaps,
+           0, 0, 0, systemFont.variantCaps);
 
   // font-variant-east-asian: normal, enum (bit field), inherit, initial,
   //                          -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontVariantEastAsian(),
-              aFont->mFont.variantEastAsian, aConditions,
-              SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT |
-                SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.variantEastAsian,
-              defaultVariableFont->variantEastAsian,
-              0, 0, 0, systemFont.variantEastAsian);
+  SetValue(*aRuleData->ValueForFontVariantEastAsian(),
+           aFont->mFont.variantEastAsian, aConditions,
+           SETVAL_NORMAL | SETVAL_ENUMERATED | SETVAL_SYSTEM_FONT |
+           SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.variantEastAsian,
+           defaultVariableFont->variantEastAsian,
+           0, 0, 0, systemFont.variantEastAsian);
 
   // font-variant-ligatures: normal, none, enum (bit field), inherit, initial,
   //                         -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontVariantLigatures(),
-              aFont->mFont.variantLigatures, aConditions,
-              SETDSC_NORMAL | SETDSC_NONE | SETDSC_ENUMERATED |
-                SETDSC_SYSTEM_FONT | SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.variantLigatures,
-              defaultVariableFont->variantLigatures,
-              0, NS_FONT_VARIANT_LIGATURES_NONE, 0, systemFont.variantLigatures);
+  SetValue(*aRuleData->ValueForFontVariantLigatures(),
+           aFont->mFont.variantLigatures, aConditions,
+           SETVAL_NORMAL | SETVAL_NONE | SETVAL_ENUMERATED |
+           SETVAL_SYSTEM_FONT | SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.variantLigatures,
+           defaultVariableFont->variantLigatures,
+           0, NS_FONT_VARIANT_LIGATURES_NONE, 0, systemFont.variantLigatures);
 
   // font-variant-numeric: normal, enum (bit field), inherit, initial,
   //                       -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontVariantNumeric(),
-              aFont->mFont.variantNumeric, aConditions,
-              SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT |
-                SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.variantNumeric,
-              defaultVariableFont->variantNumeric,
-              0, 0, 0, systemFont.variantNumeric);
+  SetValue(*aRuleData->ValueForFontVariantNumeric(),
+           aFont->mFont.variantNumeric, aConditions,
+           SETVAL_NORMAL | SETVAL_ENUMERATED | SETVAL_SYSTEM_FONT |
+           SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.variantNumeric,
+           defaultVariableFont->variantNumeric,
+           0, 0, 0, systemFont.variantNumeric);
 
   // font-variant-position: normal, enum, inherit, initial,
   //                        -moz-system-font
-  SetDiscrete(*aRuleData->ValueForFontVariantPosition(),
-              aFont->mFont.variantPosition, aConditions,
-              SETDSC_NORMAL | SETDSC_ENUMERATED | SETDSC_SYSTEM_FONT |
-                SETDSC_UNSET_INHERIT,
-              aParentFont->mFont.variantPosition,
-              defaultVariableFont->variantPosition,
-              0, 0, 0, systemFont.variantPosition);
+  SetValue(*aRuleData->ValueForFontVariantPosition(),
+           aFont->mFont.variantPosition, aConditions,
+           SETVAL_NORMAL | SETVAL_ENUMERATED | SETVAL_SYSTEM_FONT |
+           SETVAL_UNSET_INHERIT,
+           aParentFont->mFont.variantPosition,
+           defaultVariableFont->variantPosition,
+           0, 0, 0, systemFont.variantPosition);
 
   // font-feature-settings
   const nsCSSValue* featureSettingsValue =
     aRuleData->ValueForFontFeatureSettings();
 
   switch (featureSettingsValue->GetUnit()) {
   case eCSSUnit_Null:
     break;
@@ -4365,20 +4365,20 @@ nsRuleNode::ComputeTextData(void* aStart
                             nsStyleContext* aContext,
                             nsRuleNode* aHighestNode,
                             const RuleDetail aRuleDetail,
                             const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(Text, text, parentText)
 
   // tab-size: integer, inherit
-  SetDiscrete(*aRuleData->ValueForTabSize(),
-              text->mTabSize, conditions,
-              SETDSC_INTEGER | SETDSC_UNSET_INHERIT, parentText->mTabSize,
-              NS_STYLE_TABSIZE_INITIAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTabSize(),
+           text->mTabSize, conditions,
+           SETVAL_INTEGER | SETVAL_UNSET_INHERIT, parentText->mTabSize,
+           NS_STYLE_TABSIZE_INITIAL, 0, 0, 0, 0);
 
   // letter-spacing: normal, length, inherit
   SetCoord(*aRuleData->ValueForLetterSpacing(),
            text->mLetterSpacing, parentText->mLetterSpacing,
            SETCOORD_LH | SETCOORD_NORMAL | SETCOORD_INITIAL_NORMAL |
              SETCOORD_CALC_LENGTH_ONLY | SETCOORD_UNSET_INHERIT,
            aContext, mPresContext, conditions);
 
@@ -4498,20 +4498,20 @@ nsRuleNode::ComputeTextData(void* aStart
         }
       } else if (eCSSUnit_String == textAlignValue->GetUnit()) {
         NS_NOTYETIMPLEMENTED("align string");
       }
     } else if (eCSSUnit_Inherit == textAlignValue->GetUnit() ||
                eCSSUnit_Unset == textAlignValue->GetUnit()) {
       text->mTextAlignTrue = parentText->mTextAlignTrue;
     }
-    SetDiscrete(*textAlignValue, text->mTextAlign, conditions,
-                SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-                parentText->mTextAlign,
-                NS_STYLE_TEXT_ALIGN_START, 0, 0, 0, 0);
+    SetValue(*textAlignValue, text->mTextAlign, conditions,
+             SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+             parentText->mTextAlign,
+             NS_STYLE_TEXT_ALIGN_START, 0, 0, 0, 0);
   }
 
   // text-align-last: enum, pair(enum), inherit, initial
   const nsCSSValue* textAlignLastValue = aRuleData->ValueForTextAlignLast();
   text->mTextAlignLastTrue = false;
   if (eCSSUnit_Pair == textAlignLastValue->GetUnit()) {
     // Two values were specified, one must be 'true'.
     text->mTextAlignLastTrue = true;
@@ -4521,102 +4521,102 @@ nsRuleNode::ComputeTextData(void* aStart
       if (textAlignLastValue->GetIntValue() == NS_STYLE_TEXT_ALIGN_UNSAFE) {
         textAlignLastValue = &textAlignLastValuePair.mYValue;
       }
     }
   } else if (eCSSUnit_Inherit == textAlignLastValue->GetUnit() ||
              eCSSUnit_Unset == textAlignLastValue->GetUnit()) {
     text->mTextAlignLastTrue = parentText->mTextAlignLastTrue;
   }
-  SetDiscrete(*textAlignLastValue, text->mTextAlignLast,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mTextAlignLast,
-              NS_STYLE_TEXT_ALIGN_AUTO, 0, 0, 0, 0);
+  SetValue(*textAlignLastValue, text->mTextAlignLast,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mTextAlignLast,
+           NS_STYLE_TEXT_ALIGN_AUTO, 0, 0, 0, 0);
 
   // text-indent: length, percent, calc, inherit, initial
   SetCoord(*aRuleData->ValueForTextIndent(), text->mTextIndent, parentText->mTextIndent,
            SETCOORD_LPH | SETCOORD_INITIAL_ZERO | SETCOORD_STORE_CALC |
              SETCOORD_UNSET_INHERIT,
            aContext, mPresContext, conditions);
 
   // text-transform: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTextTransform(), text->mTextTransform, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mTextTransform,
-              NS_STYLE_TEXT_TRANSFORM_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTextTransform(), text->mTextTransform, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mTextTransform,
+           NS_STYLE_TEXT_TRANSFORM_NONE, 0, 0, 0, 0);
 
   // white-space: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForWhiteSpace(), text->mWhiteSpace, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mWhiteSpace,
-              NS_STYLE_WHITESPACE_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForWhiteSpace(), text->mWhiteSpace, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mWhiteSpace,
+           NS_STYLE_WHITESPACE_NORMAL, 0, 0, 0, 0);
 
   // word-break: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForWordBreak(), text->mWordBreak, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mWordBreak,
-              NS_STYLE_WORDBREAK_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForWordBreak(), text->mWordBreak, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mWordBreak,
+           NS_STYLE_WORDBREAK_NORMAL, 0, 0, 0, 0);
 
   // word-spacing: normal, length, percent, inherit
   const nsCSSValue* wordSpacingValue = aRuleData->ValueForWordSpacing();
   if (wordSpacingValue->GetUnit() == eCSSUnit_Normal) {
     // Do this so that "normal" computes to 0px, as the CSS 2.1 spec requires.
     text->mWordSpacing.SetCoordValue(0);
   } else {
     SetCoord(*aRuleData->ValueForWordSpacing(),
              text->mWordSpacing, parentText->mWordSpacing,
              SETCOORD_LPH | SETCOORD_INITIAL_ZERO |
                SETCOORD_STORE_CALC | SETCOORD_UNSET_INHERIT,
              aContext, mPresContext, conditions);
   }
 
   // overflow-wrap: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForOverflowWrap(), text->mOverflowWrap, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mOverflowWrap,
-              NS_STYLE_OVERFLOWWRAP_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForOverflowWrap(), text->mOverflowWrap, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mOverflowWrap,
+           NS_STYLE_OVERFLOWWRAP_NORMAL, 0, 0, 0, 0);
 
   // hyphens: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForHyphens(), text->mHyphens, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mHyphens,
-              NS_STYLE_HYPHENS_MANUAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForHyphens(), text->mHyphens, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mHyphens,
+           NS_STYLE_HYPHENS_MANUAL, 0, 0, 0, 0);
 
   // ruby-align: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForRubyAlign(),
-              text->mRubyAlign, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mRubyAlign,
-              NS_STYLE_RUBY_ALIGN_SPACE_AROUND, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForRubyAlign(),
+           text->mRubyAlign, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mRubyAlign,
+           NS_STYLE_RUBY_ALIGN_SPACE_AROUND, 0, 0, 0, 0);
 
   // ruby-position: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForRubyPosition(),
-              text->mRubyPosition, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mRubyPosition,
-              NS_STYLE_RUBY_POSITION_OVER, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForRubyPosition(),
+           text->mRubyPosition, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mRubyPosition,
+           NS_STYLE_RUBY_POSITION_OVER, 0, 0, 0, 0);
 
   // text-size-adjust: none, auto, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTextSizeAdjust(), text->mTextSizeAdjust,
-              conditions,
-              SETDSC_NONE | SETDSC_AUTO | SETDSC_UNSET_INHERIT,
-              parentText->mTextSizeAdjust,
-              NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // initial value
-              NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // auto value
-              NS_STYLE_TEXT_SIZE_ADJUST_NONE, // none value
-              0, 0);
+  SetValue(*aRuleData->ValueForTextSizeAdjust(), text->mTextSizeAdjust,
+           conditions,
+           SETVAL_NONE | SETVAL_AUTO | SETVAL_UNSET_INHERIT,
+           parentText->mTextSizeAdjust,
+           NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // initial value
+           NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // auto value
+           NS_STYLE_TEXT_SIZE_ADJUST_NONE, // none value
+           0, 0);
 
   // text-combine-upright: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTextCombineUpright(),
-              text->mTextCombineUpright,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mTextCombineUpright,
-              NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTextCombineUpright(),
+           text->mTextCombineUpright,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mTextCombineUpright,
+           NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE, 0, 0, 0, 0);
 
   // text-emphasis-color: color, string, inherit, initial
   const nsCSSValue*
     textEmphasisColorValue = aRuleData->ValueForTextEmphasisColor();
   if (textEmphasisColorValue->GetUnit() == eCSSUnit_Null) {
     // We don't want to change anything in this case.
   } else if (textEmphasisColorValue->GetUnit() == eCSSUnit_Inherit ||
              textEmphasisColorValue->GetUnit() == eCSSUnit_Unset) {
@@ -4631,23 +4631,23 @@ nsRuleNode::ComputeTextData(void* aStart
     text->mTextEmphasisColor = mPresContext->DefaultColor();
   } else {
     text->mTextEmphasisColorForeground = false;
     SetColor(*textEmphasisColorValue, 0, mPresContext, aContext,
              text->mTextEmphasisColor, conditions);
   }
 
   // text-emphasis-position: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTextEmphasisPosition(),
-              text->mTextEmphasisPosition,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mTextEmphasisPosition,
-              NS_STYLE_TEXT_EMPHASIS_POSITION_OVER |
-              NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTextEmphasisPosition(),
+           text->mTextEmphasisPosition,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mTextEmphasisPosition,
+           NS_STYLE_TEXT_EMPHASIS_POSITION_OVER |
+           NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT, 0, 0, 0, 0);
 
   // text-emphasis-style: string, enum, inherit, initial
   const nsCSSValue* textEmphasisStyleValue =
     aRuleData->ValueForTextEmphasisStyle();
   switch (textEmphasisStyleValue->GetUnit()) {
     case eCSSUnit_Null:
       break;
     case eCSSUnit_Initial:
@@ -4695,21 +4695,21 @@ nsRuleNode::ComputeTextData(void* aStart
       text->mTextEmphasisStyleString = strValue;
       break;
     }
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown value unit type");
   }
 
   // text-rendering: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTextRendering(),
-              text->mTextRendering, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mTextRendering,
-              NS_STYLE_TEXT_RENDERING_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTextRendering(),
+           text->mTextRendering, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mTextRendering,
+           NS_STYLE_TEXT_RENDERING_AUTO, 0, 0, 0, 0);
 
   // -webkit-text-fill-color: color, string, inherit, initial
   const nsCSSValue*
     webkitTextFillColorValue = aRuleData->ValueForWebkitTextFillColor();
   if (webkitTextFillColorValue->GetUnit() == eCSSUnit_Null) {
     // We don't want to change anything in this case.
   } else if (webkitTextFillColorValue->GetUnit() == eCSSUnit_Inherit ||
              webkitTextFillColorValue->GetUnit() == eCSSUnit_Unset) {
@@ -4764,22 +4764,22 @@ nsRuleNode::ComputeTextData(void* aStart
              parentText->mWebkitTextStrokeWidth,
              SETCOORD_LH | SETCOORD_CALC_LENGTH_ONLY |
                SETCOORD_CALC_CLAMP_NONNEGATIVE |
                SETCOORD_INITIAL_ZERO | SETCOORD_UNSET_INHERIT,
              aContext, mPresContext, conditions);
   }
 
   // -moz-control-character-visibility: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForControlCharacterVisibility(),
-              text->mControlCharacterVisibility,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentText->mControlCharacterVisibility,
-              nsCSSParser::ControlCharVisibilityDefault(), 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForControlCharacterVisibility(),
+           text->mControlCharacterVisibility,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentText->mControlCharacterVisibility,
+           nsCSSParser::ControlCharVisibilityDefault(), 0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(Text, text)
 }
 
 const void*
 nsRuleNode::ComputeTextResetData(void* aStartStruct,
                                  const nsRuleData* aRuleData,
                                  nsStyleContext* aContext,
@@ -4868,20 +4868,20 @@ nsRuleNode::ComputeTextResetData(void* a
   if (eCSSUnit_Initial == textOverflowValue->GetUnit() ||
       eCSSUnit_Unset == textOverflowValue->GetUnit()) {
     text->mTextOverflow = nsStyleTextOverflow();
   } else if (eCSSUnit_Inherit == textOverflowValue->GetUnit()) {
     conditions.SetUncacheable();
     text->mTextOverflow = parentText->mTextOverflow;
   } else if (eCSSUnit_Enumerated == textOverflowValue->GetUnit()) {
     // A single enumerated value.
-    SetDiscrete(*textOverflowValue, text->mTextOverflow.mRight.mType,
-                conditions,
-                SETDSC_ENUMERATED, parentText->mTextOverflow.mRight.mType,
-                NS_STYLE_TEXT_OVERFLOW_CLIP, 0, 0, 0, 0);
+    SetValue(*textOverflowValue, text->mTextOverflow.mRight.mType,
+             conditions,
+             SETVAL_ENUMERATED, parentText->mTextOverflow.mRight.mType,
+             NS_STYLE_TEXT_OVERFLOW_CLIP, 0, 0, 0, 0);
     text->mTextOverflow.mRight.mString.Truncate();
     text->mTextOverflow.mLeft.mType = NS_STYLE_TEXT_OVERFLOW_CLIP;
     text->mTextOverflow.mLeft.mString.Truncate();
     text->mTextOverflow.mLogicalDirections = true;
   } else if (eCSSUnit_String == textOverflowValue->GetUnit()) {
     // A single string value.
     text->mTextOverflow.mRight.mType = NS_STYLE_TEXT_OVERFLOW_STRING;
     textOverflowValue->GetStringValue(text->mTextOverflow.mRight.mString);
@@ -4891,44 +4891,44 @@ nsRuleNode::ComputeTextResetData(void* a
   } else if (eCSSUnit_Pair == textOverflowValue->GetUnit()) {
     // Two values were specified.
     text->mTextOverflow.mLogicalDirections = false;
     const nsCSSValuePair& textOverflowValuePair =
       textOverflowValue->GetPairValue();
 
     const nsCSSValue *textOverflowLeftValue = &textOverflowValuePair.mXValue;
     if (eCSSUnit_Enumerated == textOverflowLeftValue->GetUnit()) {
-      SetDiscrete(*textOverflowLeftValue, text->mTextOverflow.mLeft.mType,
-                  conditions,
-                  SETDSC_ENUMERATED, parentText->mTextOverflow.mLeft.mType,
-                  NS_STYLE_TEXT_OVERFLOW_CLIP, 0, 0, 0, 0);
+      SetValue(*textOverflowLeftValue, text->mTextOverflow.mLeft.mType,
+               conditions,
+               SETVAL_ENUMERATED, parentText->mTextOverflow.mLeft.mType,
+               NS_STYLE_TEXT_OVERFLOW_CLIP, 0, 0, 0, 0);
       text->mTextOverflow.mLeft.mString.Truncate();
     } else if (eCSSUnit_String == textOverflowLeftValue->GetUnit()) {
       textOverflowLeftValue->GetStringValue(text->mTextOverflow.mLeft.mString);
       text->mTextOverflow.mLeft.mType = NS_STYLE_TEXT_OVERFLOW_STRING;
     }
 
     const nsCSSValue *textOverflowRightValue = &textOverflowValuePair.mYValue;
     if (eCSSUnit_Enumerated == textOverflowRightValue->GetUnit()) {
-      SetDiscrete(*textOverflowRightValue, text->mTextOverflow.mRight.mType,
-                  conditions,
-                  SETDSC_ENUMERATED, parentText->mTextOverflow.mRight.mType,
-                  NS_STYLE_TEXT_OVERFLOW_CLIP, 0, 0, 0, 0);
+      SetValue(*textOverflowRightValue, text->mTextOverflow.mRight.mType,
+               conditions,
+               SETVAL_ENUMERATED, parentText->mTextOverflow.mRight.mType,
+               NS_STYLE_TEXT_OVERFLOW_CLIP, 0, 0, 0, 0);
       text->mTextOverflow.mRight.mString.Truncate();
     } else if (eCSSUnit_String == textOverflowRightValue->GetUnit()) {
       textOverflowRightValue->GetStringValue(text->mTextOverflow.mRight.mString);
       text->mTextOverflow.mRight.mType = NS_STYLE_TEXT_OVERFLOW_STRING;
     }
   }
 
   // unicode-bidi: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForUnicodeBidi(), text->mUnicodeBidi, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentText->mUnicodeBidi,
-              NS_STYLE_UNICODE_BIDI_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForUnicodeBidi(), text->mUnicodeBidi, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentText->mUnicodeBidi,
+           NS_STYLE_UNICODE_BIDI_NORMAL, 0, 0, 0, 0);
 
   COMPUTE_END_RESET(TextReset, text)
 }
 
 const void*
 nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
                                      const nsRuleData* aRuleData,
                                      nsStyleContext* aContext,
@@ -4994,92 +4994,92 @@ nsRuleNode::ComputeUserInterfaceData(voi
       NS_ASSERTION(list, "Must have non-array value at the end");
       NS_ASSERTION(list->mValue.GetUnit() == eCSSUnit_Enumerated,
                    "Unexpected fallback value at end of cursor list");
       ui->mCursor = list->mValue.GetIntValue();
     }
   }
 
   // user-input: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForUserInput(),
-              ui->mUserInput, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentUI->mUserInput,
-              NS_STYLE_USER_INPUT_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForUserInput(),
+           ui->mUserInput, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentUI->mUserInput,
+           NS_STYLE_USER_INPUT_AUTO, 0, 0, 0, 0);
 
   // user-modify: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForUserModify(),
-              ui->mUserModify, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentUI->mUserModify,
-              NS_STYLE_USER_MODIFY_READ_ONLY,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForUserModify(),
+           ui->mUserModify, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentUI->mUserModify,
+           NS_STYLE_USER_MODIFY_READ_ONLY,
+           0, 0, 0, 0);
 
   // user-focus: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForUserFocus(),
-              ui->mUserFocus, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentUI->mUserFocus,
-              NS_STYLE_USER_FOCUS_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForUserFocus(),
+           ui->mUserFocus, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentUI->mUserFocus,
+           NS_STYLE_USER_FOCUS_NONE, 0, 0, 0, 0);
 
   // pointer-events: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForPointerEvents(), ui->mPointerEvents,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentUI->mPointerEvents,
-              NS_STYLE_POINTER_EVENTS_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForPointerEvents(), ui->mPointerEvents,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentUI->mPointerEvents,
+           NS_STYLE_POINTER_EVENTS_AUTO, 0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(UserInterface, ui)
 }
 
 const void*
 nsRuleNode::ComputeUIResetData(void* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
                                nsRuleNode* aHighestNode,
                                const RuleDetail aRuleDetail,
                                const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(UIReset, ui, parentUI)
 
   // user-select: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForUserSelect(),
-              ui->mUserSelect, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentUI->mUserSelect,
-              NS_STYLE_USER_SELECT_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForUserSelect(),
+           ui->mUserSelect, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentUI->mUserSelect,
+           NS_STYLE_USER_SELECT_AUTO, 0, 0, 0, 0);
 
   // ime-mode: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForImeMode(),
-              ui->mIMEMode, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentUI->mIMEMode,
-              NS_STYLE_IME_MODE_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForImeMode(),
+           ui->mIMEMode, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentUI->mIMEMode,
+           NS_STYLE_IME_MODE_AUTO, 0, 0, 0, 0);
 
   // force-broken-image-icons: integer, inherit, initial
-  SetDiscrete(*aRuleData->ValueForForceBrokenImageIcon(),
-              ui->mForceBrokenImageIcon,
-              conditions,
-              SETDSC_INTEGER | SETDSC_UNSET_INITIAL,
-              parentUI->mForceBrokenImageIcon,
-              0, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForForceBrokenImageIcon(),
+           ui->mForceBrokenImageIcon,
+           conditions,
+           SETVAL_INTEGER | SETVAL_UNSET_INITIAL,
+           parentUI->mForceBrokenImageIcon,
+           0, 0, 0, 0, 0);
 
   // -moz-window-dragging: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForWindowDragging(),
-              ui->mWindowDragging, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentUI->mWindowDragging,
-              NS_STYLE_WINDOW_DRAGGING_DEFAULT, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForWindowDragging(),
+           ui->mWindowDragging, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentUI->mWindowDragging,
+           NS_STYLE_WINDOW_DRAGGING_DEFAULT, 0, 0, 0, 0);
 
   // -moz-window-shadow: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForWindowShadow(),
-              ui->mWindowShadow, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentUI->mWindowShadow,
-              NS_STYLE_WINDOW_SHADOW_DEFAULT, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForWindowShadow(),
+           ui->mWindowShadow, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentUI->mWindowShadow,
+           NS_STYLE_WINDOW_SHADOW_DEFAULT, 0, 0, 0, 0);
 
   COMPUTE_END_RESET(UIReset, ui)
 }
 
 // Information about each transition or animation property that is
 // constant.
 struct TransitionPropInfo {
   nsCSSProperty property;
@@ -5694,47 +5694,47 @@ nsRuleNode::ComputeDisplayData(void* aSt
       if (d.list) {
         d.list = d.list->mNext ? d.list->mNext :
           aRuleData->ValueFor(info.property)->GetListValue();
       }
     }
   }
 
   // display: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForDisplay(), display->mDisplay, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mDisplay,
-              NS_STYLE_DISPLAY_INLINE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForDisplay(), display->mDisplay, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mDisplay,
+           NS_STYLE_DISPLAY_INLINE, 0, 0, 0, 0);
 
   // contain: none, enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForContain(), display->mContain, conditions,
-              SETDSC_ENUMERATED | SETDSC_NONE | SETDSC_UNSET_INITIAL,
-              parentDisplay->mContain,
-              NS_STYLE_CONTAIN_NONE, 0, NS_STYLE_CONTAIN_NONE, 0, 0);
+  SetValue(*aRuleData->ValueForContain(), display->mContain, conditions,
+           SETVAL_ENUMERATED | SETVAL_NONE | SETVAL_UNSET_INITIAL,
+           parentDisplay->mContain,
+           NS_STYLE_CONTAIN_NONE, 0, NS_STYLE_CONTAIN_NONE, 0, 0);
 
   // scroll-behavior: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForScrollBehavior(), display->mScrollBehavior,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mScrollBehavior, NS_STYLE_SCROLL_BEHAVIOR_AUTO,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForScrollBehavior(), display->mScrollBehavior,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mScrollBehavior, NS_STYLE_SCROLL_BEHAVIOR_AUTO,
+           0, 0, 0, 0);
 
   // scroll-snap-type-x: none, enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForScrollSnapTypeX(), display->mScrollSnapTypeX,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mScrollSnapTypeX, NS_STYLE_SCROLL_SNAP_TYPE_NONE,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForScrollSnapTypeX(), display->mScrollSnapTypeX,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mScrollSnapTypeX, NS_STYLE_SCROLL_SNAP_TYPE_NONE,
+           0, 0, 0, 0);
 
   // scroll-snap-type-y: none, enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForScrollSnapTypeY(), display->mScrollSnapTypeY,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mScrollSnapTypeY, NS_STYLE_SCROLL_SNAP_TYPE_NONE,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForScrollSnapTypeY(), display->mScrollSnapTypeY,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mScrollSnapTypeY, NS_STYLE_SCROLL_SNAP_TYPE_NONE,
+           0, 0, 0, 0);
 
   // scroll-snap-points-x: none, inherit, initial
   const nsCSSValue& scrollSnapPointsX = *aRuleData->ValueForScrollSnapPointsX();
   switch (scrollSnapPointsX.GetUnit()) {
     case eCSSUnit_Null:
       break;
     case eCSSUnit_Initial:
     case eCSSUnit_Unset:
@@ -5852,40 +5852,40 @@ nsRuleNode::ComputeDisplayData(void* aSt
       } while(item);
       break;
     }
     default:
       NS_NOTREACHED("unexpected unit");
   }
 
   // isolation: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForIsolation(), display->mIsolation,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mIsolation, NS_STYLE_ISOLATION_AUTO,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForIsolation(), display->mIsolation,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mIsolation, NS_STYLE_ISOLATION_AUTO,
+           0, 0, 0, 0);
 
   // -moz-top-layer: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTopLayer(), display->mTopLayer,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mTopLayer, NS_STYLE_TOP_LAYER_NONE,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTopLayer(), display->mTopLayer,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mTopLayer, NS_STYLE_TOP_LAYER_NONE,
+           0, 0, 0, 0);
 
   // Backup original display value for calculation of a hypothetical
   // box (CSS2 10.6.4/10.6.5), in addition to getting our style data right later.
   // See nsHTMLReflowState::CalculateHypotheticalBox
   display->mOriginalDisplay = display->mDisplay;
 
   // appearance: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForAppearance(),
-              display->mAppearance, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mAppearance,
-              NS_THEME_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForAppearance(),
+           display->mAppearance, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mAppearance,
+           NS_THEME_NONE, 0, 0, 0, 0);
 
   // binding: url, none, inherit
   const nsCSSValue* bindingValue = aRuleData->ValueForBinding();
   if (eCSSUnit_URL == bindingValue->GetUnit()) {
     mozilla::css::URLValue* url = bindingValue->GetURLStructValue();
     NS_ASSERTION(url, "What's going on here?");
 
     if (MOZ_LIKELY(url->GetURI())) {
@@ -5900,36 +5900,36 @@ nsRuleNode::ComputeDisplayData(void* aSt
     display->mBinding = nullptr;
   }
   else if (eCSSUnit_Inherit == bindingValue->GetUnit()) {
     conditions.SetUncacheable();
     display->mBinding = parentDisplay->mBinding;
   }
 
   // position: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForPosition(), display->mPosition, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mPosition,
-              NS_STYLE_POSITION_STATIC, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForPosition(), display->mPosition, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mPosition,
+           NS_STYLE_POSITION_STATIC, 0, 0, 0, 0);
   // If an element is put in the top layer, while it is not absolutely
   // positioned, the position value should be computed to 'absolute' per
   // the Fullscreen API spec.
   if (display->mTopLayer != NS_STYLE_TOP_LAYER_NONE &&
       !display->IsAbsolutelyPositionedStyle()) {
     display->mPosition = NS_STYLE_POSITION_ABSOLUTE;
     // We cannot cache this struct because otherwise it may be used as
     // an aStartStruct for some other elements.
     conditions.SetUncacheable();
   }
 
   // clear: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForClear(), display->mBreakType, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mBreakType,
-              NS_STYLE_CLEAR_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForClear(), display->mBreakType, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mBreakType,
+           NS_STYLE_CLEAR_NONE, 0, 0, 0, 0);
 
   // temp fix for bug 24000
   // Map 'auto' and 'avoid' to false, and 'always', 'left', and
   // 'right' to true.
   // "A conforming user agent may interpret the values 'left' and
   // 'right' as 'always'." - CSS2.1, section 13.3.1
   const nsCSSValue* breakBeforeValue = aRuleData->ValueForPageBreakBefore();
   if (eCSSUnit_Enumerated == breakBeforeValue->GetUnit()) {
@@ -5958,54 +5958,54 @@ nsRuleNode::ComputeDisplayData(void* aSt
   }
   else if (eCSSUnit_Inherit == breakAfterValue->GetUnit()) {
     conditions.SetUncacheable();
     display->mBreakAfter = parentDisplay->mBreakAfter;
   }
   // end temp fix
 
   // page-break-inside: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForPageBreakInside(),
-              display->mBreakInside, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mBreakInside,
-              NS_STYLE_PAGE_BREAK_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForPageBreakInside(),
+           display->mBreakInside, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mBreakInside,
+           NS_STYLE_PAGE_BREAK_AUTO, 0, 0, 0, 0);
 
   // touch-action: none, auto, enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTouchAction(), display->mTouchAction,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_AUTO | SETDSC_NONE |
-                SETDSC_UNSET_INITIAL,
-              parentDisplay->mTouchAction,
-              NS_STYLE_TOUCH_ACTION_AUTO,
-              NS_STYLE_TOUCH_ACTION_AUTO,
-              NS_STYLE_TOUCH_ACTION_NONE, 0, 0);
+  SetValue(*aRuleData->ValueForTouchAction(), display->mTouchAction,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_AUTO | SETVAL_NONE |
+           SETVAL_UNSET_INITIAL,
+           parentDisplay->mTouchAction,
+           NS_STYLE_TOUCH_ACTION_AUTO,
+           NS_STYLE_TOUCH_ACTION_AUTO,
+           NS_STYLE_TOUCH_ACTION_NONE, 0, 0);
 
   // float: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForFloat(),
-              display->mFloats, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mFloats,
-              NS_STYLE_FLOAT_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForFloat(),
+           display->mFloats, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mFloats,
+           NS_STYLE_FLOAT_NONE, 0, 0, 0, 0);
   // Save mFloats in mOriginalFloats in case we need it later
   display->mOriginalFloats = display->mFloats;
 
   // overflow-x: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForOverflowX(),
-              display->mOverflowX, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mOverflowX,
-              NS_STYLE_OVERFLOW_VISIBLE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForOverflowX(),
+           display->mOverflowX, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mOverflowX,
+           NS_STYLE_OVERFLOW_VISIBLE, 0, 0, 0, 0);
 
   // overflow-y: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForOverflowY(),
-              display->mOverflowY, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mOverflowY,
-              NS_STYLE_OVERFLOW_VISIBLE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForOverflowY(),
+           display->mOverflowY, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mOverflowY,
+           NS_STYLE_OVERFLOW_VISIBLE, 0, 0, 0, 0);
 
   // CSS3 overflow-x and overflow-y require some fixup as well in some
   // cases.  NS_STYLE_OVERFLOW_VISIBLE and NS_STYLE_OVERFLOW_CLIP are
   // meaningful only when used in both dimensions.
   if (display->mOverflowX != display->mOverflowY &&
       (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE ||
        display->mOverflowX == NS_STYLE_OVERFLOW_CLIP ||
        display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE ||
@@ -6039,26 +6039,26 @@ nsRuleNode::ComputeDisplayData(void* aSt
       conditions.SetUncacheable();
     }
     if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
       display->mOverflowY = NS_STYLE_OVERFLOW_CLIP;
       conditions.SetUncacheable();
     }
   }
 
-  SetDiscrete(*aRuleData->ValueForOverflowClipBox(), display->mOverflowClipBox,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mOverflowClipBox,
-              NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX, 0, 0, 0, 0);
-
-  SetDiscrete(*aRuleData->ValueForResize(), display->mResize, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mResize,
-              NS_STYLE_RESIZE_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForOverflowClipBox(), display->mOverflowClipBox,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mOverflowClipBox,
+           NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX, 0, 0, 0, 0);
+
+  SetValue(*aRuleData->ValueForResize(), display->mResize, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mResize,
+           NS_STYLE_RESIZE_NONE, 0, 0, 0, 0);
 
   if (display->mDisplay != NS_STYLE_DISPLAY_NONE) {
     // CSS2 9.7 specifies display type corrections dealing with 'float'
     // and 'position'.  Since generated content can't be floated or
     // positioned, we can deal with it here.
 
     nsIAtom* pseudo = aContext->GetPseudo();
     if (pseudo && display->mDisplay == NS_STYLE_DISPLAY_CONTENTS) {
@@ -6322,42 +6322,42 @@ nsRuleNode::ComputeDisplayData(void* aSt
   }
 
   SetCoord(*aRuleData->ValueForPerspective(),
            display->mChildPerspective, parentDisplay->mChildPerspective,
            SETCOORD_LAH | SETCOORD_INITIAL_NONE | SETCOORD_NONE |
              SETCOORD_UNSET_INITIAL,
            aContext, mPresContext, conditions);
 
-  SetDiscrete(*aRuleData->ValueForBackfaceVisibility(),
-              display->mBackfaceVisibility, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mBackfaceVisibility,
-              NS_STYLE_BACKFACE_VISIBILITY_VISIBLE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBackfaceVisibility(),
+           display->mBackfaceVisibility, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mBackfaceVisibility,
+           NS_STYLE_BACKFACE_VISIBILITY_VISIBLE, 0, 0, 0, 0);
 
   // transform-style: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTransformStyle(),
-              display->mTransformStyle, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mTransformStyle,
-              NS_STYLE_TRANSFORM_STYLE_FLAT, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTransformStyle(),
+           display->mTransformStyle, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mTransformStyle,
+           NS_STYLE_TRANSFORM_STYLE_FLAT, 0, 0, 0, 0);
 
   // transform-box: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTransformBox(),
-              display->mTransformBox, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mTransformBox,
-              NS_STYLE_TRANSFORM_BOX_BORDER_BOX, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTransformBox(),
+           display->mTransformBox, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mTransformBox,
+           NS_STYLE_TRANSFORM_BOX_BORDER_BOX, 0, 0, 0, 0);
 
   // orient: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForOrient(),
-              display->mOrient, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentDisplay->mOrient,
-              NS_STYLE_ORIENT_INLINE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForOrient(),
+           display->mOrient, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentDisplay->mOrient,
+           NS_STYLE_ORIENT_INLINE, 0, 0, 0, 0);
 
   COMPUTE_END_RESET(Display, display)
 }
 
 const void*
 nsRuleNode::ComputeVisibilityData(void* aStartStruct,
                                   const nsRuleData* aRuleData,
                                   nsStyleContext* aContext,
@@ -6367,52 +6367,52 @@ nsRuleNode::ComputeVisibilityData(void* 
 {
   COMPUTE_START_INHERITED(Visibility, visibility, parentVisibility)
 
   // IMPORTANT: No properties in this struct have lengths in them.  We
   // depend on this since CalcLengthWith can call StyleVisibility()
   // to get the language for resolving fonts!
 
   // direction: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForDirection(), visibility->mDirection,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentVisibility->mDirection,
-              (GET_BIDI_OPTION_DIRECTION(mPresContext->GetBidi())
-               == IBMBIDI_TEXTDIRECTION_RTL)
-              ? NS_STYLE_DIRECTION_RTL : NS_STYLE_DIRECTION_LTR,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForDirection(), visibility->mDirection,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentVisibility->mDirection,
+           (GET_BIDI_OPTION_DIRECTION(mPresContext->GetBidi())
+            == IBMBIDI_TEXTDIRECTION_RTL)
+           ? NS_STYLE_DIRECTION_RTL : NS_STYLE_DIRECTION_LTR,
+           0, 0, 0, 0);
 
   // visibility: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForVisibility(), visibility->mVisible,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentVisibility->mVisible,
-              NS_STYLE_VISIBILITY_VISIBLE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForVisibility(), visibility->mVisible,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentVisibility->mVisible,
+           NS_STYLE_VISIBILITY_VISIBLE, 0, 0, 0, 0);
 
   // image-rendering: enum, inherit
-  SetDiscrete(*aRuleData->ValueForImageRendering(),
-              visibility->mImageRendering, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentVisibility->mImageRendering,
-              NS_STYLE_IMAGE_RENDERING_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForImageRendering(),
+           visibility->mImageRendering, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentVisibility->mImageRendering,
+           NS_STYLE_IMAGE_RENDERING_AUTO, 0, 0, 0, 0);
 
   // writing-mode: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForWritingMode(), visibility->mWritingMode,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentVisibility->mWritingMode,
-              NS_STYLE_WRITING_MODE_HORIZONTAL_TB, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForWritingMode(), visibility->mWritingMode,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentVisibility->mWritingMode,
+           NS_STYLE_WRITING_MODE_HORIZONTAL_TB, 0, 0, 0, 0);
 
   // text-orientation: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTextOrientation(), visibility->mTextOrientation,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentVisibility->mTextOrientation,
-              NS_STYLE_TEXT_ORIENTATION_MIXED, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTextOrientation(), visibility->mTextOrientation,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentVisibility->mTextOrientation,
+           NS_STYLE_TEXT_ORIENTATION_MIXED, 0, 0, 0, 0);
 
   // image-orientation: enum, inherit, initial
   const nsCSSValue* orientation = aRuleData->ValueForImageOrientation();
   if (orientation->GetUnit() == eCSSUnit_Inherit ||
       orientation->GetUnit() == eCSSUnit_Unset) {
     conditions.SetUncacheable();
     visibility->mImageOrientation = parentVisibility->mImageOrientation;
   } else if (orientation->GetUnit() == eCSSUnit_Initial) {
@@ -6442,21 +6442,21 @@ nsRuleNode::ComputeVisibilityData(void* 
         break;
       default:
         NS_NOTREACHED("Invalid image-orientation enumerated value");
     }
   } else {
     MOZ_ASSERT(orientation->GetUnit() == eCSSUnit_Null, "Should be null unit");
   }
 
-  SetDiscrete(*aRuleData->ValueForColorAdjust(), visibility->mColorAdjust,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentVisibility->mColorAdjust,
-              NS_STYLE_COLOR_ADJUST_ECONOMY, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForColorAdjust(), visibility->mColorAdjust,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentVisibility->mColorAdjust,
+           NS_STYLE_COLOR_ADJUST_ECONOMY, 0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(Visibility, visibility)
 }
 
 const void*
 nsRuleNode::ComputeColorData(void* aStartStruct,
                              const nsRuleData* aRuleData,
                              nsStyleContext* aContext,
@@ -6495,18 +6495,18 @@ struct BackgroundItemComputer {
 template <>
 struct BackgroundItemComputer<nsCSSValueList, uint8_t>
 {
   static void ComputeValue(nsStyleContext* aStyleContext,
                            const nsCSSValueList* aSpecifiedValue,
                            uint8_t& aComputedValue,
                            RuleNodeCacheConditions& aConditions)
   {
-    SetDiscrete(aSpecifiedValue->mValue, aComputedValue, aConditions,
-                SETDSC_ENUMERATED, uint8_t(0), 0, 0, 0, 0, 0);
+    SetValue(aSpecifiedValue->mValue, aComputedValue, aConditions,
+             SETVAL_ENUMERATED, uint8_t(0), 0, 0, 0, 0, 0);
   }
 };
 
 template <>
 struct BackgroundItemComputer<nsCSSValuePairList, nsStyleImageLayers::Repeat>
 {
   static void ComputeValue(nsStyleContext* aStyleContext,
                            const nsCSSValuePairList* aSpecifiedValue,
@@ -7319,21 +7319,21 @@ nsRuleNode::ComputeBorderData(void* aSta
                               nsStyleContext* aContext,
                               nsRuleNode* aHighestNode,
                               const RuleDetail aRuleDetail,
                               const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Border, border, parentBorder)
 
   // box-decoration-break: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBoxDecorationBreak(),
-              border->mBoxDecorationBreak, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentBorder->mBoxDecorationBreak,
-              NS_STYLE_BOX_DECORATION_BREAK_SLICE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBoxDecorationBreak(),
+           border->mBoxDecorationBreak, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentBorder->mBoxDecorationBreak,
+           NS_STYLE_BOX_DECORATION_BREAK_SLICE, 0, 0, 0, 0);
 
   // border-width, border-*-width: length, enum, inherit
   nsStyleCoord coord;
   {
     const nsCSSProperty* subprops =
       nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_width);
     NS_FOR_CSS_SIDES(side) {
       const nsCSSValue& value = *aRuleData->ValueFor(subprops[side]);
@@ -7526,21 +7526,21 @@ nsRuleNode::ComputeBorderData(void* aSta
                         aContext, mPresContext, conditions)) {
         border->mBorderRadius.Set(cx, coordX);
         border->mBorderRadius.Set(cy, coordY);
       }
     }
   }
 
   // float-edge: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForFloatEdge(),
-              border->mFloatEdge, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentBorder->mFloatEdge,
-              NS_STYLE_FLOAT_EDGE_CONTENT_BOX, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForFloatEdge(),
+           border->mFloatEdge, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentBorder->mFloatEdge,
+           NS_STYLE_FLOAT_EDGE_CONTENT_BOX, 0, 0, 0, 0);
 
   // border-image-source
   const nsCSSValue* borderImageSource = aRuleData->ValueForBorderImageSource();
   if (borderImageSource->GetUnit() == eCSSUnit_Inherit) {
     conditions.SetUncacheable();
     border->mBorderImageSource = parentBorder->mBorderImageSource;
   } else {
     SetStyleImage(aContext,
@@ -7550,22 +7550,22 @@ nsRuleNode::ComputeBorderData(void* aSta
   }
 
   nsCSSValue borderImageSliceValue;
   nsCSSValue borderImageSliceFill;
   SetBorderImageSlice(*aRuleData->ValueForBorderImageSlice(),
                       borderImageSliceValue, borderImageSliceFill);
 
   // border-image-slice: fill
-  SetDiscrete(borderImageSliceFill,
-              border->mBorderImageFill,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentBorder->mBorderImageFill,
-              NS_STYLE_BORDER_IMAGE_SLICE_NOFILL, 0, 0, 0, 0);
+  SetValue(borderImageSliceFill,
+           border->mBorderImageFill,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentBorder->mBorderImageFill,
+           NS_STYLE_BORDER_IMAGE_SLICE_NOFILL, 0, 0, 0, 0);
 
   nsCSSRect borderImageSlice;
   SetBorderImageRect(borderImageSliceValue, borderImageSlice);
 
   nsCSSRect borderImageWidth;
   SetBorderImageRect(*aRuleData->ValueForBorderImageWidth(),
                      borderImageWidth);
 
@@ -7605,29 +7605,29 @@ nsRuleNode::ComputeBorderData(void* aSta
     }
   }
 
   // border-image-repeat
   nsCSSValuePair borderImageRepeat;
   SetBorderImagePair(*aRuleData->ValueForBorderImageRepeat(),
                      borderImageRepeat);
 
-  SetDiscrete(borderImageRepeat.mXValue,
-              border->mBorderImageRepeatH,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentBorder->mBorderImageRepeatH,
-              NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH, 0, 0, 0, 0);
-
-  SetDiscrete(borderImageRepeat.mYValue,
-              border->mBorderImageRepeatV,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentBorder->mBorderImageRepeatV,
-              NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH, 0, 0, 0, 0);
+  SetValue(borderImageRepeat.mXValue,
+           border->mBorderImageRepeatH,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentBorder->mBorderImageRepeatH,
+           NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH, 0, 0, 0, 0);
+
+  SetValue(borderImageRepeat.mYValue,
+           border->mBorderImageRepeatV,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentBorder->mBorderImageRepeatV,
+           NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH, 0, 0, 0, 0);
 
   border->TrackImage(aContext->PresContext());
 
   COMPUTE_END_RESET(Border, border)
 }
 
 const void*
 nsRuleNode::ComputePaddingData(void* aStartStruct,
@@ -7744,17 +7744,17 @@ nsRuleNode::ComputeOutlineData(void* aSt
                         aContext, mPresContext, conditions)) {
         outline->mOutlineRadius.Set(cx, coordX);
         outline->mOutlineRadius.Set(cy, coordY);
       }
     }
   }
 
   // outline-style: enum, inherit, initial
-  // cannot use SetDiscrete because of SetOutlineStyle
+  // cannot use SetValue because of SetOutlineStyle
   const nsCSSValue* outlineStyleValue = aRuleData->ValueForOutlineStyle();
   nsCSSUnit unit = outlineStyleValue->GetUnit();
   MOZ_ASSERT(eCSSUnit_None != unit && eCSSUnit_Auto != unit,
              "'none' and 'auto' should be handled as enumerated values");
   if (eCSSUnit_Enumerated == unit) {
     outline->SetOutlineStyle(outlineStyleValue->GetIntValue());
   } else if (eCSSUnit_Initial == unit ||
              eCSSUnit_Unset == unit) {
@@ -7893,21 +7893,21 @@ nsRuleNode::ComputeListData(void* aStart
            eCSSUnit_Unset == imageValue->GetUnit()) {
     conditions.SetUncacheable();
     NS_SET_IMAGE_REQUEST(list->SetListStyleImage,
                          aContext,
                          parentList->GetListStyleImage())
   }
 
   // list-style-position: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForListStylePosition(),
-              list->mListStylePosition, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentList->mListStylePosition,
-              NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForListStylePosition(),
+           list->mListStylePosition, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentList->mListStylePosition,
+           NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, 0, 0, 0, 0);
 
   // image region property: length, auto, inherit
   const nsCSSValue* imageRegionValue = aRuleData->ValueForImageRegion();
   switch (imageRegionValue->GetUnit()) {
   case eCSSUnit_Inherit:
   case eCSSUnit_Unset:
     conditions.SetUncacheable();
     list->mImageRegion = parentList->mImageRegion;
@@ -8363,153 +8363,153 @@ nsRuleNode::ComputePositionData(void* aS
   SetCoord(maxHeight->GetUnit() == eCSSUnit_Enumerated && !vertical ?
              nsCSSValue(eCSSUnit_Unset) : *maxHeight,
            pos->mMaxHeight, parentPos->mMaxHeight,
            SETCOORD_LPOEH | SETCOORD_INITIAL_NONE | SETCOORD_STORE_CALC |
              SETCOORD_UNSET_INITIAL,
            aContext, mPresContext, conditions);
 
   // box-sizing: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBoxSizing(),
-              pos->mBoxSizing, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentPos->mBoxSizing,
-              StyleBoxSizing::Content,
-              StyleBoxSizing::Content /* ignored */,
-              StyleBoxSizing::Content /* ignored */,
-              StyleBoxSizing::Content /* ignored */,
-              StyleBoxSizing::Content /* ignored */);
+  SetValue(*aRuleData->ValueForBoxSizing(),
+           pos->mBoxSizing, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentPos->mBoxSizing,
+           StyleBoxSizing::Content,
+           StyleBoxSizing::Content /* ignored */,
+           StyleBoxSizing::Content /* ignored */,
+           StyleBoxSizing::Content /* ignored */,
+           StyleBoxSizing::Content /* ignored */);
 
   // align-content: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForAlignContent(),
-              pos->mAlignContent, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentPos->mAlignContent,
-              NS_STYLE_ALIGN_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForAlignContent(),
+           pos->mAlignContent, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentPos->mAlignContent,
+           NS_STYLE_ALIGN_NORMAL, 0, 0, 0, 0);
 
   // align-items: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForAlignItems(),
-              pos->mAlignItems, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentPos->mAlignItems,
-              NS_STYLE_ALIGN_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForAlignItems(),
+           pos->mAlignItems, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentPos->mAlignItems,
+           NS_STYLE_ALIGN_NORMAL, 0, 0, 0, 0);
 
   // align-self: enum, inherit, initial
   const auto& alignSelfValue = *aRuleData->ValueForAlignSelf();
   if (MOZ_UNLIKELY(alignSelfValue.GetUnit() == eCSSUnit_Inherit)) {
     if (MOZ_LIKELY(parentContext)) {
       nsStyleContext* grandparentContext = parentContext->GetParent();
       if (MOZ_LIKELY(grandparentContext)) {
         parentContext->AddStyleBit(NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE);
       }
       pos->mAlignSelf = parentPos->ComputedAlignSelf(grandparentContext);
     } else {
       pos->mAlignSelf = NS_STYLE_ALIGN_NORMAL;
     }
     conditions.SetUncacheable();
   } else {
-    SetDiscrete(alignSelfValue,
-                pos->mAlignSelf, conditions,
-                SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-                parentPos->mAlignSelf, // unused, we handle 'inherit' above
-                NS_STYLE_ALIGN_AUTO, 0, 0, 0, 0);
+    SetValue(alignSelfValue,
+             pos->mAlignSelf, conditions,
+             SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+             parentPos->mAlignSelf, // unused, we handle 'inherit' above
+             NS_STYLE_ALIGN_AUTO, 0, 0, 0, 0);
   }
 
   // justify-content: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForJustifyContent(),
-              pos->mJustifyContent, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentPos->mJustifyContent,
-              NS_STYLE_JUSTIFY_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForJustifyContent(),
+           pos->mJustifyContent, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentPos->mJustifyContent,
+           NS_STYLE_JUSTIFY_NORMAL, 0, 0, 0, 0);
 
   // justify-items: enum, inherit, initial
   const auto& justifyItemsValue = *aRuleData->ValueForJustifyItems();
   if (MOZ_UNLIKELY(justifyItemsValue.GetUnit() == eCSSUnit_Inherit)) {
     if (MOZ_LIKELY(parentContext)) {
       pos->mJustifyItems =
         parentPos->ComputedJustifyItems(parentContext->GetParent());
     } else {
       pos->mJustifyItems = NS_STYLE_JUSTIFY_NORMAL;
     }
     conditions.SetUncacheable();
   } else {
-    SetDiscrete(justifyItemsValue,
-                pos->mJustifyItems, conditions,
-                SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-                parentPos->mJustifyItems, // unused, we handle 'inherit' above
-                NS_STYLE_JUSTIFY_AUTO, 0, 0, 0, 0);
+    SetValue(justifyItemsValue,
+             pos->mJustifyItems, conditions,
+             SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+             parentPos->mJustifyItems, // unused, we handle 'inherit' above
+             NS_STYLE_JUSTIFY_AUTO, 0, 0, 0, 0);
   }
 
   // justify-self: enum, inherit, initial
   const auto& justifySelfValue = *aRuleData->ValueForJustifySelf();
   if (MOZ_UNLIKELY(justifySelfValue.GetUnit() == eCSSUnit_Inherit)) {
     if (MOZ_LIKELY(parentContext)) {
       nsStyleContext* grandparentContext = parentContext->GetParent();
       if (MOZ_LIKELY(grandparentContext)) {
         parentContext->AddStyleBit(NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE);
       }
       pos->mJustifySelf = parentPos->ComputedJustifySelf(grandparentContext);
     } else {
       pos->mJustifySelf = NS_STYLE_JUSTIFY_NORMAL;
     }
     conditions.SetUncacheable();
   } else {
-    SetDiscrete(justifySelfValue,
-                pos->mJustifySelf, conditions,
-                SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-                parentPos->mJustifySelf, // not used, we handle 'inherit' above
-                NS_STYLE_JUSTIFY_AUTO, 0, 0, 0, 0);
+    SetValue(justifySelfValue,
+             pos->mJustifySelf, conditions,
+             SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+             parentPos->mJustifySelf, // not used, we handle 'inherit' above
+             NS_STYLE_JUSTIFY_AUTO, 0, 0, 0, 0);
   }
 
   // flex-basis: auto, length, percent, enum, calc, inherit, initial
   // (Note: The flags here should match those used for 'width' property above.)
   SetCoord(*aRuleData->ValueForFlexBasis(), pos->mFlexBasis, parentPos->mFlexBasis,
            SETCOORD_LPAEH | SETCOORD_INITIAL_AUTO | SETCOORD_STORE_CALC |
              SETCOORD_UNSET_INITIAL,
            aContext, mPresContext, conditions);
 
   // flex-direction: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForFlexDirection(),
-              pos->mFlexDirection, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentPos->mFlexDirection,
-              NS_STYLE_FLEX_DIRECTION_ROW, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForFlexDirection(),
+           pos->mFlexDirection, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentPos->mFlexDirection,
+           NS_STYLE_FLEX_DIRECTION_ROW, 0, 0, 0, 0);
 
   // flex-grow: float, inherit, initial
   SetFactor(*aRuleData->ValueForFlexGrow(),
             pos->mFlexGrow, conditions,
             parentPos->mFlexGrow, 0.0f,
             SETFCT_UNSET_INITIAL);
 
   // flex-shrink: float, inherit, initial
   SetFactor(*aRuleData->ValueForFlexShrink(),
             pos->mFlexShrink, conditions,
             parentPos->mFlexShrink, 1.0f,
             SETFCT_UNSET_INITIAL);
 
   // flex-wrap: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForFlexWrap(),
-              pos->mFlexWrap, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentPos->mFlexWrap,
-              NS_STYLE_FLEX_WRAP_NOWRAP, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForFlexWrap(),
+           pos->mFlexWrap, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentPos->mFlexWrap,
+           NS_STYLE_FLEX_WRAP_NOWRAP, 0, 0, 0, 0);
 
   // order: integer, inherit, initial
-  SetDiscrete(*aRuleData->ValueForOrder(),
-              pos->mOrder, conditions,
-              SETDSC_INTEGER | SETDSC_UNSET_INITIAL,
-              parentPos->mOrder,
-              NS_STYLE_ORDER_INITIAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForOrder(),
+           pos->mOrder, conditions,
+           SETVAL_INTEGER | SETVAL_UNSET_INITIAL,
+           parentPos->mOrder,
+           NS_STYLE_ORDER_INITIAL, 0, 0, 0, 0);
 
   // object-fit: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForObjectFit(),
-              pos->mObjectFit, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentPos->mObjectFit,
-              NS_STYLE_OBJECT_FIT_FILL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForObjectFit(),
+           pos->mObjectFit, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentPos->mObjectFit,
+           NS_STYLE_OBJECT_FIT_FILL, 0, 0, 0, 0);
 
   // object-position
   const nsCSSValue& objectPosition = *aRuleData->ValueForObjectPosition();
   switch (objectPosition.GetUnit()) {
     case eCSSUnit_Null:
       break;
     case eCSSUnit_Inherit:
       conditions.SetUncacheable();
@@ -8642,21 +8642,21 @@ nsRuleNode::ComputeTableData(void* aStar
                              nsStyleContext* aContext,
                              nsRuleNode* aHighestNode,
                              const RuleDetail aRuleDetail,
                              const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Table, table, parentTable)
 
   // table-layout: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTableLayout(),
-              table->mLayoutStrategy, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentTable->mLayoutStrategy,
-              NS_STYLE_TABLE_LAYOUT_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTableLayout(),
+           table->mLayoutStrategy, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentTable->mLayoutStrategy,
+           NS_STYLE_TABLE_LAYOUT_AUTO, 0, 0, 0, 0);
 
   // span: pixels (not a real CSS prop)
   const nsCSSValue* spanValue = aRuleData->ValueForSpan();
   if (eCSSUnit_Enumerated == spanValue->GetUnit() ||
       eCSSUnit_Integer == spanValue->GetUnit())
     table->mSpan = spanValue->GetIntValue();
 
   COMPUTE_END_RESET(Table, table)
@@ -8668,21 +8668,21 @@ nsRuleNode::ComputeTableBorderData(void*
                                    nsStyleContext* aContext,
                                    nsRuleNode* aHighestNode,
                                    const RuleDetail aRuleDetail,
                                    const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(TableBorder, table, parentTable)
 
   // border-collapse: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBorderCollapse(), table->mBorderCollapse,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentTable->mBorderCollapse,
-              NS_STYLE_BORDER_SEPARATE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBorderCollapse(), table->mBorderCollapse,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentTable->mBorderCollapse,
+           NS_STYLE_BORDER_SEPARATE, 0, 0, 0, 0);
 
   const nsCSSValue* borderSpacingValue = aRuleData->ValueForBorderSpacing();
   // border-spacing: pair(length), inherit
   if (borderSpacingValue->GetUnit() != eCSSUnit_Null) {
     nsStyleCoord parentCol(parentTable->mBorderSpacingCol,
                            nsStyleCoord::CoordConstructor);
     nsStyleCoord parentRow(parentTable->mBorderSpacingRow,
                            nsStyleCoord::CoordConstructor);
@@ -8698,29 +8698,29 @@ nsRuleNode::ComputeTableBorderData(void*
                       SETCOORD_CALC_CLAMP_NONNEGATIVE | SETCOORD_UNSET_INHERIT,
                     aContext, mPresContext, conditions);
     NS_ASSERTION(result, "malformed table border value");
     table->mBorderSpacingCol = coordCol.GetCoordValue();
     table->mBorderSpacingRow = coordRow.GetCoordValue();
   }
 
   // caption-side: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForCaptionSide(),
-              table->mCaptionSide, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentTable->mCaptionSide,
-              NS_STYLE_CAPTION_SIDE_TOP, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForCaptionSide(),
+           table->mCaptionSide, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentTable->mCaptionSide,
+           NS_STYLE_CAPTION_SIDE_TOP, 0, 0, 0, 0);
 
   // empty-cells: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForEmptyCells(),
-              table->mEmptyCells, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentTable->mEmptyCells,
-              NS_STYLE_TABLE_EMPTY_CELLS_SHOW,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForEmptyCells(),
+           table->mEmptyCells, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentTable->mEmptyCells,
+           NS_STYLE_TABLE_EMPTY_CELLS_SHOW,
+           0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(TableBorder, table)
 }
 
 const void*
 nsRuleNode::ComputeContentData(void* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
@@ -8966,55 +8966,55 @@ nsRuleNode::ComputeXULData(void* aStartS
                            nsStyleContext* aContext,
                            nsRuleNode* aHighestNode,
                            const RuleDetail aRuleDetail,
                            const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(XUL, xul, parentXUL)
 
   // box-align: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBoxAlign(),
-              xul->mBoxAlign, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentXUL->mBoxAlign,
-              NS_STYLE_BOX_ALIGN_STRETCH, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBoxAlign(),
+           xul->mBoxAlign, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentXUL->mBoxAlign,
+           NS_STYLE_BOX_ALIGN_STRETCH, 0, 0, 0, 0);
 
   // box-direction: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBoxDirection(),
-              xul->mBoxDirection, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentXUL->mBoxDirection,
-              NS_STYLE_BOX_DIRECTION_NORMAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBoxDirection(),
+           xul->mBoxDirection, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentXUL->mBoxDirection,
+           NS_STYLE_BOX_DIRECTION_NORMAL, 0, 0, 0, 0);
 
   // box-flex: factor, inherit
   SetFactor(*aRuleData->ValueForBoxFlex(),
             xul->mBoxFlex, conditions,
             parentXUL->mBoxFlex, 0.0f,
             SETFCT_UNSET_INITIAL);
 
   // box-orient: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBoxOrient(),
-              xul->mBoxOrient, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentXUL->mBoxOrient,
-              NS_STYLE_BOX_ORIENT_HORIZONTAL, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBoxOrient(),
+           xul->mBoxOrient, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentXUL->mBoxOrient,
+           NS_STYLE_BOX_ORIENT_HORIZONTAL, 0, 0, 0, 0);
 
   // box-pack: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBoxPack(),
-              xul->mBoxPack, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentXUL->mBoxPack,
-              NS_STYLE_BOX_PACK_START, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBoxPack(),
+           xul->mBoxPack, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentXUL->mBoxPack,
+           NS_STYLE_BOX_PACK_START, 0, 0, 0, 0);
 
   // box-ordinal-group: integer, inherit, initial
-  SetDiscrete(*aRuleData->ValueForBoxOrdinalGroup(),
-              xul->mBoxOrdinal, conditions,
-              SETDSC_INTEGER | SETDSC_UNSET_INITIAL,
-              parentXUL->mBoxOrdinal, 1,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForBoxOrdinalGroup(),
+           xul->mBoxOrdinal, conditions,
+           SETVAL_INTEGER | SETVAL_UNSET_INITIAL,
+           parentXUL->mBoxOrdinal, 1,
+           0, 0, 0, 0);
 
   const nsCSSValue* stackSizingValue = aRuleData->ValueForStackSizing();
   if (eCSSUnit_Inherit == stackSizingValue->GetUnit()) {
     conditions.SetUncacheable();
     xul->mStretchStack = parentXUL->mStretchStack;
   } else if (eCSSUnit_Initial == stackSizingValue->GetUnit() ||
              eCSSUnit_Unset == stackSizingValue->GetUnit()) {
     xul->mStretchStack = true;
@@ -9143,22 +9143,22 @@ nsRuleNode::ComputeColumnData(void* aSta
     column->mColumnRuleColorIsForeground = true;
   }
   else if (SetColor(colorValue, 0, mPresContext, aContext,
                     column->mColumnRuleColor, conditions)) {
     column->mColumnRuleColorIsForeground = false;
   }
 
   // column-fill: enum
-  SetDiscrete(*aRuleData->ValueForColumnFill(),
-                column->mColumnFill, conditions,
-                SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-                parent->mColumnFill,
-                NS_STYLE_COLUMN_FILL_BALANCE,
-                0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForColumnFill(),
+           column->mColumnFill, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parent->mColumnFill,
+           NS_STYLE_COLUMN_FILL_BALANCE,
+           0, 0, 0, 0);
 
   COMPUTE_END_RESET(Column, column)
 }
 
 static void
 SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint,
             nsPresContext* aPresContext, nsStyleContext *aContext,
             nsStyleSVGPaint& aResult, nsStyleSVGPaintType aInitialPaintType,
@@ -9255,55 +9255,55 @@ nsRuleNode::ComputeSVGData(void* aStartS
                            nsStyleContext* aContext,
                            nsRuleNode* aHighestNode,
                            const RuleDetail aRuleDetail,
                            const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(SVG, svg, parentSVG)
 
   // clip-rule: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForClipRule(),
-              svg->mClipRule, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mClipRule,
-              NS_STYLE_FILL_RULE_NONZERO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForClipRule(),
+           svg->mClipRule, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mClipRule,
+           NS_STYLE_FILL_RULE_NONZERO, 0, 0, 0, 0);
 
   // color-interpolation: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForColorInterpolation(),
-              svg->mColorInterpolation, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mColorInterpolation,
-              NS_STYLE_COLOR_INTERPOLATION_SRGB, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForColorInterpolation(),
+           svg->mColorInterpolation, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mColorInterpolation,
+           NS_STYLE_COLOR_INTERPOLATION_SRGB, 0, 0, 0, 0);
 
   // color-interpolation-filters: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForColorInterpolationFilters(),
-              svg->mColorInterpolationFilters, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mColorInterpolationFilters,
-              NS_STYLE_COLOR_INTERPOLATION_LINEARRGB, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForColorInterpolationFilters(),
+           svg->mColorInterpolationFilters, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mColorInterpolationFilters,
+           NS_STYLE_COLOR_INTERPOLATION_LINEARRGB, 0, 0, 0, 0);
 
   // fill:
   SetSVGPaint(*aRuleData->ValueForFill(),
               parentSVG->mFill, mPresContext, aContext,
               svg->mFill, eStyleSVGPaintType_Color, conditions);
 
   // fill-opacity: factor, inherit, initial,
   // context-fill-opacity, context-stroke-opacity
   nsStyleSVGOpacitySource contextFillOpacity = svg->mFillOpacitySource;
   SetSVGOpacity(*aRuleData->ValueForFillOpacity(),
                 svg->mFillOpacity, contextFillOpacity, conditions,
                 parentSVG->mFillOpacity, parentSVG->mFillOpacitySource);
   svg->mFillOpacitySource = contextFillOpacity;
 
   // fill-rule: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForFillRule(),
-              svg->mFillRule, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mFillRule,
-              NS_STYLE_FILL_RULE_NONZERO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForFillRule(),
+           svg->mFillRule, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mFillRule,
+           NS_STYLE_FILL_RULE_NONZERO, 0, 0, 0, 0);
 
   // marker-end: url, none, inherit
   const nsCSSValue* markerEndValue = aRuleData->ValueForMarkerEnd();
   if (eCSSUnit_URL == markerEndValue->GetUnit()) {
     svg->mMarkerEnd = markerEndValue->GetURLValue();
   } else if (eCSSUnit_None == markerEndValue->GetUnit() ||
              eCSSUnit_Initial == markerEndValue->GetUnit()) {
     svg->mMarkerEnd = nullptr;
@@ -9362,21 +9362,21 @@ nsRuleNode::ComputeSVGData(void* aStartS
       svg->mPaintOrder = NS_STYLE_PAINT_ORDER_NORMAL;
       break;
 
     default:
       NS_NOTREACHED("unexpected unit");
   }
 
   // shape-rendering: enum, inherit
-  SetDiscrete(*aRuleData->ValueForShapeRendering(),
-              svg->mShapeRendering, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mShapeRendering,
-              NS_STYLE_SHAPE_RENDERING_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForShapeRendering(),
+           svg->mShapeRendering, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mShapeRendering,
+           NS_STYLE_SHAPE_RENDERING_AUTO, 0, 0, 0, 0);
 
   // stroke:
   SetSVGPaint(*aRuleData->ValueForStroke(),
               parentSVG->mStroke, mPresContext, aContext,
               svg->mStroke, eStyleSVGPaintType_None, conditions);
 
   // stroke-dasharray: <dasharray>, none, inherit, context-value
   const nsCSSValue* strokeDasharrayValue = aRuleData->ValueForStrokeDasharray();
@@ -9445,28 +9445,28 @@ nsRuleNode::ComputeSVGData(void* aStartS
     SetCoord(*aRuleData->ValueForStrokeDashoffset(),
              svg->mStrokeDashoffset, parentSVG->mStrokeDashoffset,
              SETCOORD_LPH | SETCOORD_FACTOR | SETCOORD_INITIAL_ZERO |
                SETCOORD_UNSET_INHERIT,
              aContext, mPresContext, conditions);
   }
 
   // stroke-linecap: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForStrokeLinecap(),
-              svg->mStrokeLinecap, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mStrokeLinecap,
-              NS_STYLE_STROKE_LINECAP_BUTT, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForStrokeLinecap(),
+           svg->mStrokeLinecap, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mStrokeLinecap,
+           NS_STYLE_STROKE_LINECAP_BUTT, 0, 0, 0, 0);
 
   // stroke-linejoin: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForStrokeLinejoin(),
-              svg->mStrokeLinejoin, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mStrokeLinejoin,
-              NS_STYLE_STROKE_LINEJOIN_MITER, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForStrokeLinejoin(),
+           svg->mStrokeLinejoin, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mStrokeLinejoin,
+           NS_STYLE_STROKE_LINEJOIN_MITER, 0, 0, 0, 0);
 
   // stroke-miterlimit: <miterlimit>, inherit
   SetFactor(*aRuleData->ValueForStrokeMiterlimit(),
             svg->mStrokeMiterlimit,
             conditions,
             parentSVG->mStrokeMiterlimit, 4.0f,
             SETFCT_UNSET_INHERIT);
 
@@ -9497,21 +9497,21 @@ nsRuleNode::ComputeSVGData(void* aStartS
     svg->mStrokeWidthFromObject = false;
     SetCoord(*strokeWidthValue,
              svg->mStrokeWidth, parentSVG->mStrokeWidth,
              SETCOORD_LPH | SETCOORD_FACTOR | SETCOORD_UNSET_INHERIT,
              aContext, mPresContext, conditions);
   }
 
   // text-anchor: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForTextAnchor(),
-              svg->mTextAnchor, conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
-              parentSVG->mTextAnchor,
-              NS_STYLE_TEXT_ANCHOR_START, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForTextAnchor(),
+           svg->mTextAnchor, conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
+           parentSVG->mTextAnchor,
+           NS_STYLE_TEXT_ANCHOR_START, 0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(SVG, svg)
 }
 
 already_AddRefed<nsStyleBasicShape>
 nsRuleNode::GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
                                            nsStyleContext* aStyleContext,
                                            nsPresContext* aPresContext,
@@ -9844,38 +9844,38 @@ nsRuleNode::ComputeSVGResetData(void* aS
 
   // flood-opacity:
   SetFactor(*aRuleData->ValueForFloodOpacity(),
             svgReset->mFloodOpacity, conditions,
             parentSVGReset->mFloodOpacity, 1.0f,
             SETFCT_OPACITY | SETFCT_UNSET_INITIAL);
 
   // dominant-baseline: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForDominantBaseline(),
-              svgReset->mDominantBaseline,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentSVGReset->mDominantBaseline,
-              NS_STYLE_DOMINANT_BASELINE_AUTO, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForDominantBaseline(),
+           svgReset->mDominantBaseline,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentSVGReset->mDominantBaseline,
+           NS_STYLE_DOMINANT_BASELINE_AUTO, 0, 0, 0, 0);
 
   // vector-effect: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForVectorEffect(),
-              svgReset->mVectorEffect,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentSVGReset->mVectorEffect,
-              NS_STYLE_VECTOR_EFFECT_NONE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForVectorEffect(),
+           svgReset->mVectorEffect,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentSVGReset->mVectorEffect,
+           NS_STYLE_VECTOR_EFFECT_NONE, 0, 0, 0, 0);
 
   // mask-type: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForMaskType(),
-              svgReset->mMaskType,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentSVGReset->mMaskType,
-              NS_STYLE_MASK_TYPE_LUMINANCE, 0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForMaskType(),
+           svgReset->mMaskType,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentSVGReset->mMaskType,
+           NS_STYLE_MASK_TYPE_LUMINANCE, 0, 0, 0, 0);
 
 #ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
   uint32_t maxItemCount = 1;
   bool rebuild = false;
 
   // mask-image: none | <url> | <image-list> | <element-reference>  | <gradient>
   nsStyleImage initialImage;
   SetImageLayerList(aContext, *aRuleData->ValueForMaskImage(),
@@ -10205,21 +10205,21 @@ nsRuleNode::ComputeEffectsData(void* aSt
   }
 
   // opacity: factor, inherit, initial
   SetFactor(*aRuleData->ValueForOpacity(), effects->mOpacity, conditions,
             parentEffects->mOpacity, 1.0f,
             SETFCT_OPACITY | SETFCT_UNSET_INITIAL);
 
   // mix-blend-mode: enum, inherit, initial
-  SetDiscrete(*aRuleData->ValueForMixBlendMode(), effects->mMixBlendMode,
-              conditions,
-              SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
-              parentEffects->mMixBlendMode, NS_STYLE_BLEND_NORMAL,
-              0, 0, 0, 0);
+  SetValue(*aRuleData->ValueForMixBlendMode(), effects->mMixBlendMode,
+           conditions,
+           SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
+           parentEffects->mMixBlendMode, NS_STYLE_BLEND_NORMAL,
+           0, 0, 0, 0);
 
   COMPUTE_END_RESET(Effects, effects)
 }
 
 const void*
 nsRuleNode::GetStyleData(nsStyleStructID aSID,
                          nsStyleContext* aContext,
                          bool aComputeData)