Bug 1331316 - stylo: support 1-arg CSS.supports(); r?heycam draft
authorManish Goregaokar <manishearth@gmail.com>
Sun, 15 Jan 2017 23:09:42 -0800
changeset 461250 3af624b1565f3518549a854141aa929cab2bc2d8
parent 459259 63ad56438630b389efdb01632e153143cf3008ec
child 542263 e56aa89bb5ff529fc5d29106571e4a82cf6a9137
push id41615
push userbmo:manishearth@gmail.com
push dateMon, 16 Jan 2017 08:46:12 +0000
reviewersheycam
bugs1331316
milestone53.0a1
Bug 1331316 - stylo: support 1-arg CSS.supports(); r?heycam MozReview-Commit-ID: 8di024Rxttn
layout/style/CSS.cpp
layout/style/ServoBindingList.h
--- a/layout/style/CSS.cpp
+++ b/layout/style/CSS.cpp
@@ -60,17 +60,17 @@ CSS::Supports(const GlobalObject& aGloba
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return false;
   }
 
   if (info.mStyleBackendType == StyleBackendType::Servo) {
     NS_ConvertUTF16toUTF8 property(aProperty);
     NS_ConvertUTF16toUTF8 value(aValue);
-    return Servo_CSSSupports(&property, &value);
+    return Servo_CSSSupports2(&property, &value);
   }
 
   nsCSSParser parser;
   return parser.EvaluateSupportsDeclaration(aProperty, aValue, info.mDocURI,
                                             info.mBaseURI, info.mPrincipal);
 }
 
 /* static */ bool
@@ -82,17 +82,18 @@ CSS::Supports(const GlobalObject& aGloba
 
   nsresult rv = GetParsingInfo(aGlobal, info);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return false;
   }
 
   if (info.mStyleBackendType == StyleBackendType::Servo) {
-    MOZ_CRASH("stylo: CSS.supports() with arguments is not yet implemented");
+    NS_ConvertUTF16toUTF8 cond(aCondition);
+    return Servo_CSSSupports(&cond);
   }
 
   nsCSSParser parser;
   return parser.EvaluateSupportsCondition(aCondition, info.mDocURI,
                                           info.mBaseURI, info.mPrincipal);
 }
 
 /* static */ void
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -148,18 +148,20 @@ SERVO_BINDING_FUNC(Servo_DeclarationBloc
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemoveProperty, void,
                    RawServoDeclarationBlockBorrowed declarations,
                    const nsACString* property)
 SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemovePropertyById, void,
                    RawServoDeclarationBlockBorrowed declarations,
                    nsCSSPropertyID property)
 
 // CSS supports()
+SERVO_BINDING_FUNC(Servo_CSSSupports2, bool,
+                   const nsACString* name, const nsACString* value)
 SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
-                   const nsACString* name, const nsACString* value)
+                   const nsACString* cond)
 
 // Computed style data
 SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
                    ServoComputedValuesStrong,
                    ServoComputedValuesBorrowedOrNull parent_style_or_null,
                    nsIAtom* pseudoTag, RawServoStyleSetBorrowed set)
 SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
                    RawServoStyleSetBorrowed set,