Bug 1897135 Part 2 - Remove redundant mFrameManager member in PresShell. r=dholbert
We can just use `mFrameConstructor` to call `GetRootFrame()`. In order to do so while keeping `PresShell::GetRootFrame()` as a inline method, we need to include `nsCSSFrameConstructor` header in `PresShell.h`, and remove `PresShell` header in `nsCSSFrameConstructor.h`. That means we can no longer inline `RestyleManager()` since it needs to access `PresShell`, but it's OK since `RestyleManager` is used only in the frame constructor, and is probably not in the hot path. Differential Revision: https://phabricator.services.mozilla.com/D210670
This commit is contained in:
@@ -134,7 +134,6 @@
|
||||
#include "nsError.h"
|
||||
#include "nsFlexContainerFrame.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsGlobalWindowOuter.h"
|
||||
@@ -748,7 +747,6 @@ bool PresShell::AccessibleCaretEnabled(nsIDocShell* aDocShell) {
|
||||
PresShell::PresShell(Document* aDocument)
|
||||
: mDocument(aDocument),
|
||||
mViewManager(nullptr),
|
||||
mFrameManager(nullptr),
|
||||
mAutoWeakFrames(nullptr),
|
||||
#ifdef ACCESSIBILITY
|
||||
mDocAccessible(nullptr),
|
||||
@@ -863,9 +861,7 @@ PresShell::~PresShell() {
|
||||
MOZ_ASSERT(!mAllocatedPointers || mAllocatedPointers->IsEmpty(),
|
||||
"Some pres arena objects were not freed");
|
||||
|
||||
mFrameManager = nullptr;
|
||||
mFrameConstructor = nullptr;
|
||||
|
||||
mCurrentEventContent = nullptr;
|
||||
}
|
||||
|
||||
@@ -893,8 +889,6 @@ void PresShell::Init(nsPresContext* aPresContext, nsViewManager* aViewManager) {
|
||||
// Create our frame constructor.
|
||||
mFrameConstructor = MakeUnique<nsCSSFrameConstructor>(mDocument, this);
|
||||
|
||||
mFrameManager = mFrameConstructor.get();
|
||||
|
||||
// The document viewer owns both view manager and pres shell.
|
||||
mViewManager->SetPresShell(this);
|
||||
|
||||
@@ -1338,7 +1332,7 @@ void PresShell::Destroy() {
|
||||
}
|
||||
|
||||
// Revoke any pending events. We need to do this and cancel pending reflows
|
||||
// before we destroy the frame manager, since apparently frame destruction
|
||||
// before we destroy the frame constructor, since apparently frame destruction
|
||||
// sometimes spins the event queue when plug-ins are involved(!).
|
||||
// XXXmats is this still needed now that plugins are gone?
|
||||
StopObservingRefreshDriver();
|
||||
@@ -1352,7 +1346,7 @@ void PresShell::Destroy() {
|
||||
CancelAllPendingReflows();
|
||||
CancelPostedReflowCallbacks();
|
||||
|
||||
// Destroy the frame manager. This will destroy the frame hierarchy
|
||||
// Destroy the frame constructor. This will destroy the frame hierarchy
|
||||
mFrameConstructor->WillDestroyFrameTree();
|
||||
|
||||
NS_WARNING_ASSERTION(!mAutoWeakFrames && mWeakFrames.IsEmpty(),
|
||||
@@ -1768,7 +1762,7 @@ nsresult PresShell::Initialize() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the root frame from the frame manager
|
||||
// Get the root frame from the frame constructor.
|
||||
// XXXbz it would be nice to move this somewhere else... like frame manager
|
||||
// Init(), say. But we need to make sure our views are all set up by the
|
||||
// time we do this!
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#include "nsColor.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsFrameState.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIObserver.h"
|
||||
@@ -426,13 +426,14 @@ class PresShell final : public nsStubDocumentObserver,
|
||||
* Called when document load completes.
|
||||
*/
|
||||
void LoadComplete();
|
||||
/**
|
||||
* This calls through to the frame manager to get the root frame.
|
||||
*/
|
||||
nsIFrame* GetRootFrame() const { return mFrameManager->GetRootFrame(); }
|
||||
|
||||
/*
|
||||
* Get root scroll frame from FrameManager()->GetRootFrame().
|
||||
/**
|
||||
* This calls through to the frame constructor to get the root frame.
|
||||
*/
|
||||
nsIFrame* GetRootFrame() const { return mFrameConstructor->GetRootFrame(); }
|
||||
|
||||
/**
|
||||
* Get root scroll frame from the frame constructor.
|
||||
*/
|
||||
nsIFrame* GetRootScrollFrame() const;
|
||||
|
||||
@@ -621,8 +622,8 @@ class PresShell final : public nsStubDocumentObserver,
|
||||
ScrollFlags aScrollFlags);
|
||||
|
||||
/**
|
||||
* Suppress notification of the frame manager that frames are
|
||||
* being destroyed.
|
||||
* Suppress notification of the frame constructor that frames are being
|
||||
* destroyed.
|
||||
*/
|
||||
void SetIgnoreFrameDestruction(bool aIgnore);
|
||||
|
||||
@@ -2953,9 +2954,6 @@ class PresShell final : public nsStubDocumentObserver,
|
||||
RefPtr<nsCaret> mCaret;
|
||||
RefPtr<nsCaret> mOriginalCaret;
|
||||
RefPtr<AccessibleCaretEventHub> mAccessibleCaretEventHub;
|
||||
// Pointer into mFrameConstructor - this is purely so that GetRootFrame() can
|
||||
// be inlined:
|
||||
nsFrameManager* mFrameManager;
|
||||
WeakPtr<nsDocShell> mForwardingContainer;
|
||||
|
||||
// The `performance.now()` value when we last started to process reflows.
|
||||
|
||||
@@ -2631,6 +2631,10 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
|
||||
return newFrame;
|
||||
}
|
||||
|
||||
RestyleManager* nsCSSFrameConstructor::RestyleManager() const {
|
||||
return mPresShell->GetPresContext()->RestyleManager();
|
||||
}
|
||||
|
||||
nsIFrame* nsCSSFrameConstructor::ConstructRootFrame() {
|
||||
AUTO_PROFILER_LABEL_HOT("nsCSSFrameConstructor::ConstructRootFrame",
|
||||
LAYOUT_FrameConstruction);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "mozilla/FunctionRef.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/ScrollStyles.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@@ -32,6 +31,7 @@ struct nsGenConInitializer;
|
||||
|
||||
class nsBlockFrame;
|
||||
class nsContainerFrame;
|
||||
class nsCanvasFrame;
|
||||
class nsCSSAnonBoxPseudoStaticAtom;
|
||||
class nsFirstLetterFrame;
|
||||
class nsFirstLineFrame;
|
||||
@@ -94,9 +94,7 @@ class nsCSSFrameConstructor final : public nsFrameManager {
|
||||
Async,
|
||||
};
|
||||
|
||||
mozilla::RestyleManager* RestyleManager() const {
|
||||
return mPresShell->GetPresContext()->RestyleManager();
|
||||
}
|
||||
mozilla::RestyleManager* RestyleManager() const;
|
||||
|
||||
nsIFrame* ConstructRootFrame();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/StaticPrefs_print.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsPageContentFrame.h"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "mozilla/FilterInstance.h"
|
||||
#include "mozilla/ISVGDisplayableFrame.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/StaticPrefs_svg.h"
|
||||
#include "mozilla/SVGClipPathFrame.h"
|
||||
#include "mozilla/SVGContainerFrame.h"
|
||||
|
||||
Reference in New Issue
Block a user