Bug 1394994 - stylo: get line and column for ServoKeyframeRule. r=xidorn
authorJeremy Chen <jeremychen@mozilla.com>
Mon, 04 Sep 2017 13:38:23 +0800
changeset 428435 6774e07b2fc98e7927e25902ee5f7272271535fc
parent 428434 1c4eec5a5b96628d05f6a23d40f133ced629c5a0
child 428436 c549d5f5fe6d172db7a7fb8fd524ccf77b6730f3
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1394994
milestone57.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 1394994 - stylo: get line and column for ServoKeyframeRule. r=xidorn The Servo_KeyframesRule_GetKeyframe binding function has been empowerd and renamed to Servo_KeyframesRule_GetKeyframeAt in the servo side patch. In this patch, we use Servo_KeyframesRule_GetKeyframeAt to get line and column information for ServoKeyframeRule, so that the inspector can present Keyframe rules on the devtool panel properly. MozReview-Commit-ID: BGd9FFsC3Nz
layout/style/ServoBindingList.h
layout/style/ServoKeyframeRule.h
layout/style/ServoKeyframesRule.cpp
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -221,18 +221,19 @@ SERVO_BINDING_FUNC(Servo_Keyframe_SetSty
                    RawServoDeclarationBlockBorrowed declarations)
 SERVO_BINDING_FUNC(Servo_KeyframesRule_GetName, nsIAtom*,
                    RawServoKeyframesRuleBorrowed rule)
 // This method takes an addrefed nsIAtom.
 SERVO_BINDING_FUNC(Servo_KeyframesRule_SetName, void,
                    RawServoKeyframesRuleBorrowed rule, nsIAtom* name)
 SERVO_BINDING_FUNC(Servo_KeyframesRule_GetCount, uint32_t,
                    RawServoKeyframesRuleBorrowed rule)
-SERVO_BINDING_FUNC(Servo_KeyframesRule_GetKeyframe, RawServoKeyframeStrong,
-                   RawServoKeyframesRuleBorrowed rule, uint32_t index)
+SERVO_BINDING_FUNC(Servo_KeyframesRule_GetKeyframeAt, RawServoKeyframeStrong,
+                   RawServoKeyframesRuleBorrowed rule, uint32_t index,
+                   uint32_t* line, uint32_t* column)
 // Returns the index of the rule, max value of uint32_t if nothing found.
 SERVO_BINDING_FUNC(Servo_KeyframesRule_FindRule, uint32_t,
                    RawServoKeyframesRuleBorrowed rule, const nsACString* key)
 // Returns whether it successfully appends the rule.
 SERVO_BINDING_FUNC(Servo_KeyframesRule_AppendRule, bool,
                    RawServoKeyframesRuleBorrowed rule,
                    RawServoStyleSheetContentsBorrowed sheet,
                    const nsACString* css)
--- a/layout/style/ServoKeyframeRule.h
+++ b/layout/style/ServoKeyframeRule.h
@@ -13,18 +13,19 @@
 namespace mozilla {
 
 class ServoDeclarationBlock;
 class ServoKeyframeDeclaration;
 
 class ServoKeyframeRule final : public dom::CSSKeyframeRule
 {
 public:
-  explicit ServoKeyframeRule(already_AddRefed<RawServoKeyframe> aRaw)
-    : CSSKeyframeRule(0, 0)
+  ServoKeyframeRule(already_AddRefed<RawServoKeyframe> aRaw,
+                    uint32_t aLine, uint32_t aColumn)
+    : CSSKeyframeRule(aLine, aColumn)
     , mRaw(aRaw) {}
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServoKeyframeRule,
                                            dom::CSSKeyframeRule)
 
   bool IsCCLeaf() const final;
 #ifdef DEBUG
--- a/layout/style/ServoKeyframesRule.cpp
+++ b/layout/style/ServoKeyframesRule.cpp
@@ -48,21 +48,25 @@ public:
       }
     }
   }
 
   ServoStyleSheet* GetParentObject() final { return mStyleSheet; }
 
   ServoKeyframeRule* GetRule(uint32_t aIndex) {
     if (!mRules[aIndex]) {
-      ServoKeyframeRule* rule = new ServoKeyframeRule(
-        Servo_KeyframesRule_GetKeyframe(mRawRule, aIndex).Consume());
-      mRules.ReplaceObjectAt(rule, aIndex);
-      rule->SetStyleSheet(mStyleSheet);
-      rule->SetParentRule(mParentRule);
+      uint32_t line = 0, column = 0;
+      RefPtr<RawServoKeyframe> rule =
+        Servo_KeyframesRule_GetKeyframeAt(mRawRule, aIndex,
+                                          &line, &column).Consume();
+      ServoKeyframeRule* ruleObj =
+        new ServoKeyframeRule(rule.forget(), line, column);
+      mRules.ReplaceObjectAt(ruleObj, aIndex);
+      ruleObj->SetStyleSheet(mStyleSheet);
+      ruleObj->SetParentRule(mParentRule);
     }
     return static_cast<ServoKeyframeRule*>(mRules[aIndex]);
   }
 
   ServoKeyframeRule* IndexedGetter(uint32_t aIndex, bool& aFound) final
   {
     if (aIndex >= mRules.Length()) {
       aFound = false;