From 494d25ee081c23616d611812f860d55aaae7a81a Mon Sep 17 00:00:00 2001 From: Fernando Jimenez Moreno Date: Wed, 7 Jun 2017 17:48:49 +0200 Subject: [PATCH] Bug 1367615 - Part 3: Implement ServoStyleRule::GetSelectorCount and GetSelectorText. r=emilio MozReview-Commit-ID: 9MIY9ing11V --HG-- extra : rebase_source : f51e5bef0ea87a78677a08fbd93cdadcc6c9905d --- layout/style/ServoBindingList.h | 5 +++++ layout/style/ServoStyleRule.cpp | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h index e857919cc203..c4c1eb63d85c 100644 --- a/layout/style/ServoBindingList.h +++ b/layout/style/ServoBindingList.h @@ -147,6 +147,11 @@ SERVO_BINDING_FUNC(Servo_StyleRule_SetStyle, void, 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*, diff --git a/layout/style/ServoStyleRule.cpp b/layout/style/ServoStyleRule.cpp index 39f797b6eb4a..6aa76d6d2cf9 100644 --- a/layout/style/ServoStyleRule.cpp +++ b/layout/style/ServoStyleRule.cpp @@ -253,18 +253,23 @@ ServoStyleRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle) 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; } @@ -274,6 +279,7 @@ ServoStyleRule::SelectorMatchesElement(Element* aElement, const nsAString& aPseudo, bool* aMatches) { + // TODO Bug 1370502 return NS_OK; }