Bug 1420117 - Part 3: Add a ServoCSSParser::ParseCounterStyleDescriptor method. r=xidorn
☠☠ backed out by ef99e0f85f43 ☠ ☠
authorCameron McCormack <cam@mcc.id.au>
Fri, 24 Nov 2017 17:26:41 +0800
changeset 394927 5cceea9740eb4ab884d133f5e5ed8de14e0b0db0
parent 394926 83b36cccea28a9b130d3b2ba9c69fb793618ee67
child 394928 2560a150250d769e02fa843d4f254e347dba11ff
push id33025
push usershindli@mozilla.com
push dateTue, 05 Dec 2017 09:57:50 +0000
treeherdermozilla-central@390c1aad9d4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1420117
milestone59.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 1420117 - Part 3: Add a ServoCSSParser::ParseCounterStyleDescriptor method. r=xidorn MozReview-Commit-ID: LHBZ4j1Ji9R
layout/style/ServoBindingList.h
layout/style/ServoBindings.toml
layout/style/ServoCSSParser.cpp
layout/style/ServoCSSParser.h
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -752,15 +752,20 @@ SERVO_BINDING_FUNC(Servo_ParseIntersecti
 // percentage value, so we cannot compute the matrix. In this case, we keep
 // |result| and |contains_3d_transform| as-is.
 SERVO_BINDING_FUNC(Servo_ParseTransformIntoMatrix, bool,
                    const nsAString* value,
                    bool* contains_3d_transform,
                    RawGeckoGfxMatrix4x4* result);
 SERVO_BINDING_FUNC(Servo_ParseCounterStyleName, nsAtom*,
                    const nsACString* value);
+SERVO_BINDING_FUNC(Servo_ParseCounterStyleDescriptor, bool,
+                   nsCSSCounterDesc aDescriptor,
+                   const nsACString* aValue,
+                   RawGeckoURLExtraData* aURLExtraData,
+                   nsCSSValue* aResult);
 
 // AddRef / Release functions
 #define SERVO_ARC_TYPE(name_, type_)                                \
   SERVO_BINDING_FUNC(Servo_##name_##_AddRef, void, type_##Borrowed) \
   SERVO_BINDING_FUNC(Servo_##name_##_Release, void, type_##Borrowed)
 #include "mozilla/ServoArcTypeList.h"
 #undef SERVO_ARC_TYPE
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -512,16 +512,17 @@ structs-types = [
     "ServoElementSnapshot",
     "ServoElementSnapshotTable",
     "ServoStyleSetSizes",
     "SheetParsingMode",
     "StyleBasicShapeType",
     "StyleShapeSource",
     "StyleTransition",
     "gfxFontFeatureValueSet",
+    "nsCSSCounterDesc",
     "nsCSSCounterStyleRule",
     "nsCSSFontFaceRule",
     "nsCSSKeyword",
     "nsCSSPropertyID",
     "nsCSSPropertyIDSet",
     "nsCSSRect",
     "nsCSSShadowArray",
     "nsCSSUnit",
--- a/layout/style/ServoCSSParser.cpp
+++ b/layout/style/ServoCSSParser.cpp
@@ -35,8 +35,19 @@ ServoCSSParser::ParseIntersectionObserve
 
 /* static */ already_AddRefed<nsAtom>
 ServoCSSParser::ParseCounterStyleName(const nsAString& aValue)
 {
   NS_ConvertUTF16toUTF8 value(aValue);
   nsAtom* atom = Servo_ParseCounterStyleName(&value);
   return already_AddRefed<nsAtom>(atom);
 }
+
+/* static */ bool
+ServoCSSParser::ParseCounterStyleDescriptor(nsCSSCounterDesc aDescriptor,
+                                            const nsAString& aValue,
+                                            URLExtraData* aURLExtraData,
+                                            nsCSSValue& aResult)
+{
+  NS_ConvertUTF16toUTF8 value(aValue);
+  return Servo_ParseCounterStyleDescriptor(aDescriptor, &value, aURLExtraData,
+                                           &aResult);
+}
--- a/layout/style/ServoCSSParser.h
+++ b/layout/style/ServoCSSParser.h
@@ -53,13 +53,29 @@ public:
   /**
    * Parses a @counter-style name.
    *
    * @param aValue The name to parse.
    * @return The name as an atom, lowercased if a built-in counter style name,
    *   or nullptr if parsing failed or if the name was invalid (like "inherit").
    */
   static already_AddRefed<nsAtom> ParseCounterStyleName(const nsAString& aValue);
+
+  /**
+   * Parses a @counter-style descriptor.
+   *
+   * @param aDescriptor The descriptor to parse.
+   * @param aValue The value of the descriptor.
+   * @param aURLExtraData URL data for parsing. This would be used for
+   *   image value URL resolution.
+   * @param aResult The nsCSSValue to store the result in.
+   * @return Whether parsing succeeded.
+   */
+  static bool
+  ParseCounterStyleDescriptor(nsCSSCounterDesc aDescriptor,
+                              const nsAString& aValue,
+                              URLExtraData* aURLExtraData,
+                              nsCSSValue& aResult);
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ServoCSSParser_h