Bug 1343964 part 6 - Add a const Rule() method for ServoStyleRule. r=heycam
MozReview-Commit-ID: 1rvWrN3Biut
--- 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