Bug 1359217 part 1 - Make document nsIDocumentObserver::StyleRule* methods include the rule as parameter. r=bz
authorXidorn Quan <me@upsuper.org>
Mon, 19 Jun 2017 15:45:43 +1000
changeset 596547 afa17cc4b6fda40bee856fe3eb40929b3d7b1c7f
parent 596546 d36b68e3873e751936b63cd85ee3220f33f07295
child 596548 8b0c62d6e9b7c749668d417e93c5b4a9ca9f098f
push id64675
push usermak77@bonardo.net
push dateMon, 19 Jun 2017 12:08:05 +0000
reviewersbz
bugs1359217
milestone56.0a1
Bug 1359217 part 1 - Make document nsIDocumentObserver::StyleRule* methods include the rule as parameter. r=bz MozReview-Commit-ID: H8FgiwCv0Gr
dom/base/nsDocument.cpp
dom/base/nsIDocumentObserver.h
layout/base/PresShell.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5402,45 +5402,45 @@ nsDocument::DocumentStatesChanged(EventS
 
   NS_DOCUMENT_NOTIFY_OBSERVERS(DocumentStatesChanged, (this, aStateMask));
 }
 
 void
 nsDocument::StyleRuleChanged(StyleSheet* aSheet,
                              css::Rule* aStyleRule)
 {
-  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleChanged, (aSheet));
+  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleChanged, (aSheet, aStyleRule));
 
   if (StyleSheetChangeEventsEnabled()) {
     DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
                                "StyleRuleChanged",
                                mRule,
                                aStyleRule);
   }
 }
 
 void
 nsDocument::StyleRuleAdded(StyleSheet* aSheet,
                            css::Rule* aStyleRule)
 {
-  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleAdded, (aSheet));
+  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleAdded, (aSheet, aStyleRule));
 
   if (StyleSheetChangeEventsEnabled()) {
     DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
                                "StyleRuleAdded",
                                mRule,
                                aStyleRule);
   }
 }
 
 void
 nsDocument::StyleRuleRemoved(StyleSheet* aSheet,
                              css::Rule* aStyleRule)
 {
-  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleRemoved, (aSheet));
+  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleRemoved, (aSheet, aStyleRule));
 
   if (StyleSheetChangeEventsEnabled()) {
     DO_STYLESHEET_NOTIFICATION(StyleRuleChangeEvent,
                                "StyleRuleRemoved",
                                mRule,
                                aStyleRule);
   }
 }
--- a/dom/base/nsIDocumentObserver.h
+++ b/dom/base/nsIDocumentObserver.h
@@ -130,40 +130,46 @@ public:
   /**
    * A StyleRule has just been modified within a style sheet.
    * This method is called automatically when the rule gets
    * modified. The style sheet passes this notification to 
    * the document. The notification is passed on to all of 
    * the document observers.
    *
    * @param aStyleSheet the StyleSheet that contians the rule
+   * @param aStyleRule the changed rule
    */
-  virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) = 0;
+  virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,
+                                mozilla::css::Rule* aStyleRule) = 0;
 
   /**
    * A StyleRule has just been added to a style sheet.
    * This method is called automatically when the rule gets
    * added to the sheet. The style sheet passes this
    * notification to the document. The notification is passed on 
    * to all of the document observers.
    *
    * @param aStyleSheet the StyleSheet that has been modified
+   * @param aStyleRule the added rule
    */
-  virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) = 0;
+  virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,
+                              mozilla::css::Rule* aStyleRule) = 0;
 
   /**
    * A StyleRule has just been removed from a style sheet.
    * This method is called automatically when the rule gets
    * removed from the sheet. The style sheet passes this
    * notification to the document. The notification is passed on 
    * to all of the document observers.
    *
    * @param aStyleSheet the StyleSheet that has been modified
+   * @param aStyleRule the removed rule
    */
-  virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) = 0;
+  virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,
+                                mozilla::css::Rule* aStyleRule) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE                              \
     virtual void BeginUpdate(nsIDocument* aDocument,                         \
                              nsUpdateType aUpdateType) override;
 
@@ -193,23 +199,26 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumen
     virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet,         \
                                    bool aDocumentSheet) override;
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETAPPLICABLESTATECHANGED         \
     virtual void StyleSheetApplicableStateChanged(                           \
         mozilla::StyleSheet* aStyleSheet) override;
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULECHANGED                         \
-    virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) override;
+    virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,          \
+                                  mozilla::css::Rule* aStyleRule) override;
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEADDED                           \
-    virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) override;
+    virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,            \
+                                mozilla::css::Rule* aStyleRule) override;
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEREMOVED                         \
-    virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) override;
+    virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,          \
+                                  mozilla::css::Rule* aStyleRule) override;
 
 #define NS_DECL_NSIDOCUMENTOBSERVER                                          \
     NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE                                  \
     NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE                                    \
     NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD                                    \
     NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD                                      \
     NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED                          \
     NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED                        \
@@ -271,21 +280,24 @@ void                                    
                           bool aDocumentSheet)                            \
 {                                                                         \
 }                                                                         \
 void                                                                      \
 _class::StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet)\
 {                                                                         \
 }                                                                         \
 void                                                                      \
-_class::StyleRuleChanged(mozilla::StyleSheet* aStyleSheet)                \
+_class::StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,                \
+                         mozilla::css::Rule* aStyleRule)                  \
 {                                                                         \
 }                                                                         \
 void                                                                      \
-_class::StyleRuleAdded(mozilla::StyleSheet* aStyleSheet)                  \
+_class::StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,                  \
+                       mozilla::css::Rule* aStyleRule)                    \
 {                                                                         \
 }                                                                         \
 void                                                                      \
-_class::StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet)                \
+_class::StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,                \
+                         mozilla::css::Rule* aStyleRule)                  \
 {                                                                         \
 }
 
 #endif /* nsIDocumentObserver_h___ */
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -4602,29 +4602,29 @@ PresShell::StyleSheetApplicableStateChan
 {
   if (aStyleSheet->HasRules()) {
     RecordStyleSheetChange(
         aStyleSheet, StyleSheet::ChangeType::ApplicableStateChanged);
   }
 }
 
 void
-PresShell::StyleRuleChanged(StyleSheet* aStyleSheet)
+PresShell::StyleRuleChanged(StyleSheet* aStyleSheet, css::Rule* aStyleRule)
 {
   RecordStyleSheetChange(aStyleSheet, StyleSheet::ChangeType::RuleChanged);
 }
 
 void
-PresShell::StyleRuleAdded(StyleSheet* aStyleSheet)
+PresShell::StyleRuleAdded(StyleSheet* aStyleSheet, css::Rule* aStyleRule)
 {
   RecordStyleSheetChange(aStyleSheet, StyleSheet::ChangeType::RuleAdded);
 }
 
 void
-PresShell::StyleRuleRemoved(StyleSheet* aStyleSheet)
+PresShell::StyleRuleRemoved(StyleSheet* aStyleSheet, css::Rule* aStyleRule)
 {
   RecordStyleSheetChange(aStyleSheet, StyleSheet::ChangeType::RuleRemoved);
 }
 
 nsresult
 PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
                           nscolor aBackgroundColor,
                           gfxContext* aThebesContext)