Bug 1551991 - Remove nsCSSValue bindings. r=jwatt
☠☠ backed out by 283b94c196a1 ☠ ☠
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 16 May 2019 14:31:52 +0000
changeset 535995 3bb3fafa62e2eea4b96404a1954f822fdaecbfd5
parent 535994 e12a979de502bf14147c43b34d437449bbd74552
child 535996 0883716b330eff8ee1649e612afeb2c01f5e51bc
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1551991
milestone68.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 1551991 - Remove nsCSSValue bindings. r=jwatt Depends on D31320 Differential Revision: https://phabricator.services.mozilla.com/D31321
layout/style/CounterStyleManager.cpp
layout/style/GeckoBindings.cpp
layout/style/GeckoBindings.h
layout/style/ServoBindings.h
servo/components/style/gecko/mod.rs
servo/components/style/gecko/rules.rs
servo/components/style/gecko_bindings/sugar/mod.rs
servo/components/style/gecko_bindings/sugar/ns_css_value.rs
servo/ports/geckolib/glue.rs
--- a/layout/style/CounterStyleManager.cpp
+++ b/layout/style/CounterStyleManager.cpp
@@ -984,22 +984,16 @@ class CustomCounterStyle final : public 
     PresShell* presShell = mManager->PresContext()->PresShell();
     this->~CustomCounterStyle();
     presShell->FreeByObjectID(eArenaObjectID_CustomCounterStyle, this);
   }
 
  private:
   ~CustomCounterStyle() {}
 
-  nsCSSValue GetDesc(nsCSSCounterDesc aDesc) const {
-    nsCSSValue value;
-    Servo_CounterStyleRule_GetDescriptor(mRule, aDesc, &value);
-    return value;
-  }
-
   Span<const nsString> GetSymbols();
   Span<const AdditiveSymbol> GetAdditiveSymbols();
 
   // The speak-as values of counter styles may form a loop, and the
   // loops may have complex interaction with the loop formed by
   // extending. To solve this problem, the computation of speak-as is
   // divided into two phases:
   // 1. figure out the raw value, by ComputeRawSpeakAs, and
--- a/layout/style/GeckoBindings.cpp
+++ b/layout/style/GeckoBindings.cpp
@@ -1685,129 +1685,16 @@ void Gecko_Snapshot_DebugListAttributes(
 }
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(URLValue, CSSURLValue);
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(URLExtraData, URLExtraData);
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
 
