Bug 1459529: Remove some useless nsIDocumentObserver notifications. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 11 May 2018 18:36:36 +0200
changeset 418354 6695fc0e528919199981beefc16681badf486281
parent 418353 0c1c3fb200c0c7ba67fe99b06574e823709da712
child 418355 a40accc5c91c7272286c8792358c05a20cd29222
push id64004
push userecoal95@gmail.com
push dateTue, 15 May 2018 16:44:48 +0000
treeherderautoland@a40accc5c91c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1459529
milestone62.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 1459529: Remove some useless nsIDocumentObserver notifications. r=heycam MozReview-Commit-ID: DzuiqVGKsiu
accessible/generic/DocAccessible.cpp
dom/base/nsDocument.cpp
dom/base/nsIDocumentObserver.h
dom/base/nsStubDocumentObserver.cpp
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -693,17 +693,16 @@ DocAccessible::OnPivotChanged(nsIAccessi
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIDocumentObserver
 
 NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(DocAccessible)
 NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(DocAccessible)
-NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(DocAccessible)
 
 void
 DocAccessible::AttributeWillChange(dom::Element* aElement,
                                    int32_t aNameSpaceID,
                                    nsAtom* aAttribute,
                                    int32_t aModType,
                                    const nsAttrValue* aNewValue)
 {
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -4296,31 +4296,27 @@ nsIDocument::AddStyleSheetToStyleSets(St
       new AsyncEventDispatcher(this, event);                                  \
     asyncDispatcher->mOnlyChromeDispatch = true;                              \
     asyncDispatcher->PostDOMEvent();                                          \
   } while (0);
 
 void
 nsIDocument::NotifyStyleSheetAdded(StyleSheet* aSheet, bool aDocumentSheet)
 {
-  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (aSheet, aDocumentSheet));
-
   if (StyleSheetChangeEventsEnabled()) {
     DO_STYLESHEET_NOTIFICATION(StyleSheetChangeEvent,
                                "StyleSheetAdded",
                                mDocumentSheet,
                                aDocumentSheet);
   }
 }
 
 void
 nsIDocument::NotifyStyleSheetRemoved(StyleSheet* aSheet, bool aDocumentSheet)
 {
-  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (aSheet, aDocumentSheet));
-
   if (StyleSheetChangeEventsEnabled()) {
     DO_STYLESHEET_NOTIFICATION(StyleSheetChangeEvent,
                                "StyleSheetRemoved",
                                mDocumentSheet,
                                aDocumentSheet);
   }
 }
 
@@ -4427,22 +4423,16 @@ nsIDocument::SetStyleSheetApplicableStat
   if (mStyleSheets.IndexOf(aSheet) != mStyleSheets.NoIndex) {
     if (aApplicable) {
       AddStyleSheetToStyleSets(aSheet);
     } else {
       RemoveStyleSheetFromStyleSets(aSheet);
     }
   }
 
-  // We have to always notify, since this will be called for sheets
-  // that are children of sheets in our style set, as well as some
-  // sheets for HTMLEditor.
-
-  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetApplicableStateChanged, (aSheet));
-
   if (StyleSheetChangeEventsEnabled()) {
     DO_STYLESHEET_NOTIFICATION(StyleSheetApplicableStateChangeEvent,
                                "StyleSheetApplicableStateChanged",
                                mApplicable,
                                aApplicable);
   }
 
   if (!mSSApplicableStateNotificationPending) {
--- a/dom/base/nsIDocumentObserver.h
+++ b/dom/base/nsIDocumentObserver.h
@@ -78,53 +78,16 @@ public:
   /**
    * Notification that the state of the document has changed.
    *
    * @param aDocument The document being observed
    * @param aStateMask the state that changed
    */
   virtual void DocumentStatesChanged(nsIDocument* aDocument,
                                      mozilla::EventStates aStateMask) = 0;
-
-  /**
-   * A StyleSheet has just been added to the document.  This method is
-   * called automatically when a StyleSheet gets added to the
-   * document, even if the stylesheet is not applicable. The
-   * notification is passed on to all of the document observers.
-   *
-   * @param aStyleSheet the StyleSheet that has been added
-   * @param aDocumentSheet True if sheet is in document's style sheet list,
-   *                       false if sheet is not (i.e., UA or user sheet)
-   */
-  virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet,
-                               bool aDocumentSheet) = 0;
-
-  /**
-   * A StyleSheet has just been removed from the document.  This
-   * method is called automatically when a StyleSheet gets removed
-   * from the document, even if the stylesheet is not applicable. The
-   * notification is passed on to all of the document observers.
-   *
-   * @param aStyleSheet the StyleSheet that has been removed
-   * @param aDocumentSheet True if sheet is in document's style sheet list,
-   *                       false if sheet is not (i.e., UA or user sheet)
-   */
-  virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet,
-                                 bool aDocumentSheet) = 0;
-
-  /**
-   * A StyleSheet has just changed its applicable state.
-   * This method is called automatically when the applicable state
-   * of a StyleSheet gets changed. 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 changed state
-   */
-  virtual void StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE                              \
     virtual void BeginUpdate(nsIDocument* aDocument,                         \
                              nsUpdateType aUpdateType) override;
 
@@ -141,38 +104,23 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumen
     virtual void ContentStateChanged(nsIDocument* aDocument,                 \
                                      nsIContent* aContent,                   \
                                      mozilla::EventStates aStateMask) override;
 
 #define NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED                    \
     virtual void DocumentStatesChanged(nsIDocument* aDocument,               \
                                        mozilla::EventStates aStateMask) override;
 
-#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED                          \
-    virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet,           \
-                                 bool aDocumentSheet) override;
-
-#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETREMOVED                        \
-    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                                          \
     NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE                                  \
     NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE                                    \
     NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD                                    \
     NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD                                      \
     NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED                          \
     NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED                        \
-    NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED                              \
-    NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETREMOVED                            \
-    NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETAPPLICABLESTATECHANGED             \
     NS_DECL_NSIMUTATIONOBSERVER
 
 
 #define NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(_class)                     \
 void                                                                      \
 _class::BeginUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType)     \
 {                                                                         \
 }                                                                         \
@@ -204,25 +152,9 @@ void                                    
 _class::DocumentStatesChanged(nsIDocument* aDocument,                     \
                               mozilla::EventStates aStateMask)            \
 {                                                                         \
 }
 
 #define NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(_class)                       \
 NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class)
 
-#define NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(_class)                    \
-void                                                                      \
-_class::StyleSheetAdded(mozilla::StyleSheet* aStyleSheet,                 \
-                        bool aDocumentSheet)                              \
-{                                                                         \
-}                                                                         \
-void                                                                      \
-_class::StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet,               \
-                          bool aDocumentSheet)                            \
-{                                                                         \
-}                                                                         \
-void                                                                      \
-_class::StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet)\
-{                                                                         \
-}                                                                         \
-
 #endif /* nsIDocumentObserver_h___ */
--- a/dom/base/nsStubDocumentObserver.cpp
+++ b/dom/base/nsStubDocumentObserver.cpp
@@ -12,9 +12,8 @@
  */
 
 #include "nsStubDocumentObserver.h"
 
 NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(nsStubDocumentObserver)
 NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsStubDocumentObserver)
 NS_IMPL_NSIDOCUMENTOBSERVER_STATE_STUB(nsStubDocumentObserver)
 NS_IMPL_NSIDOCUMENTOBSERVER_CONTENT(nsStubDocumentObserver)
-NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsStubDocumentObserver)