Bug 1292432 part 3 - Add WillDirty and DidDirty to StyleSheet. r?heycam draft
authorXidorn Quan <me@upsuper.org>
Tue, 04 Oct 2016 15:45:55 +1100
changeset 423107 ad841dccaa65e322ea453d874688fc631e8d105d
parent 423106 0110eba244840cfbf56dd9449d1e24386a83327f
child 423108 68e1d8db6039e0ac683f1426f45ce400e1c9a37d
push id31799
push userxquan@mozilla.com
push dateMon, 10 Oct 2016 07:37:57 +0000
reviewersheycam
bugs1292432
milestone52.0a1
Bug 1292432 part 3 - Add WillDirty and DidDirty to StyleSheet. r?heycam MozReview-Commit-ID: 17O1vYVxuCk
layout/style/CSSStyleSheet.h
layout/style/ServoStyleSheet.h
layout/style/StyleSheet.h
layout/style/StyleSheetInlines.h
--- a/layout/style/CSSStyleSheet.h
+++ b/layout/style/CSSStyleSheet.h
@@ -249,19 +249,16 @@ public:
     if (mOwningNode) {
       return dom::ParentObject(mOwningNode);
     }
 
     return dom::ParentObject(static_cast<nsIDOMCSSStyleSheet*>(mParent), mParent);
   }
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
-  // Changes to sheets should be inside of a WillDirty-DidDirty pair.
-  // However, the calls do not need to be matched; it's ok to call
-  // WillDirty and then make no change and skip the DidDirty call.
   void WillDirty();
   void DidDirty();
 
 private:
   CSSStyleSheet(const CSSStyleSheet& aCopy,
                 CSSStyleSheet* aParentToUse,
                 css::ImportRule* aOwnerRuleToUse,
                 nsIDocument* aDocumentToUse,
--- a/layout/style/ServoStyleSheet.h
+++ b/layout/style/ServoStyleSheet.h
@@ -53,16 +53,19 @@ public:
 
   // nsIDOMStyleSheet interface
   NS_IMETHOD GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) final;
   NS_IMETHOD GetMedia(nsIDOMMediaList** aMedia) final;
 
   // nsIDOMCSSStyleSheet interface
   NS_DECL_NSIDOMCSSSTYLESHEET
 
+  void WillDirty() {}
+  void DidDirty() {}
+
 protected:
   ~ServoStyleSheet();
 
 private:
   void DropSheet();
 
   RefPtr<RawServoStyleSheet> mSheet;
 };
--- a/layout/style/StyleSheet.h
+++ b/layout/style/StyleSheet.h
@@ -142,16 +142,22 @@ public:
   // nsIDOMStyleSheet interface
   NS_IMETHOD GetType(nsAString& aType) final;
   NS_IMETHOD GetDisabled(bool* aDisabled) final;
   NS_IMETHOD SetDisabled(bool aDisabled) final;
   NS_IMETHOD GetOwnerNode(nsIDOMNode** aOwnerNode) final;
   NS_IMETHOD GetHref(nsAString& aHref) final;
   NS_IMETHOD GetTitle(nsAString& aTitle) final;
 
+  // Changes to sheets should be inside of a WillDirty-DidDirty pair.
+  // However, the calls do not need to be matched; it's ok to call
+  // WillDirty and then make no change and skip the DidDirty call.
+  inline void WillDirty();
+  inline void DidDirty();
+
 private:
   // Get a handle to the various stylesheet bits which live on the 'inner' for
   // gecko stylesheets and live on the StyleSheet for Servo stylesheets.
   inline StyleSheetInfo& SheetInfo();
   inline const StyleSheetInfo& SheetInfo() const;
 
 protected:
   nsString              mTitle;
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -199,16 +199,19 @@ StyleSheet::SizeOfIncludingThis(MallocSi
 #ifdef DEBUG
 void
 StyleSheet::List(FILE* aOut, int32_t aIndex) const
 {
   FORWARD(List, (aOut, aIndex))
 }
 #endif
 
+void StyleSheet::WillDirty() { FORWARD(WillDirty, ()) }
+void StyleSheet::DidDirty() { FORWARD(DidDirty, ()) }
+
 #undef FORWARD
 #undef FORWARD_CONCRETE
 
 inline void
 ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
                             RefPtr<StyleSheet>& aField,
                             const char* aName,
                             uint32_t aFlags = 0)