-void Gecko_CSSValue_SetNumber(nsCSSValue* aCSSValue, float aNumber) {
-  aCSSValue->SetFloatValue(aNumber, eCSSUnit_Number);
-}
-
-float Gecko_CSSValue_GetNumber(const nsCSSValue* aCSSValue) {
-  return aCSSValue->GetFloatValue();
-}
-
-void Gecko_CSSValue_SetKeyword(nsCSSValue* aCSSValue, nsCSSKeyword aKeyword) {
-  aCSSValue->SetEnumValue(aKeyword);
-}
-
-nsCSSKeyword Gecko_CSSValue_GetKeyword(const nsCSSValue* aCSSValue) {
-  return aCSSValue->GetKeywordValue();
-}
-
-void Gecko_CSSValue_SetPercentage(nsCSSValue* aCSSValue, float aPercent) {
-  aCSSValue->SetPercentValue(aPercent);
-}
-
-float Gecko_CSSValue_GetPercentage(const nsCSSValue* aCSSValue) {
-  return aCSSValue->GetPercentValue();
-}
-
-void Gecko_CSSValue_SetPixelLength(nsCSSValue* aCSSValue, float aLen) {
-  MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null ||
-             aCSSValue->GetUnit() == eCSSUnit_Pixel);
-  aCSSValue->SetFloatValue(aLen, eCSSUnit_Pixel);
-}
-
-void Gecko_CSSValue_SetCalc(nsCSSValue* aCSSValue,
-                            nsStyleCoord::CalcValue aCalc) {
-  aCSSValue->SetCalcValue(aCalc);
-}
-
-nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(const nsCSSValue* aCSSValue) {
-  return aCSSValue->GetCalcValue();
-}
-
-void Gecko_CSSValue_SetFunction(nsCSSValue* aCSSValue, int32_t aLen) {
-  nsCSSValue::Array* arr = nsCSSValue::Array::Create(aLen);
-  aCSSValue->SetArrayValue(arr, eCSSUnit_Function);
-}
-
-void Gecko_CSSValue_SetString(nsCSSValue* aCSSValue, const uint8_t* aString,
-                              uint32_t aLength, nsCSSUnit aUnit) {
-  MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null);
-  nsString string;
-  nsDependentCSubstring slice(reinterpret_cast<const char*>(aString), aLength);
-  AppendUTF8toUTF16(slice, string);
-  aCSSValue->SetStringValue(string, aUnit);
-}
-
-void Gecko_CSSValue_SetStringFromAtom(nsCSSValue* aCSSValue, nsAtom* aAtom,
-                                      nsCSSUnit aUnit) {
-  aCSSValue->SetStringValue(nsDependentAtomString(aAtom), aUnit);
-}
-
-void Gecko_CSSValue_SetAtomIdent(nsCSSValue* aCSSValue, nsAtom* aAtom) {
-  aCSSValue->SetAtomIdentValue(already_AddRefed<nsAtom>(aAtom));
-}
-
-void Gecko_CSSValue_SetArray(nsCSSValue* aCSSValue, int32_t aLength) {
-  MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null);
-  RefPtr<nsCSSValue::Array> array = nsCSSValue::Array::Create(aLength);
-  aCSSValue->SetArrayValue(array, eCSSUnit_Array);
-}
-
-void Gecko_CSSValue_SetInt(nsCSSValue* aCSSValue, int32_t aInteger,
-                           nsCSSUnit aUnit) {
-  aCSSValue->SetIntValue(aInteger, aUnit);
-}
-
-void Gecko_CSSValue_SetFloat(nsCSSValue* aCSSValue, float aValue,
-                             nsCSSUnit aUnit) {
-  aCSSValue->SetFloatValue(aValue, aUnit);
-}
-
-nsCSSValue* Gecko_CSSValue_GetArrayItem(nsCSSValue* aCSSValue, int32_t aIndex) {
-  return &aCSSValue->GetArrayValue()->Item(aIndex);
-}
-
-const nsCSSValue* Gecko_CSSValue_GetArrayItemConst(const nsCSSValue* aCSSValue,
-                                                   int32_t aIndex) {
-  return &aCSSValue->GetArrayValue()->Item(aIndex);
-}
-
-void Gecko_CSSValue_SetPair(nsCSSValue* aCSSValue, const nsCSSValue* aXValue,
-                            const nsCSSValue* aYValue) {
-  MOZ_ASSERT(NS_IsMainThread());
-  aCSSValue->SetPairValue(*aXValue, *aYValue);
-}
-
-void Gecko_CSSValue_SetList(nsCSSValue* aCSSValue, uint32_t aLen) {
-  MOZ_ASSERT(NS_IsMainThread());
-  nsCSSValueList* item = aCSSValue->SetListValue();
-  for (uint32_t i = 1; i < aLen; ++i) {
-    item->mNext = new nsCSSValueList;
-    item = item->mNext;
-  }
-}
-
-void Gecko_CSSValue_SetPairList(nsCSSValue* aCSSValue, uint32_t aLen) {
-  MOZ_ASSERT(NS_IsMainThread());
-  nsCSSValuePairList* item = aCSSValue->SetPairListValue();
-  for (uint32_t i = 1; i < aLen; ++i) {
-    item->mNext = new nsCSSValuePairList;
-    item = item->mNext;
-  }
-}
-
-void Gecko_CSSValue_Drop(nsCSSValue* aCSSValue) { aCSSValue->~nsCSSValue(); }
-
 void Gecko_nsStyleFont_SetLang(nsStyleFont* aFont, nsAtom* aAtom) {
   aFont->mLanguage = dont_AddRef(aAtom);
   aFont->mExplicitLanguage = true;
 }
 
 void Gecko_nsStyleFont_CopyLangFrom(nsStyleFont* aFont,
                                     const nsStyleFont* aSource) {
   aFont->mLanguage = aSource->mLanguage;
--- a/layout/style/GeckoBindings.h
+++ b/layout/style/GeckoBindings.h
@@ -13,17 +13,16 @@
 
 #include "mozilla/ServoTypes.h"
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/css/DocumentMatchingFunction.h"
 #include "mozilla/css/SheetLoadData.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/ComputedTimingFunction.h"
 #include "mozilla/PreferenceSheet.h"
-#include "nsCSSValue.h"
 #include "nsStyleStruct.h"
 
 class nsAtom;
 class nsIURI;
 class nsSimpleContentList;
 struct nsFont;
 
 namespace mozilla {
@@ -581,64 +580,16 @@ void Gecko_nsIURI_Debug(nsIURI*, nsCStri
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::URLValue, CSSURLValue);
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::URLExtraData, URLExtraData);
 
 void Gecko_FillAllImageLayers(nsStyleImageLayers* layers, uint32_t max_len);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
 
-// Getter for nsCSSValue
-nsCSSValue* Gecko_CSSValue_GetArrayItem(nsCSSValue*, int32_t index);
-
-// const version of the above function.
-const nsCSSValue* Gecko_CSSValue_GetArrayItemConst(const nsCSSValue*,
-                                                   int32_t index);
-
-nsCSSKeyword Gecko_CSSValue_GetKeyword(const nsCSSValue*);
-float Gecko_CSSValue_GetNumber(const nsCSSValue* css_value);
-float Gecko_CSSValue_GetPercentage(const nsCSSValue* css_value);
-nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(const nsCSSValue* aCSSValue);
-void Gecko_CSSValue_SetNumber(nsCSSValue* css_value, float number);
-
-void Gecko_CSSValue_SetKeyword(nsCSSValue* css_value, nsCSSKeyword keyword);
-
-void Gecko_CSSValue_SetPercentage(nsCSSValue* css_value, float percent);
-
-void Gecko_CSSValue_SetPixelLength(nsCSSValue* aCSSValue, float aLen);
-
-void Gecko_CSSValue_SetCalc(nsCSSValue* css_value,
-                            nsStyleCoord::CalcValue calc);
-
-void Gecko_CSSValue_SetFunction(nsCSSValue* css_value, int32_t len);
-
-void Gecko_CSSValue_SetString(nsCSSValue* css_value, const uint8_t* string,
-                              uint32_t len, nsCSSUnit unit);
-
-void Gecko_CSSValue_SetStringFromAtom(nsCSSValue* css_value, nsAtom* atom,
-                                      nsCSSUnit unit);
-
-// Take an addrefed nsAtom and set it to the nsCSSValue
-void Gecko_CSSValue_SetAtomIdent(nsCSSValue* css_value, nsAtom* atom);
-void Gecko_CSSValue_SetArray(nsCSSValue* css_value, int32_t len);
-
-void Gecko_CSSValue_SetInt(nsCSSValue* css_value, int32_t integer,
-                           nsCSSUnit unit);
-
-void Gecko_CSSValue_SetFloat(nsCSSValue* css_value, float value,
-                             nsCSSUnit unit);
-
-void Gecko_CSSValue_SetPair(nsCSSValue* css_value, const nsCSSValue* xvalue,
-                            const nsCSSValue* yvalue);
-
-void Gecko_CSSValue_SetList(nsCSSValue* css_value, uint32_t len);
-void Gecko_CSSValue_SetPairList(nsCSSValue* css_value, uint32_t len);
-
-void Gecko_CSSValue_Drop(nsCSSValue* css_value);
-
 float Gecko_FontStretch_ToFloat(mozilla::FontStretch aStretch);
 
 void Gecko_FontStretch_SetFloat(mozilla::FontStretch* aStretch,
                                 float aFloatValue);
 
 float Gecko_FontSlantStyle_ToFloat(mozilla::FontSlantStyle aStyle);
 void Gecko_FontSlantStyle_SetNormal(mozilla::FontSlantStyle*);
 void Gecko_FontSlantStyle_SetItalic(mozilla::FontSlantStyle*);
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -54,22 +54,16 @@ GROUP_RULE_FUNCS(Supports)
 BASIC_RULE_FUNCS(FontFeatureValues)
 BASIC_RULE_FUNCS(FontFace)
 BASIC_RULE_FUNCS(CounterStyle)
 
 #undef GROUP_RULE_FUNCS
 #undef BASIC_RULE_FUNCS
 #undef BASIC_RULE_FUNCS_WITHOUT_GETTER
 
-// TODO(emilio): Move CounterStyleRule outside of nsCSSValue, then remove this
-// while at it.
-void Servo_CounterStyleRule_GetDescriptor(const RawServoCounterStyleRule* rule,
-                                          nsCSSCounterDesc desc,
-                                          nsCSSValue* result);
-
 void Servo_CounterStyleRule_GetDescriptorCssText(
     const RawServoCounterStyleRule* rule, nsCSSCounterDesc desc,
     nsAString* result);
 
 bool Servo_CounterStyleRule_SetDescriptor(const RawServoCounterStyleRule* rule,
                                           nsCSSCounterDesc desc,
                                           const nsACString* value);
 
--- a/servo/components/style/gecko/mod.rs
+++ b/servo/components/style/gecko/mod.rs
@@ -12,16 +12,15 @@ pub mod boxed_types;
 pub mod conversions;
 pub mod data;
 pub mod media_features;
 pub mod media_queries;
 #[cfg(feature = "gecko_profiler")]
 pub mod profiler;
 pub mod pseudo_element;
 pub mod restyle_damage;
-pub mod rules;
 pub mod selector_parser;
 pub mod snapshot;
 pub mod snapshot_helpers;
 pub mod traversal;
 pub mod url;
 pub mod values;
 pub mod wrapper;
deleted file mode 100644
--- a/servo/components/style/gecko/rules.rs
+++ /dev/null
@@ -1,135 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-
-//! Bindings for CSS Rule objects
-
-use crate::counter_style::{self, CounterBound};
-use crate::gecko_bindings::structs::{self, nsCSSValue};
-use crate::gecko_bindings::sugar::ns_css_value::ToNsCssValue;
-
-impl<'a> ToNsCssValue for &'a counter_style::System {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        use crate::counter_style::System::*;
-        match *self {
-            Cyclic => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_CYCLIC as i32),
-            Numeric => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_NUMERIC as i32),
-            Alphabetic => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_ALPHABETIC as i32),
-            Symbolic => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_SYMBOLIC as i32),
-            Additive => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_ADDITIVE as i32),
-            Fixed {
-                ref first_symbol_value,
-            } => {
-                let mut a = nsCSSValue::null();
-                let mut b = nsCSSValue::null();
-                a.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_FIXED as i32);
-                b.set_integer(first_symbol_value.map_or(1, |v| v.value()));
-                nscssvalue.set_pair(&a, &b);
-            },
-            Extends(ref other) => {
-                let mut a = nsCSSValue::null();
-                let mut b = nsCSSValue::null();
-                a.set_enum(structs::NS_STYLE_COUNTER_SYSTEM_EXTENDS as i32);
-                b.set_atom_ident(other.0.clone());
-                nscssvalue.set_pair(&a, &b);
-            },
-        }
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::Negative {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        if let Some(ref second) = self.1 {
-            let mut a = nsCSSValue::null();
-            let mut b = nsCSSValue::null();
-            a.set_from(&self.0);
-            b.set_from(second);
-            nscssvalue.set_pair(&a, &b);
-        } else {
-            nscssvalue.set_from(&self.0)
-        }
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::Symbol {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        match *self {
-            counter_style::Symbol::String(ref s) => nscssvalue.set_string(s),
-            counter_style::Symbol::Ident(ref s) => nscssvalue.set_ident_from_atom(&s.0),
-        }
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::Ranges {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        if self.0.is_empty() {
-            nscssvalue.set_auto();
-        } else {
-            nscssvalue.set_pair_list(self.0.iter().map(|range| {
-                fn set_bound(bound: CounterBound, nscssvalue: &mut nsCSSValue) {
-                    if let CounterBound::Integer(finite) = bound {
-                        nscssvalue.set_integer(finite.value())
-                    } else {
-                        nscssvalue.set_enum(structs::NS_STYLE_COUNTER_RANGE_INFINITE as i32)
-                    }
-                }
-                let mut start = nsCSSValue::null();
-                let mut end = nsCSSValue::null();
-                set_bound(range.start, &mut start);
-                set_bound(range.end, &mut end);
-                (start, end)
-            }));
-        }
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::Pad {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        let mut min_length = nsCSSValue::null();
-        let mut pad_with = nsCSSValue::null();
-        min_length.set_integer(self.0.value());
-        pad_with.set_from(&self.1);
-        nscssvalue.set_pair(&min_length, &pad_with);
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::Fallback {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        nscssvalue.set_atom_ident(self.0 .0.clone())
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::Symbols {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        nscssvalue.set_list(self.0.iter().map(|item| {
-            let mut value = nsCSSValue::null();
-            value.set_from(item);
-            value
-        }));
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::AdditiveSymbols {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        nscssvalue.set_pair_list(self.0.iter().map(|tuple| {
-            let mut weight = nsCSSValue::null();
-            let mut symbol = nsCSSValue::null();
-            weight.set_integer(tuple.weight.value());
-            symbol.set_from(&tuple.symbol);
-            (weight, symbol)
-        }));
-    }
-}
-
-impl<'a> ToNsCssValue for &'a counter_style::SpeakAs {
-    fn convert(self, nscssvalue: &mut nsCSSValue) {
-        use crate::counter_style::SpeakAs::*;
-        match *self {
-            Auto => nscssvalue.set_auto(),
-            Bullets => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_BULLETS as i32),
-            Numbers => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_NUMBERS as i32),
-            Words => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_WORDS as i32),
-            Other(ref other) => nscssvalue.set_atom_ident(other.0.clone()),
-        }
-    }
-}
--- a/servo/components/style/gecko_bindings/sugar/mod.rs
+++ b/servo/components/style/gecko_bindings/sugar/mod.rs
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 //! Rust sugar and convenience methods for Gecko types.
 
 mod ns_com_ptr;
 mod ns_compatibility;
-pub mod ns_css_value;
 mod ns_style_auto_array;
 pub mod ns_style_coord;
 mod ns_t_array;
 pub mod origin_flags;
 pub mod ownership;
 pub mod refptr;
deleted file mode 100644
--- a/servo/components/style/gecko_bindings/sugar/ns_css_value.rs
+++ /dev/null
@@ -1,401 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-
-//! Little helpers for `nsCSSValue`.
-
-use crate::gecko_bindings::bindings;
-use crate::gecko_bindings::structs;
-use crate::gecko_bindings::structs::{nsCSSUnit, nsCSSValue};
-use crate::gecko_bindings::structs::{nsCSSValueList, nsCSSValue_Array};
-use crate::gecko_string_cache::Atom;
-use crate::values::computed::{Angle, Length, LengthPercentage, Percentage};
-use crate::Zero;
-use std::marker::PhantomData;
-use std::mem;
-use std::ops::{Index, IndexMut};
-use std::slice;
-
-impl nsCSSValue {
-    /// Create a CSSValue with null unit, useful to be used as a return value.
-    #[inline]
-    pub fn null() -> Self {
-        unsafe { mem::zeroed() }
-    }
-
-    /// Returns true if this nsCSSValue is none.
-    #[inline]
-    pub fn is_none(&self) -> bool {
-        self.mUnit == nsCSSUnit::eCSSUnit_None
-    }
-
-    /// Returns this nsCSSValue value as an integer, unchecked in release
-    /// builds.
-    pub fn integer_unchecked(&self) -> i32 {
-        debug_assert!(
-            self.mUnit == nsCSSUnit::eCSSUnit_Integer ||
-                self.mUnit == nsCSSUnit::eCSSUnit_Enumerated
-        );
-        unsafe { *self.mValue.mInt.as_ref() }
-    }
-
-    /// Checks if it is an integer and returns it if so
-    pub fn integer(&self) -> Option<i32> {
-        if self.mUnit == nsCSSUnit::eCSSUnit_Integer || self.mUnit == nsCSSUnit::eCSSUnit_Enumerated
-        {
-            Some(unsafe { *self.mValue.mInt.as_ref() })
-        } else {
-            None
-        }
-    }
-
-    /// Returns this nsCSSValue value as a floating point value, unchecked in
-    /// release builds.
-    pub fn float_unchecked(&self) -> f32 {
-        debug_assert!(nsCSSUnit::eCSSUnit_Number as u32 <= self.mUnit as u32);
-        unsafe { *self.mValue.mFloat.as_ref() }
-    }
-
-    /// Returns this nsCSSValue as a nsCSSValue::Array, unchecked in release
-    /// builds.
-    pub unsafe fn array_unchecked(&self) -> &nsCSSValue_Array {
-        debug_assert!(
-            nsCSSUnit::eCSSUnit_Array as u32 <= self.mUnit as u32 &&
-                self.mUnit as u32 <= nsCSSUnit::eCSSUnit_Calc_Plus as u32
-        );
-        let array = *self.mValue.mArray.as_ref();
-        debug_assert!(!array.is_null());
-        &*array
-    }
-
-    /// Sets LengthPercentage value to this nsCSSValue.
-    pub unsafe fn set_length_percentage(&mut self, lp: LengthPercentage) {
-        if lp.was_calc {
-            return bindings::Gecko_CSSValue_SetCalc(self, lp.into());
-        }
-        debug_assert!(!lp.has_percentage || lp.unclamped_length() == Length::zero());
-        if lp.has_percentage {
-            return self.set_percentage(lp.percentage());
-        }
-        self.set_px(lp.unclamped_length().px());
-    }
-
-    /// Sets a px value to this nsCSSValue.
-    pub unsafe fn set_px(&mut self, px: f32) {
-        bindings::Gecko_CSSValue_SetPixelLength(self, px)
-    }
-
-    /// Sets a percentage value to this nsCSSValue.
-    pub unsafe fn set_percentage(&mut self, unit_value: f32) {
-        bindings::Gecko_CSSValue_SetPercentage(self, unit_value)
-    }
-
-    /// Returns LengthPercentage value.
-    pub unsafe fn get_length_percentage(&self) -> LengthPercentage {
-        match self.mUnit {
-            nsCSSUnit::eCSSUnit_Pixel => {
-                LengthPercentage::new(Length::new(bindings::Gecko_CSSValue_GetNumber(self)), None)
-            },
-            nsCSSUnit::eCSSUnit_Percent => LengthPercentage::new_percent(Percentage(
-                bindings::Gecko_CSSValue_GetPercentage(self),
-            )),
-            nsCSSUnit::eCSSUnit_Calc => bindings::Gecko_CSSValue_GetCalc(self).into(),
-            _ => panic!("Unexpected unit"),
-        }
-    }
-
-    /// Returns Length  value.
-    pub unsafe fn get_length(&self) -> Length {
-        match self.mUnit {
-            nsCSSUnit::eCSSUnit_Pixel => Length::new(bindings::Gecko_CSSValue_GetNumber(self)),
-            _ => panic!("Unexpected unit"),
-        }
-    }
-
-    fn set_valueless_unit(&mut self, unit: nsCSSUnit) {
-        debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_Null);
-        debug_assert!(
-            unit as u32 <= nsCSSUnit::eCSSUnit_DummyInherit as u32,
-            "Not a valueless unit"
-        );
-        self.mUnit = unit;
-    }
-
-    /// Set to an auto value
-    ///
-    /// This method requires the current value to be null.
-    pub fn set_auto(&mut self) {
-        self.set_valueless_unit(nsCSSUnit::eCSSUnit_Auto);
-    }
-
-    /// Set to a normal value
-    ///
-    /// This method requires the current value to be null.
-    pub fn set_normal(&mut self) {
-        self.set_valueless_unit(nsCSSUnit::eCSSUnit_Normal);
-    }
-
-    fn set_string_internal(&mut self, s: &str, unit: nsCSSUnit) {
-        unsafe { bindings::Gecko_CSSValue_SetString(self, s.as_ptr(), s.len() as u32, unit) }
-    }
-
-    fn set_string_from_atom_internal(&mut self, s: &Atom, unit: nsCSSUnit) {
-        unsafe { bindings::Gecko_CSSValue_SetStringFromAtom(self, s.as_ptr(), unit) }
-    }
-
-    /// Set to a string value
-    pub fn set_string(&mut self, s: &str) {
-        self.set_string_internal(s, nsCSSUnit::eCSSUnit_String)
-    }
-
-    /// Set to a string value from the given atom
-    pub fn set_string_from_atom(&mut self, s: &Atom) {
-        self.set_string_from_atom_internal(s, nsCSSUnit::eCSSUnit_String)
-    }
-
-    /// Set to a ident value from the given atom
-    pub fn set_ident_from_atom(&mut self, s: &Atom) {
-        self.set_string_from_atom_internal(s, nsCSSUnit::eCSSUnit_Ident)
-    }
-
-    /// Set to an identifier value
-    pub fn set_ident(&mut self, s: &str) {
-        self.set_string_internal(s, nsCSSUnit::eCSSUnit_Ident)
-    }
-
-    /// Set to an atom identifier value
-    pub fn set_atom_ident(&mut self, s: Atom) {
-        unsafe { bindings::Gecko_CSSValue_SetAtomIdent(self, s.into_addrefed()) }
-    }
-
-    fn set_int_internal(&mut self, value: i32, unit: nsCSSUnit) {
-        unsafe { bindings::Gecko_CSSValue_SetInt(self, value, unit) }
-    }
-
-    /// Set to an integer value
-    pub fn set_integer(&mut self, value: i32) {
-        self.set_int_internal(value, nsCSSUnit::eCSSUnit_Integer)
-    }
-
-    /// Set to an enumerated value
-    pub fn set_enum<T: Into<i32>>(&mut self, value: T) {
-        self.set_int_internal(value.into(), nsCSSUnit::eCSSUnit_Enumerated);
-    }
-
-    /// Set to a number value
-    pub fn set_number(&mut self, number: f32) {
-        unsafe { bindings::Gecko_CSSValue_SetFloat(self, number, nsCSSUnit::eCSSUnit_Number) }
-    }
-
-    /// Set to an array of given length
-    pub fn set_array(&mut self, len: i32) -> &mut nsCSSValue_Array {
-        unsafe { bindings::Gecko_CSSValue_SetArray(self, len) }
-        unsafe { self.mValue.mArray.as_mut().as_mut() }.unwrap()
-    }
-
-    /// Generic set from any value that implements the ToNsCssValue trait.
-    pub fn set_from<T: ToNsCssValue>(&mut self, value: T) {
-        value.convert(self)
-    }
-
-    /// Returns an `Angle` value from this `nsCSSValue`.
-    ///
-    /// Panics if the unit is not `eCSSUnit_Degree`.
-    #[inline]
-    pub fn get_angle(&self) -> Angle {
-        debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_Degree);
-        Angle::from_degrees(self.float_unchecked())
-    }
-
-    /// Sets Angle value to this nsCSSValue.
-    pub fn set_angle(&mut self, angle: Angle) {
-        debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_Null);
-        self.mUnit = nsCSSUnit::eCSSUnit_Degree;
-        unsafe {
-            *self.mValue.mFloat.as_mut() = angle.degrees();
-        }
-    }
-
-    /// Set to a pair value
-    ///
-    /// This is only supported on the main thread.
-    pub fn set_pair(&mut self, x: &nsCSSValue, y: &nsCSSValue) {
-        unsafe { bindings::Gecko_CSSValue_SetPair(self, x, y) }
-    }
-
-    /// Set to a list value
-    ///
-    /// This is only supported on the main thread.
-    pub fn set_list<I>(&mut self, values: I)
-    where
-        I: ExactSizeIterator<Item = nsCSSValue>,
-    {
-        debug_assert!(values.len() > 0, "Empty list is not supported");
-        unsafe {
-            bindings::Gecko_CSSValue_SetList(self, values.len() as u32);
-        }
-        debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_List);
-        let list: &mut structs::nsCSSValueList = &mut unsafe {
-            self.mValue
-                .mList
-                .as_ref() // &*nsCSSValueList_heap
-                .as_mut()
-                .expect("List pointer should be non-null")
-        }
-        ._base;
-        for (item, new_value) in list.into_iter().zip(values) {
-            *item = new_value;
-        }
-    }
-
-    /// Set to a pair list value
-    ///
-    /// This is only supported on the main thread.
-    pub fn set_pair_list<I>(&mut self, mut values: I)
-    where
-        I: ExactSizeIterator<Item = (nsCSSValue, nsCSSValue)>,
-    {
-        debug_assert!(values.len() > 0, "Empty list is not supported");
-        unsafe {
-            bindings::Gecko_CSSValue_SetPairList(self, values.len() as u32);
-        }
-        debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_PairList);
-        let mut item_ptr = &mut unsafe {
-            self.mValue
-                .mPairList
-                .as_ref() // &*nsCSSValuePairList_heap
-                .as_mut()
-                .expect("List pointer should be non-null")
-        }
-        ._base as *mut structs::nsCSSValuePairList;
-        while let Some(item) = unsafe { item_ptr.as_mut() } {
-            let value = values.next().expect("Values shouldn't have been exhausted");
-            item.mXValue = value.0;
-            item.mYValue = value.1;
-            item_ptr = item.mNext;
-        }
-        debug_assert!(values.next().is_none(), "Values should have been exhausted");
-    }
-}
-
-impl Drop for nsCSSValue {
-    fn drop(&mut self) {
-        unsafe { bindings::Gecko_CSSValue_Drop(self) };
-    }
-}
-
-/// Iterator of nsCSSValueList.
-#[allow(non_camel_case_types)]
-pub struct nsCSSValueListIterator<'a> {
-    current: Option<&'a nsCSSValueList>,
-}
-
-impl<'a> Iterator for nsCSSValueListIterator<'a> {
-    type Item = &'a nsCSSValue;
-    fn next(&mut self) -> Option<Self::Item> {
-        match self.current {
-            Some(item) => {
-                self.current = unsafe { item.mNext.as_ref() };
-                Some(&item.mValue)
-            },
-            None => None,
-        }
-    }
-}
-
-impl<'a> IntoIterator for &'a nsCSSValueList {
-    type Item = &'a nsCSSValue;
-    type IntoIter = nsCSSValueListIterator<'a>;
-
-    fn into_iter(self) -> Self::IntoIter {
-        nsCSSValueListIterator {
-            current: Some(self),
-        }
-    }
-}
-
-/// Mutable Iterator of nsCSSValueList.
-#[allow(non_camel_case_types)]
-pub struct nsCSSValueListMutIterator<'a> {
-    current: *mut nsCSSValueList,
-    phantom: PhantomData<&'a mut nsCSSValue>,
-}
-
-impl<'a> Iterator for nsCSSValueListMutIterator<'a> {
-    type Item = &'a mut nsCSSValue;
-    fn next(&mut self) -> Option<Self::Item> {
-        match unsafe { self.current.as_mut() } {
-            Some(item) => {
-                self.current = item.mNext;
-                Some(&mut item.mValue)
-            },
-            None => None,
-        }
-    }
-}
-
-impl<'a> IntoIterator for &'a mut nsCSSValueList {
-    type Item = &'a mut nsCSSValue;
-    type IntoIter = nsCSSValueListMutIterator<'a>;
-
-    fn into_iter(self) -> Self::IntoIter {
-        nsCSSValueListMutIterator {
-            current: self as *mut nsCSSValueList,
-            phantom: PhantomData,
-        }
-    }
-}
-
-impl nsCSSValue_Array {
-    /// Return the length of this `nsCSSValue::Array`
-    #[inline]
-    pub fn len(&self) -> usize {
-        self.mCount
-    }
-
-    #[inline]
-    fn buffer(&self) -> *const nsCSSValue {
-        self.mArray.as_ptr()
-    }
-
-    /// Get the array as a slice of nsCSSValues.
-    #[inline]
-    pub fn as_slice(&self) -> &[nsCSSValue] {
-        unsafe { slice::from_raw_parts(self.buffer(), self.len()) }
-    }
-
-    /// Get the array as a mutable slice of nsCSSValues.
-    #[inline]
-    pub fn as_mut_slice(&mut self) -> &mut [nsCSSValue] {
-        unsafe { slice::from_raw_parts_mut(self.buffer() as *mut _, self.len()) }
-    }
-}
-
-impl Index<usize> for nsCSSValue_Array {
-    type Output = nsCSSValue;
-    #[inline]
-    fn index(&self, i: usize) -> &nsCSSValue {
-        &self.as_slice()[i]
-    }
-}
-
-impl IndexMut<usize> for nsCSSValue_Array {
-    #[inline]
-    fn index_mut(&mut self, i: usize) -> &mut nsCSSValue {
-        &mut self.as_mut_slice()[i]
-    }
-}
-
-/// Generic conversion to nsCSSValue
-pub trait ToNsCssValue {
-    /// Convert
-    fn convert(self, nscssvalue: &mut nsCSSValue);
-}
-
-impl<T: ToNsCssValue> From<T> for nsCSSValue {
-    fn from(value: T) -> nsCSSValue {
-        let mut result = nsCSSValue::null();
-        value.convert(&mut result);
-        result
-    }
-}
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -3212,34 +3212,16 @@ macro_rules! counter_style_descriptors {
         valid: [
             $($desc:ident => $getter:ident / $setter:ident,)+
         ]
         invalid: [
             $($i_desc:ident,)+
         ]
     } => {
         #[no_mangle]
-        pub unsafe extern "C" fn Servo_CounterStyleRule_GetDescriptor(
-            rule: &RawServoCounterStyleRule,
-            desc: nsCSSCounterDesc,
-            result: &mut structs::nsCSSValue,
-        ) {
-            read_locked_arc(rule, |rule: &CounterStyleRule| {
-                match desc {
-                    $(nsCSSCounterDesc::$desc => {
-                        if let Some(value) = rule.$getter() {
-                            result.set_from(value);
-                        }
-                    })+
-                    $(nsCSSCounterDesc::$i_desc => unreachable!(),)+
-                }
-            });
-        }
-
-        #[no_mangle]
         pub unsafe extern "C" fn Servo_CounterStyleRule_GetDescriptorCssText(
             rule: &RawServoCounterStyleRule,
             desc: nsCSSCounterDesc,
             result: *mut nsAString,
         ) {
             let mut writer = CssWriter::new(result.as_mut().unwrap());
             read_locked_arc(rule, |rule: &CounterStyleRule| {
                 match desc {