Bug 1367615 - Part 3: Implement ServoStyleRule::GetSelectorCount and GetSelectorText. r?emilio
MozReview-Commit-ID: 9MIY9ing11V
--- 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