Bug 1297899 - Part 8: Move Content{Inserted,Appended} up to RestyleManager. r?bholley
MozReview-Commit-ID: G2XyuyxhzOz
--- 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