Bug 1552628 - Remove some more dead nsCSSValue code. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 19 May 2019 00:47:18 +0000
changeset 533280 d7a7edbebd6a08f22d78b5c86b2f2d4573eb77dd
parent 533279 14743da36853e6b1d745418e128030b89bbb6fe2
child 533281 cff3c3d2b3c51ac4b473747b5a660283ade55490
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1552628
milestone68.0a1
first release with
nightly linux32
d7a7edbebd6a / 68.0a1 / 20190519092846 / files
nightly linux64
d7a7edbebd6a / 68.0a1 / 20190519092846 / files
nightly mac
d7a7edbebd6a / 68.0a1 / 20190519092846 / files
nightly win32
d7a7edbebd6a / 68.0a1 / 20190519092846 / files
nightly win64
d7a7edbebd6a / 68.0a1 / 20190519092846 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1552628 - Remove some more dead nsCSSValue code. r=xidorn Most of it is not used at this point, this leaves the parts that are used by MathML, which are minimal. Differential Revision: https://phabricator.services.mozilla.com/D31706
layout/base/nsLayoutUtils.h
layout/style/CounterStyleManager.cpp
layout/style/CounterStyleManager.h
layout/style/FontFaceSet.cpp
layout/style/ServoCSSParser.h
layout/style/nsCSSValue.cpp
layout/style/nsCSSValue.h
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -3016,23 +3016,16 @@ class nsLayoutUtils {
   static already_AddRefed<nsFontMetrics> GetMetricsFor(
       nsPresContext* aPresContext, bool aIsVertical,
       const nsStyleFont* aStyleFont, nscoord aFontSize, bool aUseUserFontSet);
 
   static void ComputeSystemFont(nsFont* aSystemFont,
                                 mozilla::LookAndFeel::FontID aFontID,
                                 const nsFont* aDefaultVariableFont);
 
-  static void ComputeFontFeatures(const nsCSSValuePairList* aFeaturesList,
-                                  nsTArray<gfxFontFeature>& aFeatureSettings);
-
-  static void ComputeFontVariations(
-      const nsCSSValuePairList* aVariationsList,
-      nsTArray<gfxFontVariation>& aVariationSettings);
-
   static uint32_t ParseFontLanguageOverride(const nsAString& aLangTag);
 
   /**
    * Returns true if there are any preferences or overrides that indicate a
    * need to handle <meta name="viewport"> tags.
    */
   static bool ShouldHandleMetaViewport(const mozilla::dom::Document*);
 
--- a/layout/style/CounterStyleManager.cpp
+++ b/layout/style/CounterStyleManager.cpp
@@ -1162,21 +1162,16 @@ void CustomCounterStyle::GetNegative(Neg
         mNegative.before.AssignLiteral(u"-");
         mNegative.after.Truncate();
       }
     }
   }
   aResult = mNegative;
 }
 
