Bug 1420117 - Part 1: Add a ServoCSSParser::ParseCounterStyleName method. r=xidorn
☠☠ backed out by ef99e0f85f43 ☠ ☠
authorCameron McCormack <cam@mcc.id.au>
Fri, 24 Nov 2017 15:52:26 +0800
changeset 394925 f7292e7fee0e84e26a164cbbe2a38f5eedf44ceb
parent 394924 3881a65bd690ded3723d43e65123de00ad22fc9d
child 394926 83b36cccea28a9b130d3b2ba9c69fb793618ee67
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 1: Add a ServoCSSParser::ParseCounterStyleName method. r=xidorn MozReview-Commit-ID: DAaUi5lLrFS
layout/style/ServoBindingList.h
layout/style/ServoCSSParser.cpp
layout/style/ServoCSSParser.h
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -750,15 +750,17 @@ SERVO_BINDING_FUNC(Servo_ParseIntersecti
                    nsCSSRect* result);
 // Returning false means the parsed transform contains relative lengths or
 // 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);
 
 // 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/ServoCSSParser.cpp
+++ b/layout/style/ServoCSSParser.cpp
@@ -27,8 +27,16 @@ ServoCSSParser::ComputeColor(ServoStyleS
 }
 
 /* static */ bool
 ServoCSSParser::ParseIntersectionObserverRootMargin(const nsAString& aValue,
                                                     nsCSSRect* aResult)
 {
   return Servo_ParseIntersectionObserverRootMargin(&aValue, aResult);
 }
+
+/* static */ already_AddRefed<nsAtom>
+ServoCSSParser::ParseCounterStyleName(const nsAString& aValue)
+{
+  NS_ConvertUTF16toUTF8 value(aValue);
+  nsAtom* atom = Servo_ParseCounterStyleName(&value);
+  return already_AddRefed<nsAtom>(atom);
+}
--- a/layout/style/ServoCSSParser.h
+++ b/layout/style/ServoCSSParser.h
@@ -44,13 +44,22 @@ public:
    * property.
    *
    * @param aValue The rootMargin value.
    * @param aResult The nsCSSRect object to write the result into.
    * @return Whether the value was successfully parsed.
    */
   static bool ParseIntersectionObserverRootMargin(const nsAString& aValue,
                                                   nsCSSRect* aResult);
+
+  /**
+   * 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);
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ServoCSSParser_h