Bug 1367615 - Part 3: Implement ServoStyleRule::GetSelectorCount and GetSelectorText. r=emilio
authorFernando Jimenez Moreno <ferjmoreno@gmail.com>
Wed, 07 Jun 2017 17:48:49 +0200
changeset 413329 763730b2f816122b2bef3897325ea46099d2930c
parent 413328 b1df5d005cafbab39ab41edad24791d7bbbd3bfc
child 413330 814a9b5ef1866c988b6d97490f305d5a246b44c2
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1367615
milestone55.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 1367615 - Part 3: Implement ServoStyleRule::GetSelectorCount and GetSelectorText. r=emilio MozReview-Commit-ID: 9MIY9ing11V
layout/style/ServoBindingList.h
layout/style/ServoStyleRule.cpp
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -142,16 +142,21 @@ SERVO_BINDING_FUNC(Servo_CssRules_GetCou
                    ServoCssRulesBorrowed rules, uint32_t index)
 SERVO_BINDING_FUNC(Servo_StyleRule_GetStyle, RawServoDeclarationBlockStrong,
                    RawServoStyleRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_StyleRule_SetStyle, void,
                    RawServoStyleRuleBorrowed rule,
                    RawServoDeclarationBlockBorrowed declarations)
 SERVO_BINDING_FUNC(Servo_StyleRule_GetSelectorText, void,
                    RawServoStyleRuleBorrowed rule, nsAString* result)
+SERVO_BINDING_FUNC(Servo_StyleRule_GetSelectorTextFromIndex, void,
+                   RawServoStyleRuleBorrowed rule, uint32_t index,
+                   nsAString* result)
+SERVO_BINDING_FUNC(Servo_StyleRule_GetSelectorCount, void,
+                   RawServoStyleRuleBorrowed rule, uint32_t* count)
 SERVO_BINDING_FUNC(Servo_ImportRule_GetHref, void,
                    RawServoImportRuleBorrowed rule, nsAString* result)
 SERVO_BINDING_FUNC(Servo_ImportRule_GetSheet, const RawServoStyleSheet*,
                    RawServoImportRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_Keyframe_GetKeyText, void,
                    RawServoKeyframeBorrowed keyframe, nsAString* result)
 // Returns whether it successfully changes the key text.
 SERVO_BINDING_FUNC(Servo_Keyframe_SetKeyText, bool,
--- a/layout/style/ServoStyleRule.cpp
+++ b/layout/style/ServoStyleRule.cpp
@@ -248,33 +248,39 @@ ServoStyleRule::GetStyle(nsIDOMCSSStyleD
 {
   *aStyle = do_AddRef(&mDecls).take();
   return NS_OK;
 }
 
 uint32_t
 ServoStyleRule::GetSelectorCount()
 {
-  return 0;
+  uint32_t aCount;
+  Servo_StyleRule_GetSelectorCount(mRawRule, &aCount);
+
+  return aCount;
 }
 
 nsresult
 ServoStyleRule::GetSelectorText(uint32_t aSelectorIndex, nsAString& aText)
 {
+  Servo_StyleRule_GetSelectorTextFromIndex(mRawRule, aSelectorIndex, &aText);
   return NS_OK;
 }
 
 nsresult
 ServoStyleRule::GetSpecificity(uint32_t aSelectorIndex, uint64_t* aSpecificity)
 {
+  // TODO Bug 1370501
   return NS_OK;
 }
 
 nsresult
 ServoStyleRule::SelectorMatchesElement(Element* aElement,
                                        uint32_t aSelectorIndex,
                                        const nsAString& aPseudo,
                                        bool* aMatches)
 {
+  // TODO Bug 1370502
   return NS_OK;
 }
 
 } // namespace mozilla