Bug 1420117 - Part 4: Use Servo CSS parser in nsCSSCounterStyleRule::SetDescriptor. r=xidorn
☠☠ backed out by ef99e0f85f43 ☠ ☠
authorCameron McCormack <cam@mcc.id.au>
Fri, 24 Nov 2017 17:26:57 +0800
changeset 394960 2560a150250d769e02fa843d4f254e347dba11ff
parent 394959 5cceea9740eb4ab884d133f5e5ed8de14e0b0db0
child 394961 09d9f11e8264d797651d5cf39111bf1053864a5d
push id97987
push usernerli@mozilla.com
push dateTue, 05 Dec 2017 13:52:50 +0000
treeherdermozilla-inbound@8842dba7396b [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 4: Use Servo CSS parser in nsCSSCounterStyleRule::SetDescriptor. r=xidorn MozReview-Commit-ID: GNJMe4kGQPB
layout/style/nsCSSCounterStyleRule.cpp
--- a/layout/style/nsCSSCounterStyleRule.cpp
+++ b/layout/style/nsCSSCounterStyleRule.cpp
@@ -407,30 +407,43 @@ nsCSSCounterStyleRule::CheckDescValue(in
       return true;
   }
 }
 
 nsresult
 nsCSSCounterStyleRule::SetDescriptor(nsCSSCounterDesc aDescID,
                                      const nsAString& aValue)
 {
-  nsCSSParser parser;
   nsCSSValue value;
-  nsIURI* baseURL = nullptr;
-  nsIPrincipal* principal = nullptr;
-  if (StyleSheet* sheet = GetStyleSheet()) {
-    baseURL = sheet->GetBaseURI();
-    principal = sheet->Principal();
+  bool ok;
+
+  StyleSheet* sheet = GetStyleSheet();
+
+#ifdef MOZ_STYLO
+  bool useServo = !sheet || sheet->IsServo();
+#else
+  bool useServo = false;
+#endif
+
+  if (useServo) {
+    URLExtraData* data = sheet ? sheet->AsServo()->URLData() : nullptr;
+    ok = ServoCSSParser::ParseCounterStyleDescriptor(aDescID, aValue, data,
+                                                     value);
+  } else {
+    nsCSSParser parser;
+    nsIURI* baseURL = sheet ? sheet->GetBaseURI() : nullptr;
+    nsIPrincipal* principal = sheet ? sheet->Principal() : nullptr;
+    ok = parser.ParseCounterDescriptor(aDescID, aValue, nullptr,
+                                       baseURL, principal, value);
   }
-  if (parser.ParseCounterDescriptor(aDescID, aValue, nullptr,
-                                    baseURL, principal, value)) {
-    if (CheckDescValue(GetSystem(), aDescID, value)) {
-      SetDesc(aDescID, value);
-    }
+
+  if (ok && CheckDescValue(GetSystem(), aDescID, value)) {
+    SetDesc(aDescID, value);
   }
+
   return NS_OK;
 }
 
 #define CSS_COUNTER_DESC_SETTER(name_)                        \
 NS_IMETHODIMP                                                 \
 nsCSSCounterStyleRule::Set##name_(const nsAString& a##name_)  \
 {                                                             \
   return SetDescriptor(eCSSCounterDesc_##name_, a##name_);    \