Bug 1297899 - Part 8: Move Content{Inserted,Appended} up to RestyleManager. r?bholley draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 13 Feb 2017 11:21:33 +0800
changeset 482522 1fc5541d2b2d69c602bbf11996ddfde30a32d8c0
parent 482521 c544ae4c154fd34ad09fed587ffb49567857f1e2
child 482523 178857e6a7d7b2f89fb53d10487e79c1c0f8e37d
push id45090
push userbmo:cam@mcc.id.au
push dateMon, 13 Feb 2017 03:22:33 +0000
reviewersbholley
bugs1297899
milestone54.0a1
Bug 1297899 - Part 8: Move Content{Inserted,Appended} up to RestyleManager. r?bholley MozReview-Commit-ID: G2XyuyxhzOz
layout/base/GeckoRestyleManager.h
layout/base/RestyleManager.cpp
layout/base/RestyleManager.h
layout/base/RestyleManagerInlines.h
layout/base/ServoRestyleManager.cpp
--- a/layout/base/GeckoRestyleManager.h
+++ b/layout/base/GeckoRestyleManager.h
@@ -215,28 +215,16 @@ public:
   TryInitiatingTransition(nsPresContext* aPresContext, nsIContent* aContent,
                           nsStyleContext* aOldStyleContext,
                           RefPtr<nsStyleContext>* aNewStyleContext /* inout */);
 
 private:
   void RestyleForEmptyChange(Element* aContainer);
 
 public:
-  // Handle ContentInserted notifications.
-  void ContentInserted(nsINode* aContainer, nsIContent* aChild)
-  {
-    RestyleForInsertOrChange(aContainer, aChild);
-  }
-
-  // Handle ContentAppended notifications.
-  void ContentAppended(nsIContent* aContainer, nsIContent* aFirstNewContent)
-  {
-    RestyleForAppend(aContainer, aFirstNewContent);
-  }
-
   // Handle ContentRemoved notifications.
   //
   // This would be have the same logic as RestyleForInsertOrChange if we got the
   // notification before the removal.  However, we get it after, so we need the
   // following sibling in addition to the old child.  |aContainer| must be
   // non-null; when the container is null, no work is needed.  aFollowingSibling
   // is the sibling that used to come after aOldChild before the removal.
   void ContentRemoved(nsINode* aContainer, nsIContent* aOldChild,
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
 #include "mozilla/StyleSetHandleInlines.h"
 #include "nsIFrame.h"
 #include "nsIPresShellInlines.h"
 
 namespace mozilla {
 
 RestyleManager::RestyleManager(StyleBackendType aType,
                                nsPresContext* aPresContext)
@@ -18,16 +19,28 @@ RestyleManager::RestyleManager(StyleBack
   , mHoverGeneration(0)
   , mType(aType)
   , mObservingRefreshDriver(false)
   , mInStyleRefresh(false)
 {
   MOZ_ASSERT(mPresContext);
 }
 
+void
+RestyleManager::ContentInserted(nsINode* aContainer, nsIContent* aChild)
+{
+  RestyleForInsertOrChange(aContainer, aChild);
+}
+
+void
+RestyleManager::ContentAppended(nsIContent* aContainer, nsIContent* aFirstNewContent)
+{
+  RestyleForAppend(aContainer, aFirstNewContent);
+}
+
 /**
  * Calculates the change hint and the restyle hint for a given content state
  * change.
  *
  * This is called from both Restyle managers.
  */
 void
 RestyleManager::ContentStateChangedInternal(Element* aElement,
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -137,30 +137,29 @@ public:
    * not currently in a restyling operation.
    */
   AnimationsWithDestroyedFrame* GetAnimationsWithDestroyedFrame() {
     return mAnimationsWithDestroyedFrame;
   }
 
   void PostRestyleEventForLazyConstruction() { PostRestyleEventInternal(true); }
 
+  void ContentInserted(nsINode* aContainer, nsIContent* aChild);
+  void ContentAppended(nsIContent* aContainer, nsIContent* aFirstNewContent);
+
   MOZ_DECL_STYLO_METHODS(GeckoRestyleManager, ServoRestyleManager)
 
   inline void PostRestyleEvent(dom::Element* aElement,
                                nsRestyleHint aRestyleHint,
                                nsChangeHint aMinChangeHint);
   inline void RebuildAllStyleData(nsChangeHint aExtraHint,
                                   nsRestyleHint aRestyleHint);
   inline void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
                                            nsRestyleHint aRestyleHint);
   inline void ProcessPendingRestyles();
-  inline void ContentInserted(nsINode* aContainer,
-                              nsIContent* aChild);
-  inline void ContentAppended(nsIContent* aContainer,
-                              nsIContent* aFirstNewContent);
   inline void ContentRemoved(nsINode* aContainer,
                              nsIContent* aOldChild,
                              nsIContent* aFollowingSibling);
   inline void RestyleForInsertOrChange(nsINode* aContainer,
                                        nsIContent* aChild);
   inline void RestyleForAppend(nsIContent* aContainer,
                                nsIContent* aFirstNewContent);
   inline nsresult ContentStateChanged(nsIContent* aContent,
--- a/layout/base/RestyleManagerInlines.h
+++ b/layout/base/RestyleManagerInlines.h
@@ -40,30 +40,16 @@ RestyleManager::PostRebuildAllStyleDataE
 
 void
 RestyleManager::ProcessPendingRestyles()
 {
   MOZ_STYLO_FORWARD(ProcessPendingRestyles, ());
 }
 
 void
-RestyleManager::ContentInserted(nsINode* aContainer,
-                                nsIContent* aChild)
-{
-  MOZ_STYLO_FORWARD(ContentInserted, (aContainer, aChild));
-}
-
-void
-RestyleManager::ContentAppended(nsIContent* aContainer,
-                                nsIContent* aFirstNewContent)
-{
-  MOZ_STYLO_FORWARD(ContentAppended, (aContainer, aFirstNewContent));
-}
-
-void
 RestyleManager::ContentRemoved(nsINode* aContainer,
                                nsIContent* aOldChild,
 			       nsIContent* aFollowingSibling)
 {
   MOZ_STYLO_FORWARD(ContentRemoved, (aContainer, aOldChild, aFollowingSibling));
 }
 
 void
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -388,42 +388,29 @@ ServoRestyleManager::RestyleForInsertOrC
   // like :empty and positional selectors (though we may not need to post
   // restyle events as agressively as the Gecko path does).
   //
   // Bug 1297899 tracks this work.
   //
 }
 
 void
-ServoRestyleManager::ContentInserted(nsINode* aContainer, nsIContent* aChild)
-{
-  RestyleForInsertOrChange(aContainer, aChild);
-}
-
-void
 ServoRestyleManager::RestyleForAppend(nsIContent* aContainer,
                                       nsIContent* aFirstNewContent)
 {
   //
   // XXXbholley: We need the Gecko logic here to correctly restyle for things
   // like :empty and positional selectors (though we may not need to post
   // restyle events as agressively as the Gecko path does).
   //
   // Bug 1297899 tracks this work.
   //
 }
 
 void
-ServoRestyleManager::ContentAppended(nsIContent* aContainer,
-                                     nsIContent* aFirstNewContent)
-{
-  RestyleForAppend(aContainer, aFirstNewContent);
-}
-
-void
 ServoRestyleManager::ContentRemoved(nsINode* aContainer,
                                     nsIContent* aOldChild,
                                     nsIContent* aFollowingSibling)
 {
   NS_WARNING("stylo: ServoRestyleManager::ContentRemoved not implemented");
 }
 
 nsresult