-static inline bool IsRangeValueInfinite(const nsCSSValue& aValue) {
-  return aValue.GetUnit() == eCSSUnit_Enumerated &&
-         aValue.GetIntValue() == NS_STYLE_COUNTER_RANGE_INFINITE;
-}
-
 /* virtual */
 bool CustomCounterStyle::IsOrdinalInRange(CounterValue aOrdinal) {
   auto inRange = Servo_CounterStyleRule_IsInRange(mRule, aOrdinal);
   switch (inRange) {
     case StyleIsOrdinalInRange::InRange:
       return true;
     case StyleIsOrdinalInRange::NotInRange:
       return false;
@@ -1510,31 +1505,16 @@ CounterStyle* CustomCounterStyle::GetExt
 AnonymousCounterStyle::AnonymousCounterStyle(const nsAString& aContent)
     : CounterStyle(NS_STYLE_LIST_STYLE_CUSTOM),
       mSingleString(true),
       mSystem(NS_STYLE_COUNTER_SYSTEM_CYCLIC) {
   mSymbols.SetCapacity(1);
   mSymbols.AppendElement(aContent);
 }
 
-static nsTArray<nsString> CollectSymbolsFromCSSValueList(
-    const nsCSSValueList* aList) {
-  nsTArray<nsString> symbols;
-  for (const nsCSSValueList* item = aList; item; item = item->mNext) {
-    item->mValue.GetStringValue(*symbols.AppendElement());
-  }
-  symbols.Compact();
-  return symbols;
-}
-
-AnonymousCounterStyle::AnonymousCounterStyle(const nsCSSValue::Array* aParams)
-    : AnonymousCounterStyle(
-          aParams->Item(0).GetIntValue(),
-          CollectSymbolsFromCSSValueList(aParams->Item(1).GetListValue())) {}
-
 AnonymousCounterStyle::AnonymousCounterStyle(uint8_t aSystem,
                                              nsTArray<nsString> aSymbols)
     : CounterStyle(NS_STYLE_LIST_STYLE_CUSTOM),
       mSingleString(false),
       mSystem(aSystem),
       mSymbols(std::move(aSymbols)) {}
 
 /* virtual */
--- a/layout/style/CounterStyleManager.h
+++ b/layout/style/CounterStyleManager.h
@@ -11,18 +11,16 @@
 #include "nsStringFwd.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 
 #include "nsStyleConsts.h"
 
 #include "mozilla/Attributes.h"
 
-#include "nsCSSValue.h"
-
 class nsPresContext;
 
 namespace mozilla {
 
 class WritingMode;
 
 typedef int32_t CounterValue;
 
@@ -91,17 +89,16 @@ class CounterStyle {
  protected:
   const int32_t mStyle;
 };
 
 class AnonymousCounterStyle final : public CounterStyle {
  public:
   explicit AnonymousCounterStyle(const nsAString& aContent);
   AnonymousCounterStyle(uint8_t aSystem, nsTArray<nsString> aSymbols);
-  explicit AnonymousCounterStyle(const nsCSSValue::Array* aValue);
 
   virtual void GetPrefix(nsAString& aResult) override;
   virtual void GetSuffix(nsAString& aResult) override;
   virtual bool IsBullet() override;
 
   virtual void GetNegative(NegativeType& aResult) override;
   virtual bool IsOrdinalInRange(CounterValue aOrdinal) override;
   virtual bool IsOrdinalInAutoRange(CounterValue aOrdinal) override;
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -207,18 +207,16 @@ void FontFaceSet::RemoveDOMContentLoaded
 void FontFaceSet::ParseFontShorthandForMatching(
     const nsAString& aFont, RefPtr<SharedFontList>& aFamilyList,
     FontWeight& aWeight, FontStretch& aStretch, FontSlantStyle& aStyle,
     ErrorResult& aRv) {
   StyleComputedFontStyleDescriptor style;
   float stretch;
   float weight;
 
-  // FIXME(emilio): This Servo -> nsCSSValue -> Gecko conversion is stupid,
-  // Servo understands the font types.
   RefPtr<URLExtraData> url = ServoCSSParser::GetURLExtraData(mDocument);
   if (!ServoCSSParser::ParseFontShorthandForMatching(aFont, url, aFamilyList,
                                                      style, stretch, weight)) {
     aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     return;
   }
 
   switch (style.tag) {
--- a/layout/style/ServoCSSParser.h
+++ b/layout/style/ServoCSSParser.h
@@ -13,17 +13,16 @@
 #include "mozilla/RefPtr.h"
 #include "mozilla/ServoStyleConsts.h"
 #include "mozilla/ServoTypes.h"
 #include "nsColor.h"
 #include "nsCSSPropertyID.h"
 #include "nsDOMCSSDeclaration.h"
 #include "nsStringFwd.h"
 
-class nsCSSValue;
 struct nsCSSRect;
 struct nsTimingFunction;
 struct RawServoDeclarationBlock;
 
 namespace mozilla {
 
 class ServoStyleSet;
 class SharedFontList;
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -50,70 +50,30 @@ nsCSSValue::nsCSSValue(float aValue, nsC
     mValue.mFloat = aValue;
     MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
   } else {
     mUnit = eCSSUnit_Null;
     mValue.mInt = 0;
   }
 }
 
-nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit) : mUnit(aUnit) {
-  MOZ_ASSERT(UnitHasStringValue(), "not a string value");
-  if (UnitHasStringValue()) {
-    mValue.mString = BufferFromString(aValue).take();
-  } else {
-    mUnit = eCSSUnit_Null;
-    mValue.mInt = 0;
-  }
-}
-
-nsCSSValue::nsCSSValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
-    : mUnit(aUnit) {
-  MOZ_ASSERT(UnitHasArrayValue(), "bad unit");
-  mValue.mArray = aValue;
-  mValue.mArray->AddRef();
-}
-
 nsCSSValue::nsCSSValue(const nsCSSValue& aCopy) : mUnit(aCopy.mUnit) {
-  if (mUnit <= eCSSUnit_DummyInherit) {
-    // nothing to do, but put this important case first
-  } else if (eCSSUnit_Percent <= mUnit) {
+  if (eCSSUnit_Percent <= mUnit) {
     mValue.mFloat = aCopy.mValue.mFloat;
     MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
-  } else if (UnitHasStringValue()) {
-    mValue.mString = aCopy.mValue.mString;
-    mValue.mString->AddRef();
   } else if (eCSSUnit_Integer <= mUnit && mUnit <= eCSSUnit_Enumerated) {
     mValue.mInt = aCopy.mValue.mInt;
-  } else if (UnitHasArrayValue()) {
-    mValue.mArray = aCopy.mValue.mArray;
-    mValue.mArray->AddRef();
-  } else if (eCSSUnit_Pair == mUnit) {
-    mValue.mPair = aCopy.mValue.mPair;
-    mValue.mPair->AddRef();
-  } else if (eCSSUnit_List == mUnit) {
-    mValue.mList = aCopy.mValue.mList;
-    mValue.mList->AddRef();
-  } else if (eCSSUnit_SharedList == mUnit) {
-    mValue.mSharedList = aCopy.mValue.mSharedList;
-    mValue.mSharedList->AddRef();
-  } else if (eCSSUnit_PairList == mUnit) {
-    mValue.mPairList = aCopy.mValue.mPairList;
-    mValue.mPairList->AddRef();
-  } else if (eCSSUnit_AtomIdent == mUnit) {
-    mValue.mAtom = aCopy.mValue.mAtom;
-    mValue.mAtom->AddRef();
   } else {
-    MOZ_ASSERT(false, "unknown unit");
+    MOZ_ASSERT_UNREACHABLE("unknown unit");
   }
 }
 
 nsCSSValue& nsCSSValue::operator=(const nsCSSValue& aCopy) {
   if (this != &aCopy) {
-    Reset();
+    this->~nsCSSValue();
     new (this) nsCSSValue(aCopy);
   }
   return *this;
 }
 
 nsCSSValue& nsCSSValue::operator=(nsCSSValue&& aOther) {
   MOZ_ASSERT(this != &aOther, "Self assigment with rvalue reference");
 
@@ -121,42 +81,23 @@ nsCSSValue& nsCSSValue::operator=(nsCSSV
   mUnit = aOther.mUnit;
   mValue = aOther.mValue;
   aOther.mUnit = eCSSUnit_Null;
 
   return *this;
 }
 
 bool nsCSSValue::operator==(const nsCSSValue& aOther) const {
-  if (mUnit == aOther.mUnit) {
-    if (mUnit <= eCSSUnit_DummyInherit) {
-      return true;
-    } else if (UnitHasStringValue()) {
-      return (NS_strcmp(GetBufferValue(mValue.mString),
-                        GetBufferValue(aOther.mValue.mString)) == 0);
-    } else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
-      return mValue.mInt == aOther.mValue.mInt;
-    } else if (UnitHasArrayValue()) {
-      return *mValue.mArray == *aOther.mValue.mArray;
-    } else if (eCSSUnit_Pair == mUnit) {
-      return *mValue.mPair == *aOther.mValue.mPair;
-    } else if (eCSSUnit_List == mUnit) {
-      return nsCSSValueList::Equal(mValue.mList, aOther.mValue.mList);
-    } else if (eCSSUnit_SharedList == mUnit) {
-      return *mValue.mSharedList == *aOther.mValue.mSharedList;
-    } else if (eCSSUnit_PairList == mUnit) {
-      return nsCSSValuePairList::Equal(mValue.mPairList,
-                                       aOther.mValue.mPairList);
-    } else if (eCSSUnit_AtomIdent == mUnit) {
-      return mValue.mAtom == aOther.mValue.mAtom;
-    } else {
-      return mValue.mFloat == aOther.mValue.mFloat;
-    }
+  if (mUnit != aOther.mUnit) {
+    return false;
   }
-  return false;
+  if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
+    return mValue.mInt == aOther.mValue.mInt;
+  }
+  return mValue.mFloat == aOther.mValue.mFloat;
 }
 
 double nsCSSValue::GetAngleValueInDegrees() const {
   // Note that this extends the value from float to double.
   return GetAngleValue();
 }
 
 double nsCSSValue::GetAngleValueInRadians() const {
@@ -190,49 +131,16 @@ nscoord nsCSSValue::GetPixelLength() con
       break;
     default:
       NS_ERROR("should never get here");
       return 0;
   }
   return nsPresContext::CSSPixelsToAppUnits(float(mValue.mFloat * scaleFactor));
 }
 
-// Assert against resetting non-trivial CSS values from the parallel Servo
-// traversal, since the refcounts aren't thread-safe.
-// Note that the caller might be an OMTA thread, which is allowed to operate off
-// main thread because it owns all of the corresponding nsCSSValues and any that
-// they might be sharing members with. Since this can happen concurrently with
-// the servo traversal, we have to use a more-precise (but slower) test.
-#define DO_RELEASE(member)                                         \
-  {                                                                \
-    MOZ_ASSERT(!ServoStyleSet::IsCurrentThreadInServoTraversal()); \
-    mValue.member->Release();                                      \
-  }
-
-void nsCSSValue::DoReset() {
-  if (UnitHasStringValue()) {
-    mValue.mString->Release();
-  } else if (UnitHasArrayValue()) {
-    DO_RELEASE(mArray);
-  } else if (eCSSUnit_Pair == mUnit) {
-    DO_RELEASE(mPair);
-  } else if (eCSSUnit_List == mUnit) {
-    DO_RELEASE(mList);
-  } else if (eCSSUnit_SharedList == mUnit) {
-    DO_RELEASE(mSharedList);
-  } else if (eCSSUnit_PairList == mUnit) {
-    DO_RELEASE(mPairList);
-  } else if (eCSSUnit_AtomIdent == mUnit) {
-    DO_RELEASE(mAtom);
-  }
-  mUnit = eCSSUnit_Null;
-}
-
-#undef DO_RELEASE
-
 void nsCSSValue::SetIntValue(int32_t aValue, nsCSSUnit aUnit) {
   MOZ_ASSERT(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated,
              "not an int value");
   Reset();
   if (aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated) {
     mUnit = aUnit;
     mValue.mInt = aValue;
   }
@@ -250,467 +158,16 @@ void nsCSSValue::SetFloatValue(float aVa
   Reset();
   if (IsFloatUnit(aUnit)) {
     mUnit = aUnit;
     mValue.mFloat = aValue;
     MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
   }
 }
 
-void nsCSSValue::SetStringValue(const nsString& aValue, nsCSSUnit aUnit) {
-  Reset();
-  mUnit = aUnit;
-  MOZ_ASSERT(UnitHasStringValue(), "not a string unit");
-  if (UnitHasStringValue()) {
-    mValue.mString = BufferFromString(aValue).take();
-  } else
-    mUnit = eCSSUnit_Null;
-}
-
-void nsCSSValue::SetAtomIdentValue(already_AddRefed<nsAtom> aValue) {
-  Reset();
-  mUnit = eCSSUnit_AtomIdent;
-  mValue.mAtom = aValue.take();
-}
-
-void nsCSSValue::SetIntegerCoordValue(nscoord aValue) {
-  SetFloatValue(nsPresContext::AppUnitsToFloatCSSPixels(aValue),
-                eCSSUnit_Pixel);
-}
-
-void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit) {
-  Reset();
-  mUnit = aUnit;
-  MOZ_ASSERT(UnitHasArrayValue(), "bad unit");
-  mValue.mArray = aValue;
-  mValue.mArray->AddRef();
-}
-
-void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue) {
-  // pairs should not be used for null/inherit/initial values
-  MOZ_ASSERT(aValue && aValue->mXValue.GetUnit() != eCSSUnit_Null &&
-                 aValue->mYValue.GetUnit() != eCSSUnit_Null &&
-                 aValue->mXValue.GetUnit() != eCSSUnit_Inherit &&
-                 aValue->mYValue.GetUnit() != eCSSUnit_Inherit &&
-                 aValue->mXValue.GetUnit() != eCSSUnit_Initial &&
-                 aValue->mYValue.GetUnit() != eCSSUnit_Initial &&
-                 aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
-                 aValue->mYValue.GetUnit() != eCSSUnit_Unset,
-             "missing or inappropriate pair value");
-  Reset();
-  mUnit = eCSSUnit_Pair;
-  mValue.mPair = new nsCSSValuePair_heap(aValue->mXValue, aValue->mYValue);
-  mValue.mPair->AddRef();
-}
-
-void nsCSSValue::SetPairValue(const nsCSSValue& xValue,
-                              const nsCSSValue& yValue) {
-  MOZ_ASSERT(xValue.GetUnit() != eCSSUnit_Null &&
-                 yValue.GetUnit() != eCSSUnit_Null &&
-                 xValue.GetUnit() != eCSSUnit_Inherit &&
-                 yValue.GetUnit() != eCSSUnit_Inherit &&
-                 xValue.GetUnit() != eCSSUnit_Initial &&
-                 yValue.GetUnit() != eCSSUnit_Initial &&
-                 xValue.GetUnit() != eCSSUnit_Unset &&
-                 yValue.GetUnit() != eCSSUnit_Unset,
-             "inappropriate pair value");
-  Reset();
-  mUnit = eCSSUnit_Pair;
-  mValue.mPair = new nsCSSValuePair_heap(xValue, yValue);
-  mValue.mPair->AddRef();
-}
-
-nsCSSValueList* nsCSSValue::SetListValue() {
-  Reset();
-  mUnit = eCSSUnit_List;
-  mValue.mList = new nsCSSValueList_heap;
-  mValue.mList->AddRef();
-  return mValue.mList;
-}
-
-void nsCSSValue::SetSharedListValue(nsCSSValueSharedList* aList) {
-  Reset();
-  mUnit = eCSSUnit_SharedList;
-  mValue.mSharedList = aList;
-  mValue.mSharedList->AddRef();
-}
-
-nsCSSValuePairList* nsCSSValue::SetPairListValue() {
-  Reset();
-  mUnit = eCSSUnit_PairList;
-  mValue.mPairList = new nsCSSValuePairList_heap;
-  mValue.mPairList->AddRef();
-  return mValue.mPairList;
-}
-
-void nsCSSValue::SetNoneValue() {
-  Reset();
-  mUnit = eCSSUnit_None;
-}
-
-void nsCSSValue::SetCalcValue(const nsStyleCoord::CalcValue& aCalc) {
-  RefPtr<nsCSSValue::Array> arr = nsCSSValue::Array::Create(1);
-  if (!aCalc.mHasPercent) {
-    arr->Item(0).SetIntegerCoordValue(aCalc.mLength);
-  } else {
-    nsCSSValue::Array* arr2 = nsCSSValue::Array::Create(2);
-    arr->Item(0).SetArrayValue(arr2, eCSSUnit_Calc_Plus);
-    arr2->Item(0).SetIntegerCoordValue(aCalc.mLength);
-    arr2->Item(1).SetPercentValue(aCalc.mPercent);
-  }
-
-  SetArrayValue(arr, eCSSUnit_Calc);
-}
-
-nsStyleCoord::CalcValue nsCSSValue::GetCalcValue() const {
-  MOZ_ASSERT(mUnit == eCSSUnit_Calc, "The unit should be eCSSUnit_Calc");
-
-  const nsCSSValue::Array* array = GetArrayValue();
-  MOZ_ASSERT(array->Count() == 1, "There should be a 1-length array");
-
-  const nsCSSValue& rootValue = array->Item(0);
-
-  nsStyleCoord::CalcValue result;
-
-  if (rootValue.GetUnit() == eCSSUnit_Pixel) {
-    result.mLength = rootValue.GetPixelLength();
-    result.mPercent = 0.0f;
-    result.mHasPercent = false;
-  } else {
-    MOZ_ASSERT(rootValue.GetUnit() == eCSSUnit_Calc_Plus,
-               "Calc unit should be eCSSUnit_Calc_Plus");
-
-    const nsCSSValue::Array* calcPlusArray = rootValue.GetArrayValue();
-    MOZ_ASSERT(calcPlusArray->Count() == 2,
-               "eCSSUnit_Calc_Plus should have a 2-length array");
-
-    const nsCSSValue& length = calcPlusArray->Item(0);
-    const nsCSSValue& percent = calcPlusArray->Item(1);
-    MOZ_ASSERT(length.GetUnit() == eCSSUnit_Pixel,
-               "The first value should be eCSSUnit_Pixel");
-    MOZ_ASSERT(percent.GetUnit() == eCSSUnit_Percent,
-               "The first value should be eCSSUnit_Percent");
-    result.mLength = length.GetPixelLength();
-    result.mPercent = percent.GetPercentValue();
-    result.mHasPercent = true;
-  }
-
-  return result;
-}
-
-// static
-already_AddRefed<nsStringBuffer> nsCSSValue::BufferFromString(
-    const nsString& aValue) {
-  RefPtr<nsStringBuffer> buffer = nsStringBuffer::FromString(aValue);
-  if (buffer) {
-    return buffer.forget();
-  }
-
-  nsString::size_type length = aValue.Length();
-
-  // NOTE: Alloc prouduces a new, already-addref'd (refcnt = 1) buffer.
-  // NOTE: String buffer allocation is currently fallible.
-  size_t sz = (length + 1) * sizeof(char16_t);
-  buffer = nsStringBuffer::Alloc(sz);
-  if (MOZ_UNLIKELY(!buffer)) {
-    NS_ABORT_OOM(sz);
-  }
-
-  char16_t* data = static_cast<char16_t*>(buffer->Data());
-  nsCharTraits<char16_t>::copy(data, aValue.get(), length);
-  // Null-terminate.
-  data[length] = 0;
-  return buffer.forget();
-}
-
-size_t nsCSSValue::SizeOfExcludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  size_t n = 0;
-
-  switch (GetUnit()) {
-    // No value: nothing extra to measure.
-    case eCSSUnit_Null:
-    case eCSSUnit_Auto:
-    case eCSSUnit_Inherit:
-    case eCSSUnit_Initial:
-    case eCSSUnit_Unset:
-    case eCSSUnit_None:
-    case eCSSUnit_Normal:
-    case eCSSUnit_System_Font:
-    case eCSSUnit_All:
-    case eCSSUnit_Dummy:
-    case eCSSUnit_DummyInherit:
-      break;
-
-    // String
-    case eCSSUnit_String:
-    case eCSSUnit_Ident:
-    case eCSSUnit_Attr:
-    case eCSSUnit_Element:
-      n += mValue.mString->SizeOfIncludingThisIfUnshared(aMallocSizeOf);
-      break;
-
-    // Array
-    case eCSSUnit_Array:
-    case eCSSUnit_Counter:
-    case eCSSUnit_Counters:
-    case eCSSUnit_Cubic_Bezier:
-    case eCSSUnit_Steps:
-    case eCSSUnit_Symbols:
-    case eCSSUnit_Function:
-    case eCSSUnit_Calc:
-    case eCSSUnit_Calc_Plus:
-      break;
-
-    // Pair
-    case eCSSUnit_Pair:
-      n += mValue.mPair->SizeOfIncludingThis(aMallocSizeOf);
-      break;
-
-    // List
-    case eCSSUnit_List:
-      n += mValue.mList->SizeOfIncludingThis(aMallocSizeOf);
-      break;
-
-    // SharedList
-    case eCSSUnit_SharedList:
-      // Makes more sense not to measure, since it most cases the list
-      // will be shared.
-      break;
-
-    // PairList
-    case eCSSUnit_PairList:
-      n += mValue.mPairList->SizeOfIncludingThis(aMallocSizeOf);
-      break;
-
-    // Atom is always shared, and thus should not be counted.
-    case eCSSUnit_AtomIdent:
-      break;
-
-    // Int: nothing extra to measure.
-    case eCSSUnit_Integer:
-    case eCSSUnit_Enumerated:
-      break;
-
-    // Float: nothing extra to measure.
-    case eCSSUnit_Percent:
-    case eCSSUnit_Number:
-    case eCSSUnit_ViewportWidth:
-    case eCSSUnit_ViewportHeight:
-    case eCSSUnit_ViewportMin:
-    case eCSSUnit_ViewportMax:
-    case eCSSUnit_EM:
-    case eCSSUnit_XHeight:
-    case eCSSUnit_Char:
-    case eCSSUnit_RootEM:
-    case eCSSUnit_Point:
-    case eCSSUnit_Inch:
-    case eCSSUnit_Millimeter:
-    case eCSSUnit_Centimeter:
-    case eCSSUnit_Pica:
-    case eCSSUnit_Pixel:
-    case eCSSUnit_Quarter:
-    case eCSSUnit_Degree:
-    case eCSSUnit_Hertz:
-    case eCSSUnit_Kilohertz:
-    case eCSSUnit_Seconds:
-    case eCSSUnit_Milliseconds:
-    case eCSSUnit_FlexFraction:
-      break;
-
-    default:
-      MOZ_ASSERT(false, "bad nsCSSUnit");
-      break;
-  }
-
-  return n;
-}
-
-// --- nsCSSValueList -----------------
-
-nsCSSValueList::~nsCSSValueList() {
-  MOZ_COUNT_DTOR(nsCSSValueList);
-  NS_CSS_DELETE_LIST_MEMBER(nsCSSValueList, this, mNext);
-}
-
-nsCSSValueList* nsCSSValueList::Clone() const {
-  nsCSSValueList* result = new nsCSSValueList(*this);
-  nsCSSValueList* dest = result;
-  const nsCSSValueList* src = this->mNext;
-  while (src) {
-    dest->mNext = new nsCSSValueList(*src);
-    dest = dest->mNext;
-    src = src->mNext;
-  }
-
-  MOZ_ASSERT(result, "shouldn't return null; supposed to be infallible");
-  return result;
-}
-
-void nsCSSValueList::CloneInto(nsCSSValueList* aList) const {
-  NS_ASSERTION(!aList->mNext, "Must be an empty list!");
-  aList->mValue = mValue;
-  aList->mNext = mNext ? mNext->Clone() : nullptr;
-}
-
-/* static */
-bool nsCSSValueList::Equal(const nsCSSValueList* aList1,
-                           const nsCSSValueList* aList2) {
-  if (aList1 == aList2) {
-    return true;
-  }
-
-  const nsCSSValueList *p1 = aList1, *p2 = aList2;
-  for (; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
-    if (p1->mValue != p2->mValue) return false;
-  }
-  return !p1 && !p2;  // true if same length, false otherwise
-}
-
-size_t nsCSSValueList::SizeOfIncludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  size_t n = 0;
-  const nsCSSValueList* v = this;
-  while (v) {
-    n += aMallocSizeOf(v);
-    n += v->mValue.SizeOfExcludingThis(aMallocSizeOf);
-    v = v->mNext;
-  }
-  return n;
-}
-
-size_t nsCSSValueList_heap::SizeOfIncludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  // Only measure it if it's unshared, to avoid double-counting.
-  size_t n = 0;
-  if (mRefCnt <= 1) {
-    n += aMallocSizeOf(this);
-    n += mValue.SizeOfExcludingThis(aMallocSizeOf);
-    n += mNext ? mNext->SizeOfIncludingThis(aMallocSizeOf) : 0;
-  }
-  return n;
-}
-
-// --- nsCSSValueSharedList -----------------
-
-nsCSSValueSharedList::~nsCSSValueSharedList() {
-  if (mHead) {
-    NS_CSS_DELETE_LIST_MEMBER(nsCSSValueList, mHead, mNext);
-    delete mHead;
-  }
-}
-
-bool nsCSSValueSharedList::operator==(
-    const nsCSSValueSharedList& aOther) const {
-  return nsCSSValueList::Equal(mHead, aOther.mHead);
-}
-
-size_t nsCSSValueSharedList::SizeOfIncludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  // Only measure it if it's unshared, to avoid double-counting.
-  size_t n = 0;
-  if (mRefCnt <= 1) {
-    n += aMallocSizeOf(this);
-    n += mHead->SizeOfIncludingThis(aMallocSizeOf);
-  }
-  return n;
-}
-
-// --- nsCSSValuePair -----------------
-
-size_t nsCSSValuePair::SizeOfExcludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  size_t n = 0;
-  n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
-  n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
-  return n;
-}
-
-size_t nsCSSValuePair_heap::SizeOfIncludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  // Only measure it if it's unshared, to avoid double-counting.
-  size_t n = 0;
-  if (mRefCnt <= 1) {
-    n += aMallocSizeOf(this);
-    n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
-    n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
-  }
-  return n;
-}
-
-// --- nsCSSValuePairList -----------------
-
-nsCSSValuePairList::~nsCSSValuePairList() {
-  MOZ_COUNT_DTOR(nsCSSValuePairList);
-  NS_CSS_DELETE_LIST_MEMBER(nsCSSValuePairList, this, mNext);
-}
-
-nsCSSValuePairList* nsCSSValuePairList::Clone() const {
-  nsCSSValuePairList* result = new nsCSSValuePairList(*this);
-  nsCSSValuePairList* dest = result;
-  const nsCSSValuePairList* src = this->mNext;
-  while (src) {
-    dest->mNext = new nsCSSValuePairList(*src);
-    dest = dest->mNext;
-    src = src->mNext;
-  }
-
-  MOZ_ASSERT(result, "shouldn't return null; supposed to be infallible");
-  return result;
-}
-
-/* static */
-bool nsCSSValuePairList::Equal(const nsCSSValuePairList* aList1,
-                               const nsCSSValuePairList* aList2) {
-  if (aList1 == aList2) {
-    return true;
-  }
-
-  const nsCSSValuePairList *p1 = aList1, *p2 = aList2;
-  for (; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
-    if (p1->mXValue != p2->mXValue || p1->mYValue != p2->mYValue) return false;
-  }
-  return !p1 && !p2;  // true if same length, false otherwise
-}
-
-size_t nsCSSValuePairList::SizeOfIncludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  size_t n = 0;
-  const nsCSSValuePairList* v = this;
-  while (v) {
-    n += aMallocSizeOf(v);
-    n += v->mXValue.SizeOfExcludingThis(aMallocSizeOf);
-    n += v->mYValue.SizeOfExcludingThis(aMallocSizeOf);
-    v = v->mNext;
-  }
-  return n;
-}
-
-size_t nsCSSValuePairList_heap::SizeOfIncludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  // Only measure it if it's unshared, to avoid double-counting.
-  size_t n = 0;
-  if (mRefCnt <= 1) {
-    n += aMallocSizeOf(this);
-    n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
-    n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
-    n += mNext ? mNext->SizeOfIncludingThis(aMallocSizeOf) : 0;
-  }
-  return n;
-}
-
-size_t nsCSSValue::Array::SizeOfIncludingThis(
-    mozilla::MallocSizeOf aMallocSizeOf) const {
-  size_t n = aMallocSizeOf(this);
-  for (size_t i = 0; i < mCount; i++) {
-    n += mArray[i].SizeOfExcludingThis(aMallocSizeOf);
-  }
-  return n;
-}
-
 css::URLValue::~URLValue() {
   if (mLoadID != 0) {
     ImageLoader::DeregisterCSSImageFromAllLoaders(this);
   }
 }
 
 bool css::URLValue::Equals(const URLValue& aOther) const {
   MOZ_ASSERT(NS_IsMainThread());
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -236,86 +236,25 @@ struct GridTemplateAreasValue final {
       delete;
 };
 
 }  // namespace css
 }  // namespace mozilla
 
 enum nsCSSUnit : uint32_t {
   eCSSUnit_Null = 0,     // (n/a) null unit, value is not specified
-  eCSSUnit_Auto = 1,     // (n/a) value is algorithmic
-  eCSSUnit_Inherit = 2,  // (n/a) value is inherited
-  eCSSUnit_Initial = 3,  // (n/a) value is default UA value
-  eCSSUnit_Unset = 4,    // (n/a) value equivalent to 'initial' if on a reset
-                         // property, 'inherit' otherwise
-  eCSSUnit_None = 5,     // (n/a) value is none
-  eCSSUnit_Normal = 6,   // (n/a) value is normal (algorithmic, different than
-                         // auto)
-  eCSSUnit_System_Font = 7,    // (n/a) value is -moz-use-system-font
-  eCSSUnit_All = 8,            // (n/a) value is all
-  eCSSUnit_Dummy = 9,          // (n/a) a fake but specified value, used
-                               //       only in temporary values
-  eCSSUnit_DummyInherit = 10,  // (n/a) a fake but specified value, used
-                               //       only in temporary values
-
-  eCSSUnit_String = 11,   // (char16_t*) a string value
-  eCSSUnit_Ident = 12,    // (char16_t*) a string value
-  eCSSUnit_Attr = 14,     // (char16_t*) a attr(string) value
-  eCSSUnit_Element = 15,  // (char16_t*) an element id
-
-  // nsCSSValue::Array* values
-  eCSSUnit_Array = 20,     // (Array*) a list of values
-  eCSSUnit_Counter = 21,   // (Array*) a counter(string,[string]) value
-  eCSSUnit_Counters = 22,  // (Array*) a counters(string,string[,string]) value
-  eCSSUnit_Cubic_Bezier = 23,  // (Array*) a list of float values
-  eCSSUnit_Steps = 24,         // (Array*) a list of (integer, enumerated)
-  eCSSUnit_Symbols = 25,       // (Array*) a symbols(enumerated, symbols) value
-  eCSSUnit_Function = 26,  // (Array*) a function with parameters. First elem of
-                           // array is name, an nsCSSKeyword as
-                           // eCSSUnit_Enumerated, the rest of the values are
-                           // arguments.
-
-  // The top level of a calc() expression is eCSSUnit_Calc.  All
-  // remaining eCSSUnit_Calc_* units only occur inside these toplevel
-  // calc values.
-
-  // eCSSUnit_Calc exists so we can distinguish calc(2em) from 2em as specified
-  // values (but we drop this distinction for nsStyleCoord when we store
-  // computed values).
-  eCSSUnit_Calc = 30,       // (Array*) calc() value -- exactly 1 elt.
-  eCSSUnit_Calc_Plus = 31,  // (Array*) + node within calc(); exactly 2 elts.
-                            // a + b + c + d is grouped as ((a + b) + c) + d
-
-  eCSSUnit_Pair = 50,        // (nsCSSValuePair*) pair of values
-  eCSSUnit_List = 53,        // (nsCSSValueList*) list of values
-  eCSSUnit_SharedList = 55,  // (nsCSSValueSharedList*) same as list
-                             //   but reference counted and shared
-  eCSSUnit_PairList = 56,    // (nsCSSValuePairList*) list of value pairs
-
-  // Atom units
-  eCSSUnit_AtomIdent = 60,  // (nsAtom*) for its string as an identifier
 
   eCSSUnit_Integer = 70,     // (int) simple value
   eCSSUnit_Enumerated = 71,  // (int) value has enumerated meaning
 
   eCSSUnit_Percent = 100,  // (float) (1.0 == 100%) value is percentage of
                            // something
   eCSSUnit_Number = 101,   // (float) value is numeric (usually multiplier,
                            // different behavior than percent)
 
-  // Length units - relative
-  // Viewport relative measure
-  eCSSUnit_ViewportWidth = 700,   // (float) 1% of the width of the initial
-                                  // containing block (ICB)
-  eCSSUnit_ViewportHeight = 701,  // (float) 1% of the height of the ICB
-  eCSSUnit_ViewportMin = 702,     // (float) smaller of ViewportWidth and
-                                  // ViewportHeight
-  eCSSUnit_ViewportMax = 703,     // (float) larger of ViewportWidth and
-                                  // ViewportHeight
-
   // Font relative measure
   eCSSUnit_EM = 800,       // (float) == current font size
   eCSSUnit_XHeight = 801,  // (float) distance from top of lower case x to
                            // baseline
   eCSSUnit_Char = 802,     // (float) number of characters, used for width with
                            // monospace font
   eCSSUnit_RootEM = 803,   // (float) == root element font size
 
@@ -348,54 +287,44 @@ struct nsCSSValuePair_heap;
 struct nsCSSValueList;
 struct nsCSSValueList_heap;
 struct nsCSSValueSharedList;
 struct nsCSSValuePairList;
 struct nsCSSValuePairList_heap;
 
 class nsCSSValue {
  public:
-  struct Array;
-  friend struct Array;
-
-  // for valueless units only (null, auto, inherit, none, all, normal)
-  explicit nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null) : mUnit(aUnit) {
-    MOZ_ASSERT(aUnit <= eCSSUnit_DummyInherit, "not a valueless unit");
-  }
+  explicit nsCSSValue() : mUnit(eCSSUnit_Null) {}
 
   nsCSSValue(int32_t aValue, nsCSSUnit aUnit);
   nsCSSValue(float aValue, nsCSSUnit aUnit);
-  nsCSSValue(const nsString& aValue, nsCSSUnit aUnit);
-  nsCSSValue(Array* aArray, nsCSSUnit aUnit);
   nsCSSValue(const nsCSSValue& aCopy);
   nsCSSValue(nsCSSValue&& aOther) : mUnit(aOther.mUnit), mValue(aOther.mValue) {
     aOther.mUnit = eCSSUnit_Null;
   }
   template <typename T,
             typename = typename std::enable_if<std::is_enum<T>::value>::type>
   explicit nsCSSValue(T aValue) : mUnit(eCSSUnit_Enumerated) {
     static_assert(mozilla::EnumTypeFitsWithin<T, int32_t>::value,
                   "aValue must be an enum that fits within mValue.mInt");
     mValue.mInt = static_cast<int32_t>(aValue);
   }
 
-  ~nsCSSValue() { Reset(); }
-
   nsCSSValue& operator=(const nsCSSValue& aCopy);
   nsCSSValue& operator=(nsCSSValue&& aCopy);
   bool operator==(const nsCSSValue& aOther) const;
 
   bool operator!=(const nsCSSValue& aOther) const { return !(*this == aOther); }
 
   nsCSSUnit GetUnit() const { return mUnit; }
   bool IsLengthUnit() const {
-    return eCSSUnit_ViewportWidth <= mUnit && mUnit <= eCSSUnit_Pixel;
+    return eCSSUnit_EM <= mUnit && mUnit <= eCSSUnit_Pixel;
   }
-  bool IsLengthPercentCalcUnit() const {
-    return IsLengthUnit() || mUnit == eCSSUnit_Percent || IsCalcUnit();
+  bool IsLengthPercentUnit() const {
+    return IsLengthUnit() || mUnit == eCSSUnit_Percent;
   }
   /**
    * What the spec calls relative length units is, for us, split
    * between relative length units and pixel length units.
    *
    * A "relative" length unit is a multiple of some derived metric,
    * such as a font em-size, which itself was controlled by an input CSS
    * length. Relative length units should not be scaled by zooming, since
@@ -418,26 +347,16 @@ class nsCSSValue {
   static bool IsFloatUnit(nsCSSUnit aUnit) { return eCSSUnit_Number <= aUnit; }
   bool IsAngularUnit() const { return eCSSUnit_Degree == mUnit; }
   bool IsFrequencyUnit() const {
     return eCSSUnit_Hertz <= mUnit && mUnit <= eCSSUnit_Kilohertz;
   }
   bool IsTimeUnit() const {
     return eCSSUnit_Seconds <= mUnit && mUnit <= eCSSUnit_Milliseconds;
   }
-  bool IsCalcUnit() const {
-    return eCSSUnit_Calc <= mUnit && mUnit <= eCSSUnit_Calc_Plus;
-  }
-
-  bool UnitHasStringValue() const {
-    return eCSSUnit_String <= mUnit && mUnit <= eCSSUnit_Element;
-  }
-  bool UnitHasArrayValue() const {
-    return eCSSUnit_Array <= mUnit && mUnit <= eCSSUnit_Calc_Plus;
-  }
 
   int32_t GetIntValue() const {
     MOZ_ASSERT(mUnit == eCSSUnit_Integer || mUnit == eCSSUnit_Enumerated,
                "not an int value");
     return mValue.mInt;
   }
 
   nsCSSKeyword GetKeywordValue() const {
@@ -462,412 +381,36 @@ class nsCSSValue {
   }
 
   // Converts any angle to radians.
   double GetAngleValueInRadians() const;
 
   // Converts any angle to degrees.
   double GetAngleValueInDegrees() const;
 
-  nsAString& GetStringValue(nsAString& aBuffer) const {
-    MOZ_ASSERT(UnitHasStringValue(), "not a string value");
-    aBuffer.Truncate();
-    uint32_t len = NS_strlen(GetBufferValue(mValue.mString));
-    mValue.mString->ToString(len, aBuffer);
-    return aBuffer;
-  }
-
-  const char16_t* GetStringBufferValue() const {
-    MOZ_ASSERT(UnitHasStringValue(), "not a string value");
-    return GetBufferValue(mValue.mString);
-  }
-
-  Array* GetArrayValue() const {
-    MOZ_ASSERT(UnitHasArrayValue(), "not an array value");
-    return mValue.mArray;
-  }
-
-  nsCSSValueSharedList* GetSharedListValue() const {
-    MOZ_ASSERT(mUnit == eCSSUnit_SharedList, "not a shared list value");
-    return mValue.mSharedList;
-  }
-
-  // bodies of these are below
-  inline nsCSSValuePair& GetPairValue();
-  inline const nsCSSValuePair& GetPairValue() const;
-
-  inline nsCSSValueList* GetListValue();
-  inline const nsCSSValueList* GetListValue() const;
-
-  inline nsCSSValuePairList* GetPairListValue();
-  inline const nsCSSValuePairList* GetPairListValue() const;
-
-  // Not making this inline because that would force us to include
-  // imgIRequest.h, which leads to REQUIRES hell, since this header is included
-  // all over.
-  imgRequestProxy* GetImageValue(mozilla::dom::Document* aDocument) const;
-
-  // Like GetImageValue, but additionally will pass the imgRequestProxy
-  // through nsContentUtils::GetStaticRequest if aPresContent is static.
-  already_AddRefed<imgRequestProxy> GetPossiblyStaticImageValue(
-      mozilla::dom::Document* aDocument, nsPresContext* aPresContext) const;
-
   nscoord GetPixelLength() const;
 
-  nsAtom* GetAtomValue() const {
-    MOZ_ASSERT(mUnit == eCSSUnit_AtomIdent);
-    return mValue.mAtom;
-  }
-
-  void Reset()  // sets to null
-  {
-    if (mUnit != eCSSUnit_Null) DoReset();
-  }
-
- private:
-  void DoReset();
+  void Reset() { mUnit = eCSSUnit_Null; }
+  ~nsCSSValue() { Reset(); }
 
  public:
   void SetIntValue(int32_t aValue, nsCSSUnit aUnit);
   template <typename T,
             typename = typename std::enable_if<std::is_enum<T>::value>::type>
   void SetEnumValue(T aValue) {
     static_assert(mozilla::EnumTypeFitsWithin<T, int32_t>::value,
                   "aValue must be an enum that fits within mValue.mInt");
     SetIntValue(static_cast<int32_t>(aValue), eCSSUnit_Enumerated);
   }
   void SetPercentValue(float aValue);
   void SetFloatValue(float aValue, nsCSSUnit aUnit);
-  void SetStringValue(const nsString& aValue, nsCSSUnit aUnit);
-  void SetAtomIdentValue(already_AddRefed<nsAtom> aValue);
   // converts the nscoord to pixels
   void SetIntegerCoordValue(nscoord aCoord);
-  void SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit);
-  void SetPairValue(const nsCSSValuePair* aPair);
-  void SetPairValue(const nsCSSValue& xValue, const nsCSSValue& yValue);
-  void SetSharedListValue(nsCSSValueSharedList* aList);
-  void SetNoneValue();
-
-  nsStyleCoord::CalcValue GetCalcValue() const;
-  void SetCalcValue(const nsStyleCoord::CalcValue&);
-
-  // These are a little different - they allocate storage for you and
-  // return a handle.
-  nsCSSValueList* SetListValue();
-  nsCSSValuePairList* SetPairListValue();
-
-  // Returns an already addrefed buffer.  Guaranteed to return non-null.
-  // (Will abort on allocation failure.)
-  static already_AddRefed<nsStringBuffer> BufferFromString(
-      const nsString& aValue);
-
-  size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
- private:
-  static const char16_t* GetBufferValue(nsStringBuffer* aBuffer) {
-    return static_cast<char16_t*>(aBuffer->Data());
-  }
 
  protected:
   nsCSSUnit mUnit;
   union {
     int32_t mInt;
     float mFloat;
-    // Note: the capacity of the buffer may exceed the length of the string.
-    // If we're of a string type, mString is not null.
-    nsStringBuffer* MOZ_OWNING_REF mString;
-    nsAtom* MOZ_OWNING_REF mAtom;
-    Array* MOZ_OWNING_REF mArray;
-    nsCSSValuePair_heap* MOZ_OWNING_REF mPair;
-    nsCSSValueList_heap* MOZ_OWNING_REF mList;
-    nsCSSValueSharedList* MOZ_OWNING_REF mSharedList;
-    nsCSSValuePairList_heap* MOZ_OWNING_REF mPairList;
   } mValue;
 };
 
-struct nsCSSValue::Array final {
-  // return |Array| with reference count of zero
-  static Array* Create(size_t aItemCount) {
-    return new (aItemCount) Array(aItemCount);
-  }
-
-  nsCSSValue& operator[](size_t aIndex) {
-    MOZ_ASSERT(aIndex < mCount, "out of range");
-    return mArray[aIndex];
-  }
-
-  const nsCSSValue& operator[](size_t aIndex) const {
-    MOZ_ASSERT(aIndex < mCount, "out of range");
-    return mArray[aIndex];
-  }
-
-  nsCSSValue& Item(size_t aIndex) { return (*this)[aIndex]; }
-  const nsCSSValue& Item(size_t aIndex) const { return (*this)[aIndex]; }
-
-  size_t Count() const { return mCount; }
-
-  // callers depend on the items being contiguous
-  nsCSSValue* ItemStorage() { return this->First(); }
-
-  bool operator==(const Array& aOther) const {
-    if (mCount != aOther.mCount) return false;
-    for (size_t i = 0; i < mCount; ++i)
-      if ((*this)[i] != aOther[i]) return false;
-    return true;
-  }
-
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Array);
-
- private:
-  const size_t mCount;
-  // This must be the last sub-object, since we extend this array to
-  // be of size mCount; it needs to be a sub-object so it gets proper
-  // alignment.
-  nsCSSValue mArray[1];
-
-  void* operator new(size_t aSelfSize, size_t aItemCount) CPP_THROW_NEW {
-    MOZ_ASSERT(aItemCount > 0, "cannot have a 0 item count");
-    return ::operator new(aSelfSize + sizeof(nsCSSValue) * (aItemCount - 1));
-  }
-
-  void operator delete(void* aPtr) { ::operator delete(aPtr); }
-
-  nsCSSValue* First() { return mArray; }
-
-  const nsCSSValue* First() const { return mArray; }
-
-#define CSSVALUE_LIST_FOR_EXTRA_VALUES(var)                          \
-  for (nsCSSValue* var = First() + 1, *var##_end = First() + mCount; \
-       var != var##_end; ++var)
-
-  explicit Array(size_t aItemCount) : mRefCnt(0), mCount(aItemCount) {
-    CSSVALUE_LIST_FOR_EXTRA_VALUES(val) { new (val) nsCSSValue(); }
-  }
-
-  ~Array() {
-    CSSVALUE_LIST_FOR_EXTRA_VALUES(val) { val->~nsCSSValue(); }
-  }
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-#undef CSSVALUE_LIST_FOR_EXTRA_VALUES
-
- private:
-  Array(const Array& aOther) = delete;
-  Array& operator=(const Array& aOther) = delete;
-};
-
-// Prefer nsCSSValue::Array for lists of fixed size.
-struct nsCSSValueList {
-  nsCSSValueList() : mNext(nullptr) { MOZ_COUNT_CTOR(nsCSSValueList); }
-  ~nsCSSValueList();
-
-  nsCSSValueList* Clone() const;  // makes a deep copy. Infallible.
-  void CloneInto(nsCSSValueList* aList) const;  // makes a deep copy into aList
-
-  static bool Equal(const nsCSSValueList* aList1, const nsCSSValueList* aList2);
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-  nsCSSValue mValue;
-  nsCSSValueList* mNext;
-
- private:
-  nsCSSValueList(const nsCSSValueList& aCopy)  // makes a shallow copy
-      : mValue(aCopy.mValue), mNext(nullptr) {
-    MOZ_COUNT_CTOR(nsCSSValueList);
-  }
-
-  // We don't want operator== or operator!= because they wouldn't be
-  // null-safe, which is generally what we need.  Use |Equal| method
-  // above instead.
-  bool operator==(nsCSSValueList const& aOther) const = delete;
-  bool operator!=(const nsCSSValueList& aOther) const = delete;
-};
-
-// nsCSSValueList_heap differs from nsCSSValueList only in being
-// refcounted.  It should not be necessary to use this class directly;
-// it's an implementation detail of nsCSSValue.
-struct nsCSSValueList_heap final : public nsCSSValueList {
-  NS_INLINE_DECL_REFCOUNTING(nsCSSValueList_heap)
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
- private:
-  // Private destructor, to discourage deletion outside of Release():
-  ~nsCSSValueList_heap() {}
-};
-
-// This is a reference counted list value.  Note that the object is
-// a wrapper for the reference count and a pointer to the head of the
-// list, whereas the other list types (such as nsCSSValueList) do
-// not have such a wrapper.
-struct nsCSSValueSharedList final {
-  nsCSSValueSharedList() : mHead(nullptr) {}
-
-  // Takes ownership of aList.
-  explicit nsCSSValueSharedList(nsCSSValueList* aList) : mHead(aList) {}
-
- private:
-  // Private destructor, to discourage deletion outside of Release():
-  ~nsCSSValueSharedList();
-
- public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsCSSValueSharedList)
-
-  bool operator==(nsCSSValueSharedList const& aOther) const;
-  bool operator!=(const nsCSSValueSharedList& aOther) const {
-    return !(*this == aOther);
-  }
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-  nsCSSValueList* mHead;
-};
-
-inline nsCSSValueList* nsCSSValue::GetListValue() {
-  MOZ_DIAGNOSTIC_ASSERT(mUnit == eCSSUnit_List, "not a list value");
-  return mValue.mList;
-}
-
-inline const nsCSSValueList* nsCSSValue::GetListValue() const {
-  MOZ_DIAGNOSTIC_ASSERT(mUnit == eCSSUnit_List, "not a list value");
-  return mValue.mList;
-}
-
-struct nsCSSValuePair {
-  nsCSSValuePair() { MOZ_COUNT_CTOR(nsCSSValuePair); }
-  explicit nsCSSValuePair(nsCSSUnit aUnit) : mXValue(aUnit), mYValue(aUnit) {
-    MOZ_COUNT_CTOR(nsCSSValuePair);
-  }
-  nsCSSValuePair(const nsCSSValue& aXValue, const nsCSSValue& aYValue)
-      : mXValue(aXValue), mYValue(aYValue) {
-    MOZ_COUNT_CTOR(nsCSSValuePair);
-  }
-  nsCSSValuePair(const nsCSSValuePair& aCopy)
-      : mXValue(aCopy.mXValue), mYValue(aCopy.mYValue) {
-    MOZ_COUNT_CTOR(nsCSSValuePair);
-  }
-  ~nsCSSValuePair() { MOZ_COUNT_DTOR(nsCSSValuePair); }
-
-  nsCSSValuePair& operator=(const nsCSSValuePair& aOther) {
-    mXValue = aOther.mXValue;
-    mYValue = aOther.mYValue;
-    return *this;
-  }
-
-  bool operator==(const nsCSSValuePair& aOther) const {
-    return mXValue == aOther.mXValue && mYValue == aOther.mYValue;
-  }
-
-  bool operator!=(const nsCSSValuePair& aOther) const {
-    return mXValue != aOther.mXValue || mYValue != aOther.mYValue;
-  }
-
-  bool BothValuesEqualTo(const nsCSSValue& aValue) const {
-    return mXValue == aValue && mYValue == aValue;
-  }
-
-  void SetBothValuesTo(const nsCSSValue& aValue) {
-    mXValue = aValue;
-    mYValue = aValue;
-  }
-
-  void Reset() {
-    mXValue.Reset();
-    mYValue.Reset();
-  }
-
-  bool HasValue() const {
-    return mXValue.GetUnit() != eCSSUnit_Null ||
-           mYValue.GetUnit() != eCSSUnit_Null;
-  }
-
-  size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-  nsCSSValue mXValue;
-  nsCSSValue mYValue;
-};
-
-// nsCSSValuePair_heap differs from nsCSSValuePair only in being
-// refcounted.  It should not be necessary to use this class directly;
-// it's an implementation detail of nsCSSValue.
-struct nsCSSValuePair_heap final : public nsCSSValuePair {
-  // forward constructor
-  nsCSSValuePair_heap(const nsCSSValue& aXValue, const nsCSSValue& aYValue)
-      : nsCSSValuePair(aXValue, aYValue) {}
-
-  NS_INLINE_DECL_REFCOUNTING(nsCSSValuePair_heap)
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
- private:
-  // Private destructor, to discourage deletion outside of Release():
-  ~nsCSSValuePair_heap() {}
-};
-
-// This has to be here so that the relationship between nsCSSValuePair
-// and nsCSSValuePair_heap is visible.
-inline nsCSSValuePair& nsCSSValue::GetPairValue() {
-  MOZ_ASSERT(mUnit == eCSSUnit_Pair, "not a pair value");
-  return *mValue.mPair;
-}
-
-inline const nsCSSValuePair& nsCSSValue::GetPairValue() const {
-  MOZ_ASSERT(mUnit == eCSSUnit_Pair, "not a pair value");
-  return *mValue.mPair;
-}
-
-// Maybe should be replaced with nsCSSValueList and nsCSSValue::Array?
-struct nsCSSValuePairList {
-  nsCSSValuePairList() : mNext(nullptr) { MOZ_COUNT_CTOR(nsCSSValuePairList); }
-  ~nsCSSValuePairList();
-
-  nsCSSValuePairList* Clone() const;  // makes a deep copy. Infallible.
-
-  static bool Equal(const nsCSSValuePairList* aList1,
-                    const nsCSSValuePairList* aList2);
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
-  nsCSSValue mXValue;
-  nsCSSValue mYValue;
-  nsCSSValuePairList* mNext;
-
- private:
-  nsCSSValuePairList(const nsCSSValuePairList& aCopy)  // makes a shallow copy
-      : mXValue(aCopy.mXValue), mYValue(aCopy.mYValue), mNext(nullptr) {
-    MOZ_COUNT_CTOR(nsCSSValuePairList);
-  }
-
-  // We don't want operator== or operator!= because they wouldn't be
-  // null-safe, which is generally what we need.  Use |Equal| method
-  // above instead.
-  bool operator==(const nsCSSValuePairList& aOther) const = delete;
-  bool operator!=(const nsCSSValuePairList& aOther) const = delete;
-};
-
-// nsCSSValuePairList_heap differs from nsCSSValuePairList only in being
-// refcounted.  It should not be necessary to use this class directly;
-// it's an implementation detail of nsCSSValue.
-struct nsCSSValuePairList_heap final : public nsCSSValuePairList {
-  NS_INLINE_DECL_REFCOUNTING(nsCSSValuePairList_heap)
-
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
- private:
-  // Private destructor, to discourage deletion outside of Release():
-  ~nsCSSValuePairList_heap() {}
-};
-
-// This has to be here so that the relationship between nsCSSValuePairList
-// and nsCSSValuePairList_heap is visible.
-inline nsCSSValuePairList* nsCSSValue::GetPairListValue() {
-  MOZ_DIAGNOSTIC_ASSERT(mUnit == eCSSUnit_PairList, "not a pairlist value");
-  return mValue.mPairList;
-}
-
-inline const nsCSSValuePairList* nsCSSValue::GetPairListValue() const {
-  MOZ_DIAGNOSTIC_ASSERT(mUnit == eCSSUnit_PairList, "not a pairlist value");
-  return mValue.mPairList;
-}
-
 #endif /* nsCSSValue_h___ */