--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -10,18 +10,18 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/KeyframeEffectReadOnly.h"
#include "mozilla/AnimationComparator.h"
#include "mozilla/AnimationPerformanceWarning.h"
#include "mozilla/AnimationTarget.h"
#include "mozilla/AnimationUtils.h"
#include "mozilla/EffectSet.h"
#include "mozilla/LayerAnimationInfo.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "mozilla/StyleAnimationValue.h"
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetPresShellForContent
#include "nsCSSPropertyIDSet.h"
#include "nsCSSProps.h"
#include "nsIPresShell.h"
#include "nsIPresShellInlines.h"
#include "nsLayoutUtils.h"
#include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
@@ -309,17 +309,17 @@ EffectCompositor::PostRestyleForAnimatio
nsRestyleHint hint = aCascadeLevel == CascadeLevel::Transitions ?
eRestyle_CSSTransitions :
eRestyle_CSSAnimations;
// FIXME: stylo only supports Self and Subtree hints now, so we override it
// for stylo if we are not in process of restyling.
if (mPresContext->StyleSet()->IsServo() &&
- !mPresContext->RestyleManager()->AsBase()->IsInStyleRefresh()) {
+ !mPresContext->RestyleManager()->IsInStyleRefresh()) {
hint = eRestyle_Self | eRestyle_Subtree;
}
mPresContext->PresShell()->RestyleForAnimation(element, hint);
}
void
EffectCompositor::PostRestyleForThrottledAnimations()
{
--- a/dom/animation/EffectSet.cpp
+++ b/dom/animation/EffectSet.cpp
@@ -1,18 +1,18 @@
/* -*- 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 "EffectSet.h"
#include "mozilla/dom/Element.h" // For Element
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
#include "nsCycleCollectionNoteChild.h" // For CycleCollectionNoteChild
#include "nsPresContext.h"
#include "nsLayoutUtils.h"
namespace mozilla {
/* static */ void
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -50,18 +50,18 @@
#include "nsSMILMappedAttribute.h"
#include "SVGMotionSMILAttr.h"
#include "nsAttrValueOrString.h"
#include "nsSMILAnimationController.h"
#include "mozilla/dom/SVGElementBinding.h"
#include "mozilla/DeclarationBlock.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/Unused.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
// This is needed to ensure correct handling of calls to the
// vararg-list methods in this file:
// nsSVGElement::GetAnimated{Length,Number,Integer}Values
// See bug 547964 for details:
@@ -925,17 +925,17 @@ nsSVGElement::WalkContentStyleRules(nsRu
void
nsSVGElement::WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker)
{
// Update & walk the animated content style rule, to include style from
// animated mapped attributes. But first, get nsPresContext to check
// whether this is a "no-animation restyle". (This should match the check
// in nsHTMLCSSStyleSheet::RulesMatching(), where we determine whether to
// apply the SMILOverrideStyle.)
- RestyleManagerHandle restyleManager =
+ RestyleManager* restyleManager =
aRuleWalker->PresContext()->RestyleManager();
MOZ_ASSERT(restyleManager->IsGecko(),
"stylo: Servo-backed style system should not be calling "
"WalkAnimatedContentStyleRules");
if (!restyleManager->AsGecko()->SkipAnimationRules()) {
// update/walk the animated content style rule.
DeclarationBlock* animContentDeclBlock = GetAnimatedContentDeclarationBlock();
if (!animContentDeclBlock) {
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -176,18 +176,18 @@
#include "nsCanvasFrame.h"
#include "nsIImageLoadingContent.h"
#include "nsImageFrame.h"
#include "nsIScreen.h"
#include "nsIScreenManager.h"
#include "nsPlaceholderFrame.h"
#include "nsTransitionManager.h"
#include "ChildIterator.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDragSession.h"
#include "nsIFrameInlines.h"
#include "mozilla/gfx/2D.h"
#include "nsSubDocumentFrame.h"
#include "nsQueryObject.h"
#include "nsLayoutStylesheetCache.h"
#include "mozilla/layers/InputAPZContext.h"
@@ -2966,17 +2966,17 @@ PresShell::RecreateFramesFor(nsIContent*
nsAutoScriptBlocker scriptBlocker;
nsStyleChangeList changeList;
changeList.AppendChange(nullptr, aContent, nsChangeHint_ReconstructFrame);
// Mark ourselves as not safe to flush while we're doing frame construction.
++mChangeNestCount;
- RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
+ RestyleManager* restyleManager = mPresContext->RestyleManager();
nsresult rv = restyleManager->ProcessRestyledFrames(changeList);
restyleManager->FlushOverflowChangedTracker();
--mChangeNestCount;
return rv;
}
void
@@ -3753,17 +3753,17 @@ FlushLayoutRecursive(nsIDocument* aDocum
aDocument->FlushPendingNotifications(FlushType::Layout);
return true;
}
void
PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent,
bool aFlushOnHoverChange)
{
- RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
+ RestyleManager* restyleManager = mPresContext->RestyleManager();
uint32_t hoverGenerationBefore =
restyleManager->GetHoverGeneration();
nsEventStatus status;
nsView* targetView = nsView::GetViewFor(aEvent->mWidget);
if (!targetView)
return;
targetView->GetViewManager()->DispatchEvent(aEvent, targetView, &status);
if (MOZ_UNLIKELY(mIsDestroying)) {
@@ -4598,17 +4598,17 @@ nsIPresShell::RestyleForCSSRuleChanges()
return;
}
if (!root) {
// No content to restyle
return;
}
- RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
+ RestyleManager* restyleManager = mPresContext->RestyleManager();
if (mStyleSet->IsServo()) {
// Tell Servo that the contents of style sheets have changed.
mStyleSet->AsServo()->NoteStyleSheetsChanged();
}
if (scopeRoots.IsEmpty()) {
// If scopeRoots is empty, we know that mStylesHaveChanged was true at
@@ -9593,17 +9593,17 @@ PresShell::Observe(nsISupports* aSubject
nsStyleChangeList changeList;
WalkFramesThroughPlaceholders(mPresContext, rootFrame,
ReframeImageBoxes, &changeList);
// Mark ourselves as not safe to flush while we're doing frame
// construction.
{
nsAutoScriptBlocker scriptBlocker;
++mChangeNestCount;
- RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
+ RestyleManager* restyleManager = mPresContext->RestyleManager();
if (restyleManager->IsServo()) {
MOZ_CRASH("stylo: PresShell::Observe(\"chrome-flush-skin-caches\") "
"not implemented for Servo-backed style system");
}
restyleManager->AsGecko()->ProcessRestyledFrames(changeList);
restyleManager->AsGecko()->FlushOverflowChangedTracker();
--mChangeNestCount;
}
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -135,16 +135,52 @@ public:
/**
* Return the current AnimationsWithDestroyedFrame struct, or null if we're
* not currently in a restyling operation.
*/
AnimationsWithDestroyedFrame* GetAnimationsWithDestroyedFrame() {
return mAnimationsWithDestroyedFrame;
}
+ MOZ_DECL_STYLO_METHODS(GeckoRestyleManager, ServoRestyleManager)
+
+ inline void PostRestyleEvent(dom::Element* aElement,
+ nsRestyleHint aRestyleHint,
+ nsChangeHint aMinChangeHint);
+ inline void PostRestyleEventForLazyConstruction();
+ 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,
+ EventStates aStateMask);
+ inline void AttributeWillChange(dom::Element* aElement,
+ int32_t aNameSpaceID,
+ nsIAtom* aAttribute,
+ int32_t aModType,
+ const nsAttrValue* aNewValue);
+ inline void AttributeChanged(dom::Element* aElement,
+ int32_t aNameSpaceID,
+ nsIAtom* aAttribute,
+ int32_t aModType,
+ const nsAttrValue* aOldValue);
+ inline nsresult ReparentStyleContext(nsIFrame* aFrame);
+
protected:
RestyleManager(StyleBackendType aType, nsPresContext* aPresContext);
virtual ~RestyleManager()
{
MOZ_ASSERT(!mAnimationsWithDestroyedFrame,
"leaving dangling pointers from AnimationsWithDestroyedFrame");
}
@@ -173,18 +209,16 @@ protected:
MOZ_ASSERT(mPresContext);
return mPresContext;
}
nsCSSFrameConstructor* FrameConstructor() const {
return PresContext()->FrameConstructor();
}
- MOZ_DECL_STYLO_METHODS(GeckoRestyleManager, ServoRestyleManager)
-
private:
nsPresContext* mPresContext; // weak, can be null after Disconnect().
uint32_t mRestyleGeneration;
uint32_t mHoverGeneration;
const StyleBackendType mType;
// True if we're already waiting for a refresh notification.
new file mode 100644
--- /dev/null
+++ b/layout/base/RestyleManagerInlines.h
@@ -0,0 +1,126 @@
+/* -*- 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/. */
+
+#ifndef mozilla_RestyleManagerInlines_h
+#define mozilla_RestyleManagerInlines_h
+
+#include "mozilla/GeckoRestyleManager.h"
+#include "mozilla/ServoRestyleManager.h"
+#include "mozilla/ServoUtils.h"
+
+namespace mozilla {
+
+MOZ_DEFINE_STYLO_METHODS(RestyleManager,
+ GeckoRestyleManager, ServoRestyleManager)
+
+void
+RestyleManager::PostRestyleEvent(dom::Element* aElement,
+ nsRestyleHint aRestyleHint,
+ nsChangeHint aMinChangeHint)
+{
+ MOZ_STYLO_FORWARD(PostRestyleEvent, (aElement, aRestyleHint, aMinChangeHint));
+}
+
+void
+RestyleManager::PostRestyleEventForLazyConstruction()
+{
+ MOZ_STYLO_FORWARD(PostRestyleEventForLazyConstruction, ());
+}
+
+void
+RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
+ nsRestyleHint aRestyleHint)
+{
+ MOZ_STYLO_FORWARD(RebuildAllStyleData, (aExtraHint, aRestyleHint));
+}
+
+void
+RestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
+ nsRestyleHint aRestyleHint)
+{
+ MOZ_STYLO_FORWARD(PostRebuildAllStyleDataEvent, (aExtraHint, aRestyleHint));
+}
+
+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
+RestyleManager::RestyleForInsertOrChange(nsINode* aContainer,
+ nsIContent* aChild)
+{
+ MOZ_STYLO_FORWARD(RestyleForInsertOrChange, (aContainer, aChild));
+}
+
+void
+RestyleManager::RestyleForAppend(nsIContent* aContainer,
+ nsIContent* aFirstNewContent)
+{
+ MOZ_STYLO_FORWARD(RestyleForAppend, (aContainer, aFirstNewContent));
+}
+
+nsresult
+RestyleManager::ContentStateChanged(nsIContent* aContent,
+ EventStates aStateMask)
+{
+ MOZ_STYLO_FORWARD(ContentStateChanged, (aContent, aStateMask));
+}
+
+void
+RestyleManager::AttributeWillChange(dom::Element* aElement,
+ int32_t aNameSpaceID,
+ nsIAtom* aAttribute,
+ int32_t aModType,
+ const nsAttrValue* aNewValue)
+{
+ MOZ_STYLO_FORWARD(AttributeWillChange, (aElement, aNameSpaceID, aAttribute,
+ aModType, aNewValue));
+}
+
+void
+RestyleManager::AttributeChanged(dom::Element* aElement,
+ int32_t aNameSpaceID,
+ nsIAtom* aAttribute,
+ int32_t aModType,
+ const nsAttrValue* aOldValue)
+{
+ MOZ_STYLO_FORWARD(AttributeChanged, (aElement, aNameSpaceID, aAttribute,
+ aModType, aOldValue));
+}
+
+nsresult
+RestyleManager::ReparentStyleContext(nsIFrame* aFrame)
+{
+ MOZ_STYLO_FORWARD(ReparentStyleContext, (aFrame));
+}
+
+} // namespace mozilla
+
+#endif // mozilla_RestyleManagerInlines_h
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -72,18 +72,17 @@ EXPORTS.mozilla += [
'ArenaRefPtr.h',
'ArenaRefPtrInlines.h',
'GeckoRestyleManager.h',
'GeometryUtils.h',
'OverflowChangedTracker.h',
'PresShell.h',
'RestyleLogging.h',
'RestyleManager.h',
- 'RestyleManagerHandle.h',
- 'RestyleManagerHandleInlines.h',
+ 'RestyleManagerInlines.h',
'ServoRestyleManager.h',
'ShapeUtils.h',
'StaticPresData.h',
]
UNIFIED_SOURCES += [
'AccessibleCaret.cpp',
'AccessibleCaretEventHub.cpp',
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -81,18 +81,18 @@
#include "nsIObjectLoadingContent.h"
#include "nsTArray.h"
#include "nsGenericDOMDataNode.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ElementInlines.h"
#include "nsAutoLayoutPhase.h"
#include "nsStyleStructInlines.h"
#include "nsPageContentFrame.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "StickyScrollContainer.h"
#include "nsFieldSetFrame.h"
#include "nsInlineFrame.h"
#include "nsBlockFrame.h"
#include "nsCanvasFrame.h"
#include "nsFirstLetterFrame.h"
#include "nsGfxScrollFrame.h"
#include "nsPageFrame.h"
@@ -458,30 +458,30 @@ AnyKidsNeedBlockParent(nsIFrame *aFrameL
return k->GetContent();
}
}
return nullptr;
}
// Reparent a frame into a wrapper frame that is a child of its old parent.
static void
-ReparentFrame(RestyleManagerHandle aRestyleManager,
+ReparentFrame(RestyleManager* aRestyleManager,
nsContainerFrame* aNewParentFrame,
nsIFrame* aFrame)
{
aFrame->SetParent(aNewParentFrame);
aRestyleManager->ReparentStyleContext(aFrame);
}
static void
ReparentFrames(nsCSSFrameConstructor* aFrameConstructor,
nsContainerFrame* aNewParentFrame,
const nsFrameList& aFrameList)
{
- RestyleManagerHandle restyleManager = aFrameConstructor->RestyleManager();
+ RestyleManager* restyleManager = aFrameConstructor->RestyleManager();
for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
ReparentFrame(restyleManager, aNewParentFrame, e.get());
}
}
//----------------------------------------------------------------------
//
// When inline frames get weird and have block frames in them, we
@@ -7356,17 +7356,17 @@ nsCSSFrameConstructor::ContentAppended(n
}
// The frame constructor uses this codepath both for bonafide newly-added
// content and for RestyleManager-driven frame construction (RECONSTRUCT_FRAME
// and lazy frame construction). If we're using the Servo style system, we
// want to ensure that styles get resolved in the first case, whereas for the
// second case they should have already been resolved if needed.
bool isNewlyAddedContentForServo = aContainer->IsStyledByServo() &&
- !RestyleManager()->AsBase()->IsInStyleRefresh();
+ !RestyleManager()->IsInStyleRefresh();
// See comment in ContentRangeInserted for why this is necessary.
if (!GetContentInsertionFrameFor(aContainer) &&
!aContainer->IsActiveChildrenElement()) {
// We're punting on frame construction because there's no container frame.
// The Servo-backed style system handles this case like the lazy frame
// construction case.
if (isNewlyAddedContentForServo) {
@@ -7814,17 +7814,17 @@ nsCSSFrameConstructor::ContentRangeInser
}
// The frame constructor uses this codepath both for bonafide newly-added
// content and for RestyleManager-driven frame construction (RECONSTRUCT_FRAME
// and lazy frame construction). If we're using the Servo style system, we
// want to ensure that styles get resolved in the first case, whereas for the
// second case they should have already been resolved if needed.
bool isNewlyAddedContentForServo = aContainer->IsStyledByServo() &&
- !RestyleManager()->AsBase()->IsInStyleRefresh();
+ !RestyleManager()->IsInStyleRefresh();
// Put 'parentFrame' inside a scope so we don't confuse it with
// 'insertion.mParentFrame' later.
{
nsContainerFrame* parentFrame = GetContentInsertionFrameFor(aContainer);
// The xbl:children element won't have a frame, but default content can have the children as
// a parent. While its uncommon to change the structure of the default content itself, a label,
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -9,17 +9,17 @@
*/
#ifndef nsCSSFrameConstructor_h___
#define nsCSSFrameConstructor_h___
#include "mozilla/Attributes.h"
#include "mozilla/LinkedList.h"
#include "mozilla/RestyleManager.h"
-#include "mozilla/RestyleManagerHandle.h"
+#include "mozilla/RestyleManager.h"
#include "nsCOMPtr.h"
#include "nsILayoutHistoryState.h"
#include "nsQuoteList.h"
#include "nsCounterManager.h"
#include "nsIAnonymousContentCreator.h"
#include "nsFrameManager.h"
#include "ScrollbarStyles.h"
@@ -68,17 +68,17 @@ public:
nsIAtom* aTag, // content object's tag
nsXPIDLString& aAltText);
private:
nsCSSFrameConstructor(const nsCSSFrameConstructor& aCopy) = delete;
nsCSSFrameConstructor& operator=(const nsCSSFrameConstructor& aCopy) = delete;
public:
- mozilla::RestyleManagerHandle RestyleManager() const
+ mozilla::RestyleManager* RestyleManager() const
{ return mPresShell->GetPresContext()->RestyleManager(); }
nsIFrame* ConstructRootFrame();
nsresult ReconstructDocElementHierarchy();
// Create frames for content nodes that are marked as needing frames. This
// should be called before ProcessPendingRestyles.
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -123,18 +123,18 @@
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
#endif
#include "GeckoProfiler.h"
#include "nsAnimationManager.h"
#include "nsTransitionManager.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "LayoutLogging.h"
// Make sure getpid() works.
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
#else
#include <unistd.h>
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -31,18 +31,18 @@
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIWeakReferenceUtils.h"
#include "nsThreadUtils.h"
#include "nsFrameManager.h"
#include "nsLayoutUtils.h"
#include "nsViewManager.h"
#include "mozilla/GeckoRestyleManager.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "SurfaceCacheUtils.h"
#include "nsCSSRuleProcessor.h"
#include "nsRuleNode.h"
#include "gfxPlatform.h"
#include "nsCSSRules.h"
#include "nsFontFaceLoader.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/EventListenerManager.h"
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -35,17 +35,16 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/AppUnits.h"
#include "prclist.h"
#include "nsThreadUtils.h"
#include "ScrollbarStyles.h"
#include "nsIMessageManager.h"
#include "mozilla/RestyleLogging.h"
#include "Units.h"
-#include "mozilla/RestyleManagerHandle.h"
#include "prenv.h"
#include "mozilla/StaticPresData.h"
#include "mozilla/StyleBackendType.h"
class nsAString;
class nsIPrintSettings;
class nsDocShell;
class nsIDocShell;
@@ -68,16 +67,17 @@ class nsRefreshDriver;
class nsIWidget;
class nsDeviceContext;
class gfxMissingFontRecorder;
namespace mozilla {
class EffectCompositor;
class EventStateManager;
class CounterStyleManager;
+class RestyleManager;
namespace layers {
class ContainerLayer;
class LayerManager;
} // namespace layers
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
@@ -240,17 +240,17 @@ public:
{ return PresShell()->FrameConstructor(); }
mozilla::EffectCompositor* EffectCompositor() { return mEffectCompositor; }
nsTransitionManager* TransitionManager() { return mTransitionManager; }
nsAnimationManager* AnimationManager() { return mAnimationManager; }
nsRefreshDriver* RefreshDriver() { return mRefreshDriver; }
- mozilla::RestyleManagerHandle RestyleManager() {
+ mozilla::RestyleManager* RestyleManager() {
MOZ_ASSERT(mRestyleManager);
return mRestyleManager;
}
mozilla::CounterStyleManager* CounterStyleManager() const {
return mCounterStyleManager;
}
#endif
@@ -1257,17 +1257,17 @@ protected:
// Cannot reintroduce cycles
// since there is no dependency
// from gfx back to layout.
RefPtr<mozilla::EventStateManager> mEventManager;
RefPtr<nsRefreshDriver> mRefreshDriver;
RefPtr<mozilla::EffectCompositor> mEffectCompositor;
RefPtr<nsTransitionManager> mTransitionManager;
RefPtr<nsAnimationManager> mAnimationManager;
- mozilla::RestyleManagerHandle::RefPtr mRestyleManager;
+ RefPtr<mozilla::RestyleManager> mRestyleManager;
RefPtr<mozilla::CounterStyleManager> mCounterStyleManager;
nsIAtom* MOZ_UNSAFE_REF("always a static atom") mMedium; // initialized by subclass ctors
nsCOMPtr<nsIAtom> mMediaEmulated;
// This pointer is nulled out through SetLinkHandler() in the destructors of
// the classes which set it. (using SetLinkHandler() again).
nsILinkHandler* MOZ_NON_OWNING_REF mLinkHandler;
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -42,18 +42,18 @@
#include "mozilla/PendingAnimationTracker.h"
#include "mozilla/Preferences.h"
#include "nsViewManager.h"
#include "GeckoProfiler.h"
#include "nsNPAPIPluginInstance.h"
#include "mozilla/dom/Performance.h"
#include "mozilla/dom/WindowBinding.h"
#include "mozilla/GeckoRestyleManager.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "Layers.h"
#include "imgIContainer.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsDocShell.h"
#include "nsISimpleEnumerator.h"
#include "nsJSEnvironment.h"
#include "mozilla/Telemetry.h"
#include "gfxPrefs.h"
@@ -1867,17 +1867,17 @@ nsRefreshDriver::Tick(int64_t aNowEpoch,
if (!tracingStyleFlush) {
tracingStyleFlush.emplace("Paint", "Styles", Move(mStyleCause));
mStyleCause = nullptr;
}
nsCOMPtr<nsIPresShell> shellKungFuDeathGrip(shell);
mStyleFlushObservers.RemoveElement(shell);
- RestyleManagerHandle restyleManager =
+ RestyleManager* restyleManager =
shell->GetPresContext()->RestyleManager();
restyleManager->SetObservingRefreshDriver(false);
shell->FlushPendingNotifications(ChangesToFlush(FlushType::Style, false));
// Inform the FontFaceSet that we ticked, so that it can resolve its
// ready promise if it needs to (though it might still be waiting on
// a layout flush).
nsPresContext* presContext = shell->GetPresContext();
if (presContext) {
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -9,18 +9,18 @@
#include "nsPresContext.h"
#include "nsStyleContext.h"
#include "nsIContent.h"
#include "nsLineLayout.h"
#include "nsGkAtoms.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "nsFrameManager.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsPlaceholderFrame.h"
#include "nsCSSFrameConstructor.h"
using namespace mozilla;
using namespace mozilla::layout;
nsFirstLetterFrame*
NS_NewFirstLetterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@@ -78,17 +78,17 @@ nsFirstLetterFrame::Init(nsIContent*
}
void
nsFirstLetterFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList)
{
MOZ_ASSERT(aListID == kPrincipalList, "Principal child list is the only "
"list that nsFirstLetterFrame should set via this function");
- RestyleManagerHandle restyleManager = PresContext()->RestyleManager();
+ RestyleManager* restyleManager = PresContext()->RestyleManager();
for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
NS_ASSERTION(e.get()->GetParent() == this, "Unexpected parent");
restyleManager->ReparentStyleContext(e.get());
nsLayoutUtils::MarkDescendantsDirty(e.get());
}
mFrames.SetFrames(aChildList);
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -38,18 +38,18 @@
#include "nsStyleConsts.h"
#include "nsIPresShell.h"
#include "mozilla/Logging.h"
#include "mozilla/Sprintf.h"
#include "nsFrameManager.h"
#include "nsLayoutUtils.h"
#include "LayoutLogging.h"
#include "mozilla/GeckoRestyleManager.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsIDOMNode.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
#include "nsFrameSelection.h"
#include "nsGkAtoms.h"
#include "nsHtml5Atoms.h"
#include "nsCSSAnonBoxes.h"
@@ -695,18 +695,17 @@ nsFrame::DestroyFrom(nsIFrame* aDestruct
}
}
if (HasCSSAnimations() || HasCSSTransitions() ||
EffectSet::GetEffectSet(this)) {
// If no new frame for this element is created by the end of the
// restyling process, stop animations and transitions for this frame
RestyleManager::AnimationsWithDestroyedFrame* adf =
- presContext->RestyleManager()->AsBase()
- ->GetAnimationsWithDestroyedFrame();
+ presContext->RestyleManager()->GetAnimationsWithDestroyedFrame();
// AnimationsWithDestroyedFrame only lives during the restyling process.
if (adf) {
adf->Put(mContent, mStyleContext);
}
}
// Disable visibility tracking. Note that we have to do this before calling
// NotifyDestroyingFrame(), which will clear frame properties and make us lose
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -9,18 +9,18 @@
#include "nsLineLayout.h"
#include "nsBlockFrame.h"
#include "nsPlaceholderFrame.h"
#include "nsGkAtoms.h"
#include "nsStyleContext.h"
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsCSSAnonBoxes.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsDisplayList.h"
#include "mozilla/Likely.h"
#include "SVGTextFrame.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#ifdef DEBUG
#undef NOISY_PUSHING
@@ -345,17 +345,17 @@ nsInlineFrame::ReparentFloatsForInlineCh
}
}
static void
ReparentChildListStyle(nsPresContext* aPresContext,
const nsFrameList::Slice& aFrames,
nsIFrame* aParentFrame)
{
- RestyleManagerHandle restyleManager = aPresContext->RestyleManager();
+ RestyleManager* restyleManager = aPresContext->RestyleManager();
for (nsFrameList::Enumerator e(aFrames); !e.AtEnd(); e.Next()) {
NS_ASSERTION(e.get()->GetParent() == aParentFrame, "Bogus parentage");
restyleManager->ReparentStyleContext(e.get());
nsLayoutUtils::MarkDescendantsDirty(e.get());
}
}
@@ -506,17 +506,17 @@ nsInlineFrame::DrainSelfOverflowListInte
// correct parent pointer. This is sometimes skipped by Reflow.
if (!(aFlags & eDontReparentFrames)) {
nsIFrame* firstChild = overflowFrames->FirstChild();
if (aLineContainer && aLineContainer->GetPrevContinuation()) {
ReparentFloatsForInlineChild(aLineContainer, firstChild, true);
}
const bool doReparentSC =
(aFlags & eInFirstLine) && !(aFlags & eForDestroy);
- RestyleManagerHandle restyleManager = PresContext()->RestyleManager();
+ RestyleManager* restyleManager = PresContext()->RestyleManager();
for (nsIFrame* f = firstChild; f; f = f->GetNextSibling()) {
f->SetParent(this);
if (doReparentSC) {
restyleManager->ReparentStyleContext(f);
nsLayoutUtils::MarkDescendantsDirty(f);
}
}
}
@@ -573,17 +573,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
InlineReflowInput& irs,
ReflowOutput& aMetrics,
nsReflowStatus& aStatus)
{
aStatus = NS_FRAME_COMPLETE;
nsLineLayout* lineLayout = aReflowInput.mLineLayout;
bool inFirstLine = aReflowInput.mLineLayout->GetInFirstLine();
- RestyleManagerHandle restyleManager = aPresContext->RestyleManager();
+ RestyleManager* restyleManager = aPresContext->RestyleManager();
WritingMode frameWM = aReflowInput.GetWritingMode();
WritingMode lineWM = aReflowInput.mLineLayout->mRootSpan->mWritingMode;
LogicalMargin framePadding = aReflowInput.ComputedLogicalBorderPadding();
nscoord startEdge = 0;
const bool boxDecorationBreakClone =
MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
StyleBoxDecorationBreak::Clone);
// Don't offset by our start borderpadding if we have a prev continuation or
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -11,18 +11,18 @@
#include "nsRenderingContext.h"
#include "nsCSSRendering.h"
#include "nsMathMLElement.h"
#include "nsTArray.h"
#include "nsTableFrame.h"
#include "celldata.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include <algorithm>
#include "nsIScriptError.h"
#include "nsContentUtils.h"
using namespace mozilla;
using namespace mozilla::image;
--- a/layout/style/AnimationCollection.cpp
+++ b/layout/style/AnimationCollection.cpp
@@ -1,18 +1,18 @@
/* -*- 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/AnimationCollection.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsAnimationManager.h" // For dom::CSSAnimation
#include "nsPresContext.h"
#include "nsTransitionManager.h" // For dom::CSSTransition
namespace mozilla {
template <class AnimationType>
/* static */ void
--- a/layout/style/HandleRefPtr.h
+++ b/layout/style/HandleRefPtr.h
@@ -14,17 +14,17 @@
#ifndef mozilla_HandleRefPtr_h
#define mozilla_HandleRefPtr_h
namespace mozilla {
/**
* A class for holding strong references to handle-managed objects.
*
- * This is intended for use with objects like RestyleManagerHandle,
+ * This is intended for use with objects like StyleSheetHandle,
* where the handle type is not a pointer but which can still have
* ->AddRef() and ->Release() called on it.
*/
template<typename T>
class HandleRefPtr
{
public:
HandleRefPtr() {}
--- a/layout/style/ServoUtils.h
+++ b/layout/style/ServoUtils.h
@@ -25,17 +25,21 @@
* Macro used in a base class of |geckotype_| and |servotype_|.
* The class should define |StyleBackendType mType;| itself.
*/
#define MOZ_DECL_STYLO_METHODS(geckotype_, servotype_) \
MOZ_DECL_STYLO_CHECK_METHODS \
inline geckotype_* AsGecko(); \
inline servotype_* AsServo(); \
inline const geckotype_* AsGecko() const; \
- inline const servotype_* AsServo() const;
+ inline const servotype_* AsServo() const; \
+ inline geckotype_* GetAsGecko(); \
+ inline servotype_* GetAsServo(); \
+ inline const geckotype_* GetAsGecko() const; \
+ inline const servotype_* GetAsServo() const;
/**
* Macro used in inline header of class |type_| with its Gecko and Servo
* subclasses named |geckotype_| and |servotype_| correspondingly for
* implementing the inline methods defined by MOZ_DECL_STYLO_METHODS.
*/
#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_, servotype_) \
geckotype_* type_::AsGecko() { \
@@ -48,16 +52,28 @@
} \
const geckotype_* type_::AsGecko() const { \
MOZ_ASSERT(IsGecko()); \
return static_cast<const geckotype_*>(this); \
} \
const servotype_* type_::AsServo() const { \
MOZ_ASSERT(IsServo()); \
return static_cast<const servotype_*>(this); \
+ } \
+ geckotype_* type_::GetAsGecko() { \
+ return IsGecko() ? AsGecko() : nullptr; \
+ } \
+ servotype_* type_::GetAsServo() { \
+ return IsServo() ? AsServo() : nullptr; \
+ } \
+ const geckotype_* type_::GetAsGecko() const { \
+ return IsGecko() ? AsGecko() : nullptr; \
+ } \
+ const servotype_* type_::GetAsServo() const { \
+ return IsServo() ? AsServo() : nullptr; \
}
#define MOZ_STYLO_THIS_TYPE mozilla::RemovePointer<decltype(this)>::Type
#define MOZ_STYLO_GECKO_TYPE mozilla::RemovePointer<decltype(AsGecko())>::Type
#define MOZ_STYLO_SERVO_TYPE mozilla::RemovePointer<decltype(AsServo())>::Type
/**
* Macro used to forward a method call to the concrete method defined by
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -34,16 +34,17 @@
#include "nsPresContext.h"
#include "nsIDocument.h"
#include "nsCSSPseudoElements.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/GeckoRestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "imgIRequest.h"
#include "nsLayoutUtils.h"
#include "nsCSSKeywords.h"
#include "nsStyleCoord.h"
#include "nsDisplayList.h"
#include "nsDOMCSSDeclaration.h"
#include "nsStyleTransformMatrix.h"
#include "mozilla/dom/Element.h"
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -15,18 +15,18 @@
#include "nsIStyleRuleProcessor.h"
#include "nsPresContext.h"
#include "nsRuleWalker.h"
#include "nsRuleProcessorData.h"
#include "mozilla/dom/Element.h"
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
#include "nsCSSPseudoElements.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
nsHTMLCSSStyleSheet::nsHTMLCSSStyleSheet()
{
}
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -29,18 +29,18 @@
#include "nsRuleData.h"
#include "nsError.h"
#include "nsRuleProcessorData.h"
#include "nsCSSRuleProcessor.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Element.h"
#include "nsHashKeys.h"
#include "mozilla/OperatorNewExtensions.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS(nsHTMLStyleSheet::HTMLColorRule, nsIStyleRule)
/* virtual */ void
nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -35,18 +35,18 @@
#include "mozilla/dom/Element.h"
#include "GeckoProfiler.h"
#include "nsHTMLCSSStyleSheet.h"
#include "nsHTMLStyleSheet.h"
#include "SVGAttrAnimationRuleProcessor.h"
#include "nsCSSRules.h"
#include "nsPrintfCString.h"
#include "nsIFrame.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsQueryObject.h"
#include <inttypes.h>
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS(nsEmptyStyleRule, nsIStyleRule)
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -27,18 +27,18 @@
#include "nsIFrame.h"
#include "Layers.h"
#include "FrameLayerBuilder.h"
#include "nsCSSProps.h"
#include "nsCSSPseudoElements.h"
#include "nsDisplayList.h"
#include "nsStyleChangeList.h"
#include "nsStyleSet.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsDOMMutationObserver.h"
using mozilla::TimeStamp;
using mozilla::TimeDuration;
using mozilla::dom::Animation;
using mozilla::dom::AnimationPlayState;
using mozilla::dom::CSSTransition;
using mozilla::dom::KeyframeEffectReadOnly;
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -3,18 +3,18 @@
* 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/. */
// Main header first:
#include "nsSVGContainerFrame.h"
// Keep others in (case-insensitive) order:
#include "DrawResult.h"
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsCSSFrameConstructor.h"
#include "nsSVGEffects.h"
#include "nsSVGElement.h"
#include "nsSVGUtils.h"
#include "nsSVGAnimatedTransformList.h"
#include "SVGTextFrame.h"
using namespace mozilla;
--- a/layout/svg/nsSVGEffects.cpp
+++ b/layout/svg/nsSVGEffects.cpp
@@ -2,18 +2,18 @@
/* 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/. */
// Main header first:
#include "nsSVGEffects.h"
// Keep others in (case-insensitive) order:
-#include "mozilla/RestyleManagerHandle.h"
-#include "mozilla/RestyleManagerHandleInlines.h"
+#include "mozilla/RestyleManager.h"
+#include "mozilla/RestyleManagerInlines.h"
#include "nsCSSFrameConstructor.h"
#include "nsISupportsImpl.h"
#include "nsSVGClipPathFrame.h"
#include "nsSVGPaintServerFrame.h"
#include "nsSVGFilterFrame.h"
#include "nsSVGMaskFrame.h"
#include "nsIReflowCallback.h"
#include "nsCycleCollectionParticipant.h"
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -121,17 +121,17 @@ private:
// is no guarantee that every continuation carries a
// PreEffectsBBoxProperty property.
#ifdef DEBUG
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
bool mightHaveNoneSVGMask =
nsSVGEffects::GetEffectProperties(firstFrame).MightHaveNoneSVGMask();
bool inRestyle =
- aFrame->PresContext()->RestyleManager()->AsGecko()->IsInStyleRefresh();
+ aFrame->PresContext()->RestyleManager()->IsInStyleRefresh();
NS_ASSERTION(mightHaveNoneSVGMask || inRestyle ||
aFrame->GetParent()->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::mozAnonymousBlock,
"How did we getting here, then?");
#endif
NS_ASSERTION(!aFrame->Properties().Get(
aFrame->PreTransformOverflowAreasProperty()),