Bug 1343964 part 6 - Add a const Rule() method for ServoStyleRule. r=heycam
authorXidorn Quan <me@upsuper.org>
Tue, 04 Apr 2017 16:07:44 +1000
changeset 558304 6caf71be30105744bf95823fd99b6f4b95a13250
parent 558303 78aed6715e29dd37b34cd32ec6d51dad1b2816fa
child 558305 905554c0bc813b3de1098bea21cef3f7ae7adcd0
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +0000
reviewersheycam
bugs1343964
milestone55.0a1
Bug 1343964 part 6 - Add a const Rule() method for ServoStyleRule. r=heycam MozReview-Commit-ID: 1rvWrN3Biut
layout/style/ServoStyleRule.h
--- a/layout/style/ServoStyleRule.h
+++ b/layout/style/ServoStyleRule.h
@@ -38,16 +38,17 @@ private:
   // For accessing the constructor.
   friend class ServoStyleRule;
 
   explicit ServoStyleRuleDeclaration(
     already_AddRefed<RawServoDeclarationBlock> aDecls);
   ~ServoStyleRuleDeclaration();
 
   inline ServoStyleRule* Rule();
+  inline const ServoStyleRule* Rule() const;
 
   RefPtr<ServoDeclarationBlock> mDecls;
 };
 
 class ServoStyleRule final : public BindingStyleRule
                            , public nsIDOMCSSStyleRule
 {
 public:
@@ -83,15 +84,22 @@ private:
 
   RefPtr<RawServoStyleRule> mRawRule;
   ServoStyleRuleDeclaration mDecls;
 };
 
 ServoStyleRule*
 ServoStyleRuleDeclaration::Rule()
 {
-  return reinterpret_cast<ServoStyleRule*>(reinterpret_cast<uint8_t*>(this) -
-                                           offsetof(ServoStyleRule, mDecls));
+  return reinterpret_cast<ServoStyleRule*>(
+    reinterpret_cast<uint8_t*>(this) - offsetof(ServoStyleRule, mDecls));
+}
+
+const ServoStyleRule*
+ServoStyleRuleDeclaration::Rule() const
+{
+  return reinterpret_cast<const ServoStyleRule*>(
+    reinterpret_cast<const uint8_t*>(this) - offsetof(ServoStyleRule, mDecls));
 }
 
 } // namespace mozilla
 
 #endif // mozilla_ServoStyleRule_h