diff --git a/layout/base/AccessibleCaret.cpp b/layout/base/AccessibleCaret.cpp index c8285fc1c68a..e65c63884d0b 100644 --- a/layout/base/AccessibleCaret.cpp +++ b/layout/base/AccessibleCaret.cpp @@ -8,6 +8,7 @@ #include "AccessibleCaretLogger.h" #include "mozilla/FloatingPoint.h" +#include "mozilla/PresShell.h" #include "mozilla/StaticPrefs.h" #include "mozilla/ToString.h" #include "nsCanvasFrame.h" @@ -66,7 +67,7 @@ std::ostream& operator<<( // ----------------------------------------------------------------------------- // Implementation of AccessibleCaret methods -AccessibleCaret::AccessibleCaret(nsIPresShell* aPresShell) +AccessibleCaret::AccessibleCaret(PresShell* aPresShell) : mPresShell(aPresShell) { // Check all resources required. if (mPresShell) { diff --git a/layout/base/AccessibleCaret.h b/layout/base/AccessibleCaret.h index 1bdd86dc2954..d4e2a22af140 100644 --- a/layout/base/AccessibleCaret.h +++ b/layout/base/AccessibleCaret.h @@ -20,11 +20,10 @@ #include "nsString.h" class nsIFrame; -class nsIPresShell; struct nsPoint; namespace mozilla { - +class PresShell; namespace dom { class Event; } // namespace dom @@ -46,7 +45,7 @@ class Event; // class AccessibleCaret { public: - explicit AccessibleCaret(nsIPresShell* aPresShell); + explicit AccessibleCaret(PresShell* aPresShell); virtual ~AccessibleCaret(); // This enumeration representing the visibility and visual style of an @@ -193,7 +192,7 @@ class AccessibleCaret { // AccessibleCaretEventHub::Terminate() which is called in // PresShell::Destroy(), it frees us automatically. No need to worry if we // outlive mPresShell. - nsIPresShell* const MOZ_NON_OWNING_REF mPresShell = nullptr; + PresShell* const MOZ_NON_OWNING_REF mPresShell = nullptr; RefPtr mCaretElementHolder; diff --git a/layout/base/AccessibleCaretEventHub.cpp b/layout/base/AccessibleCaretEventHub.cpp index 9e7417ebbad4..e797a8d63edc 100644 --- a/layout/base/AccessibleCaretEventHub.cpp +++ b/layout/base/AccessibleCaretEventHub.cpp @@ -12,16 +12,17 @@ #include "gfxPrefs.h" #include "mozilla/AutoRestore.h" #include "mozilla/MouseEvents.h" +#include "mozilla/PresShell.h" #include "mozilla/StaticPrefs.h" #include "mozilla/TextEvents.h" #include "mozilla/TouchEvents.h" +#include "mozilla/dom/Document.h" #include "mozilla/dom/MouseEventBinding.h" #include "mozilla/dom/Selection.h" #include "nsCanvasFrame.h" #include "nsDocShell.h" #include "nsFocusManager.h" #include "nsFrameSelection.h" -#include "mozilla/dom/Document.h" #include "nsITimer.h" #include "nsPresContext.h" @@ -320,7 +321,7 @@ MOZ_IMPL_STATE_CLASS_GETTER(PressNoCaretState) MOZ_IMPL_STATE_CLASS_GETTER(ScrollState) MOZ_IMPL_STATE_CLASS_GETTER(LongTapState) -AccessibleCaretEventHub::AccessibleCaretEventHub(nsIPresShell* aPresShell) +AccessibleCaretEventHub::AccessibleCaretEventHub(PresShell* aPresShell) : mPresShell(aPresShell) {} void AccessibleCaretEventHub::Init() { diff --git a/layout/base/AccessibleCaretEventHub.h b/layout/base/AccessibleCaretEventHub.h index d619d3f5fa16..1b31a4028b21 100644 --- a/layout/base/AccessibleCaretEventHub.h +++ b/layout/base/AccessibleCaretEventHub.h @@ -19,11 +19,11 @@ #include "mozilla/RefPtr.h" #include "nsWeakReference.h" -class nsIPresShell; class nsITimer; namespace mozilla { class AccessibleCaretManager; +class PresShell; class WidgetKeyboardEvent; class WidgetMouseEvent; class WidgetTouchEvent; @@ -63,7 +63,7 @@ class AccessibleCaretEventHub : public nsIReflowObserver, public nsIScrollObserver, public nsSupportsWeakReference { public: - explicit AccessibleCaretEventHub(nsIPresShell* aPresShell); + explicit AccessibleCaretEventHub(PresShell* aPresShell); void Init(); void Terminate(); @@ -151,7 +151,7 @@ class AccessibleCaretEventHub : public nsIReflowObserver, State* mState = NoActionState(); // Will be set to nullptr in Terminate(). - nsIPresShell* MOZ_NON_OWNING_REF mPresShell = nullptr; + PresShell* MOZ_NON_OWNING_REF mPresShell = nullptr; UniquePtr mManager; diff --git a/layout/base/AccessibleCaretManager.cpp b/layout/base/AccessibleCaretManager.cpp index 750ea427e601..a13353f44632 100644 --- a/layout/base/AccessibleCaretManager.cpp +++ b/layout/base/AccessibleCaretManager.cpp @@ -71,7 +71,7 @@ std::ostream& operator<<( } #undef AC_PROCESS_ENUM_TO_STREAM -AccessibleCaretManager::AccessibleCaretManager(nsIPresShell* aPresShell) +AccessibleCaretManager::AccessibleCaretManager(PresShell* aPresShell) : mPresShell(aPresShell) { if (!mPresShell) { return; diff --git a/layout/base/AccessibleCaretManager.h b/layout/base/AccessibleCaretManager.h index 2f85726fb23b..8c272d04517c 100644 --- a/layout/base/AccessibleCaretManager.h +++ b/layout/base/AccessibleCaretManager.h @@ -23,11 +23,10 @@ class nsFrameSelection; class nsIContent; -class nsIPresShell; struct nsPoint; namespace mozilla { - +class PresShell; namespace dom { class Element; class Selection; @@ -48,7 +47,7 @@ class Selection; // class AccessibleCaretManager { public: - explicit AccessibleCaretManager(nsIPresShell* aPresShell); + explicit AccessibleCaretManager(PresShell* aPresShell); virtual ~AccessibleCaretManager(); // Called by AccessibleCaretEventHub to inform us that PresShell is destroyed. @@ -295,7 +294,7 @@ class AccessibleCaretManager { // // mPresShell will be set to nullptr in Terminate(). Therefore mPresShell is // nullptr either we are in gtest or PresShell::IsDestroying() is true. - nsIPresShell* MOZ_NON_OWNING_REF mPresShell = nullptr; + PresShell* MOZ_NON_OWNING_REF mPresShell = nullptr; // First caret is attached to nsCaret in cursor mode, and is attached to // selection highlight as the left caret in selection mode. diff --git a/layout/base/GeckoMVMContext.cpp b/layout/base/GeckoMVMContext.cpp index c9f20e1e8dee..b8a73fdf09e3 100644 --- a/layout/base/GeckoMVMContext.cpp +++ b/layout/base/GeckoMVMContext.cpp @@ -4,13 +4,13 @@ #include "GeckoMVMContext.h" +#include "mozilla/PresShell.h" #include "mozilla/Services.h" #include "mozilla/dom/Document.h" #include "nsCOMPtr.h" #include "nsIDOMEventListener.h" #include "nsIFrame.h" #include "nsIObserverService.h" -#include "nsIPresShell.h" #include "nsLayoutUtils.h" #include "nsPIDOMWindow.h" #include "nsPresContext.h" @@ -18,7 +18,7 @@ namespace mozilla { GeckoMVMContext::GeckoMVMContext(dom::Document* aDocument, - nsIPresShell* aPresShell) + PresShell* aPresShell) : mDocument(aDocument), mPresShell(aPresShell) { if (nsCOMPtr window = mDocument->GetWindow()) { mEventTarget = window->GetChromeEventHandler(); @@ -162,7 +162,7 @@ void GeckoMVMContext::UpdateDisplayPortMargins() { void GeckoMVMContext::Reflow(const CSSSize& aNewSize, const CSSSize& aOldSize) { MOZ_ASSERT(mPresShell); - nsCOMPtr presShell = mPresShell; + RefPtr presShell = mPresShell; presShell->ResizeReflowIgnoreOverride( nsPresContext::CSSPixelsToAppUnits(aNewSize.width), nsPresContext::CSSPixelsToAppUnits(aNewSize.height), diff --git a/layout/base/GeckoMVMContext.h b/layout/base/GeckoMVMContext.h index 0d0aabae7f50..4986da3ff87e 100644 --- a/layout/base/GeckoMVMContext.h +++ b/layout/base/GeckoMVMContext.h @@ -11,9 +11,8 @@ #include "mozilla/RefPtr.h" #include "nsCOMPtr.h" -class nsIPresShell; - namespace mozilla { +class PresShell; namespace dom { class Document; class EventTarget; @@ -26,7 +25,7 @@ class EventTarget; */ class GeckoMVMContext : public MVMContext { public: - explicit GeckoMVMContext(dom::Document* aDocument, nsIPresShell* aPresShell); + explicit GeckoMVMContext(dom::Document* aDocument, PresShell* aPresShell); void AddEventListener(const nsAString& aType, nsIDOMEventListener* aListener, bool aUseCapture) override; void RemoveEventListener(const nsAString& aType, @@ -58,7 +57,7 @@ class GeckoMVMContext : public MVMContext { private: RefPtr mDocument; // raw ref since the presShell owns this - nsIPresShell* MOZ_NON_OWNING_REF mPresShell; + PresShell* MOZ_NON_OWNING_REF mPresShell; nsCOMPtr mEventTarget; }; diff --git a/layout/base/MobileViewportManager.h b/layout/base/MobileViewportManager.h index 4d1fb2c79b74..4163f9c2d273 100644 --- a/layout/base/MobileViewportManager.h +++ b/layout/base/MobileViewportManager.h @@ -14,7 +14,6 @@ #include "nsIObserver.h" #include "Units.h" -class nsIPresShell; class nsViewportInfo; namespace mozilla { @@ -50,7 +49,7 @@ class MobileViewportManager final : public nsIDOMEventListener, * resolution at which they are the same size.) * * The returned resolution is suitable for passing to - * nsIPresShell::SetResolutionAndScaleTo(). It's not in typed units for + * PresShell::SetResolutionAndScaleTo(). It's not in typed units for * reasons explained at the declaration of FrameMetrics::mPresShellResolution. */ float ComputeIntrinsicResolution() const; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 811cb93b592a..0af8e672b828 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -367,7 +367,7 @@ class ReflowCountMgr { void SetPresContext(nsPresContext* aPresContext) { mPresContext = aPresContext; // weak reference } - void SetPresShell(nsIPresShell* aPresShell) { + void SetPresShell(PresShell* aPresShell) { mPresShell = aPresShell; // weak reference } @@ -399,7 +399,7 @@ class ReflowCountMgr { // Root Frame for Individual Tracking nsPresContext* mPresContext; - nsIPresShell* mPresShell; + PresShell* mPresShell; // ReflowCountMgr gReflowCountMgr; }; @@ -429,18 +429,18 @@ struct nsCallbackEventRequest { // bfcache, but font pref changes don't care about that, and maybe / probably // shouldn't. #ifdef DEBUG -# define ASSERT_REFLOW_SCHEDULED_STATE() \ - { \ - if (ObservingLayoutFlushes()) { \ - MOZ_ASSERT( \ - mDocument->GetBFCacheEntry() || \ - mPresContext->RefreshDriver()->IsLayoutFlushObserver(this), \ - "Unexpected state"); \ - } else { \ - MOZ_ASSERT( \ - !mPresContext->RefreshDriver()->IsLayoutFlushObserver(this), \ - "Unexpected state"); \ - } \ +# define ASSERT_REFLOW_SCHEDULED_STATE() \ + { \ + if (ObservingLayoutFlushes()) { \ + MOZ_ASSERT(mDocument->GetBFCacheEntry() || \ + mPresContext->RefreshDriver()->IsLayoutFlushObserver( \ + static_cast(this)), \ + "Unexpected state"); \ + } else { \ + MOZ_ASSERT(!mPresContext->RefreshDriver()->IsLayoutFlushObserver( \ + static_cast(this)), \ + "Unexpected state"); \ + } \ } #else # define ASSERT_REFLOW_SCHEDULED_STATE() /* nothing */ @@ -448,20 +448,21 @@ struct nsCallbackEventRequest { class nsAutoCauseReflowNotifier { public: - explicit nsAutoCauseReflowNotifier(nsIPresShell* aShell) : mShell(aShell) { - mShell->WillCauseReflow(); + explicit nsAutoCauseReflowNotifier(PresShell* aPresShell) + : mPresShell(aPresShell) { + mPresShell->WillCauseReflow(); } ~nsAutoCauseReflowNotifier() { // This check should not be needed. Currently the only place that seem // to need it is the code that deals with bug 337586. - if (!mShell->mHaveShutDown) { - mShell->DidCauseReflow(); + if (!mPresShell->mHaveShutDown) { + mPresShell->DidCauseReflow(); } else { nsContentUtils::RemoveScriptBlocker(); } } - nsIPresShell* mShell; + PresShell* mPresShell; }; class MOZ_STACK_CLASS nsPresShellEventCB : public EventDispatchingCallback { @@ -1061,7 +1062,7 @@ void PresShell::Init(Document* aDocument, nsPresContext* aPresContext, enum TextPerfLogType { eLog_reflow, eLog_loaddone, eLog_totals }; static void LogTextPerfStats(gfxTextPerfMetrics* aTextPerf, - nsIPresShell* aPresShell, + PresShell* aPresShell, const gfxTextPerfMetrics::TextCounts& aCounts, float aTime, TextPerfLogType aLogType, const char* aURL) { @@ -1374,26 +1375,26 @@ void PresShell::Destroy() { void nsIPresShell::StopObservingRefreshDriver() { nsRefreshDriver* rd = mPresContext->RefreshDriver(); if (mResizeEventPending) { - rd->RemoveResizeEventFlushObserver(this); + rd->RemoveResizeEventFlushObserver(static_cast(this)); } if (mObservingLayoutFlushes) { - rd->RemoveLayoutFlushObserver(this); + rd->RemoveLayoutFlushObserver(static_cast(this)); } if (mObservingStyleFlushes) { - rd->RemoveStyleFlushObserver(this); + rd->RemoveStyleFlushObserver(static_cast(this)); } } void nsIPresShell::StartObservingRefreshDriver() { nsRefreshDriver* rd = mPresContext->RefreshDriver(); if (mResizeEventPending) { - rd->AddResizeEventFlushObserver(this); + rd->AddResizeEventFlushObserver(static_cast(this)); } if (mObservingLayoutFlushes) { - rd->AddLayoutFlushObserver(this); + rd->AddLayoutFlushObserver(static_cast(this)); } if (mObservingStyleFlushes) { - rd->AddStyleFlushObserver(this); + rd->AddStyleFlushObserver(static_cast(this)); } } @@ -1682,7 +1683,7 @@ nsresult PresShell::Initialize() { NS_ASSERTION(!mDidInitialize, "Why are we being called?"); - nsCOMPtr kungFuDeathGrip(this); + RefPtr kungFuDeathGrip(this); RecomputeFontSizeInflationEnabled(); MOZ_DIAGNOSTIC_ASSERT(!mIsDestroying); @@ -1892,7 +1893,7 @@ nsresult PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, GetPresContext()->SuppressingResizeReflow(); RefPtr viewManager = mViewManager; - nsCOMPtr kungFuDeathGrip(this); + RefPtr kungFuDeathGrip(this); if (!suppressingResizeReflow && shrinkToFit) { // Make sure that style is flushed before setting the pres context @@ -2808,7 +2809,8 @@ void nsIPresShell::CancelAllPendingReflows() { mDirtyRoots.Clear(); if (mObservingLayoutFlushes) { - GetPresContext()->RefreshDriver()->RemoveLayoutFlushObserver(this); + GetPresContext()->RefreshDriver()->RemoveLayoutFlushObserver( + static_cast(this)); mObservingLayoutFlushes = false; } @@ -3980,9 +3982,9 @@ static void AssertFrameSubtreeIsSane(const nsIFrame& aRoot) { } #endif -static inline void AssertFrameTreeIsSane(const nsIPresShell& aShell) { +static inline void AssertFrameTreeIsSane(const PresShell& aPresShell) { #ifdef DEBUG - if (const nsIFrame* root = aShell.GetRootFrame()) { + if (const nsIFrame* root = aPresShell.GetRootFrame()) { AssertFrameSubtreeIsSane(*root); } #endif @@ -3994,7 +3996,7 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) { MOZ_DIAGNOSTIC_ASSERT(!mForbiddenToFlush, "This is bad!"); // Per our API contract, hold a strong ref to ourselves until we return. - nsCOMPtr kungFuDeathGrip = this; + RefPtr kungFuDeathGrip = this; /** * VERY IMPORTANT: If you add some sort of new flushing to this @@ -4376,7 +4378,7 @@ void PresShell::ContentRemoved(nsIContent* aChild, } void nsIPresShell::NotifyCounterStylesAreDirty() { - nsAutoCauseReflowNotifier reflowNotifier(this); + nsAutoCauseReflowNotifier reflowNotifier(static_cast(this)); mFrameConstructor->NotifyCounterStylesAreDirty(); } @@ -4392,7 +4394,7 @@ void PresShell::ReconstructFrames() { return; } - nsCOMPtr kungFuDeathGrip(this); + RefPtr kungFuDeathGrip(this); // Have to make sure that the content notifications are flushed before we // start messing with the frame model; otherwise we can get content doubling. @@ -5278,8 +5280,7 @@ void PresShell::SynthesizeMouseMove(bool aFromScroll) { } if (!mPresContext->IsRoot()) { - nsIPresShell* rootPresShell = GetRootPresShell(); - if (rootPresShell) { + if (PresShell* rootPresShell = GetRootPresShell()) { rootPresShell->SynthesizeMouseMove(aFromScroll); } return; @@ -5393,7 +5394,7 @@ void PresShell::ProcessSynthMouseMoveEvent(bool aFromScroll) { // Hold a ref to ourselves so DispatchEvent won't destroy us (since // we need to access members after we call DispatchEvent). - nsCOMPtr kungFuDeathGrip(this); + RefPtr kungFuDeathGrip(this); #ifdef DEBUG_MOUSE_LOCATION printf("[ps=%p]synthesizing mouse move to (%d,%d)\n", this, mMouseLocation.x, @@ -5561,7 +5562,7 @@ void PresShell::MarkFramesInSubtreeApproximatelyVisible( nsSubDocumentFrame* subdocFrame = do_QueryFrame(aFrame); if (subdocFrame) { - nsIPresShell* presShell = subdocFrame->GetSubdocumentPresShellForPainting( + PresShell* presShell = subdocFrame->GetSubdocumentPresShellForPainting( nsSubDocumentFrame::IGNORE_PAINT_SUPPRESSION); if (presShell && !presShell->AssumeAllFramesVisible()) { nsRect rect = aRect; @@ -6351,7 +6352,7 @@ void PresShell::RecordMouseLocation(WidgetGUIEvent* aEvent) { // static nsIFrame* PresShell::EventHandler::GetNearestFrameContainingPresShell( - nsIPresShell* aPresShell) { + PresShell* aPresShell) { nsView* view = aPresShell->GetViewManager()->GetRootView(); while (view && !view->GetFrame()) { view = view->GetParent(); @@ -9242,8 +9243,8 @@ bool nsIPresShell::DoReflow(nsIFrame* target, bool aInterruptible, if (tp) { if (tp->current.numChars > 100) { TimeDuration reflowTime = TimeStamp::Now() - timeStart; - LogTextPerfStats(tp, this, tp->current, reflowTime.ToMilliseconds(), - eLog_reflow, nullptr); + LogTextPerfStats(tp, static_cast(this), tp->current, + reflowTime.ToMilliseconds(), eLog_reflow, nullptr); } tp->Accumulate(); } @@ -9551,7 +9552,8 @@ void nsIPresShell::DoObserveStyleFlushes() { mObservingStyleFlushes = true; if (MOZ_LIKELY(!mDocument->GetBFCacheEntry())) { - mPresContext->RefreshDriver()->AddStyleFlushObserver(this); + mPresContext->RefreshDriver()->AddStyleFlushObserver( + static_cast(this)); } } @@ -9560,7 +9562,8 @@ void nsIPresShell::DoObserveLayoutFlushes() { mObservingLayoutFlushes = true; if (MOZ_LIKELY(!mDocument->GetBFCacheEntry())) { - mPresContext->RefreshDriver()->AddLayoutFlushObserver(this); + mPresContext->RefreshDriver()->AddLayoutFlushObserver( + static_cast(this)); } } @@ -9880,7 +9883,7 @@ bool nsIPresShell::VerifyIncrementalReflow() { // reflowing the test frame tree vm->SetPresShell(presShell); { - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoCauseReflowNotifier crNotifier(static_cast(this)); presShell->Initialize(); } mDocument->BindingManager()->ProcessAttachedQueue(); diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h index ff2c3d0ffc5e..e80c8910f6da 100644 --- a/layout/base/PresShell.h +++ b/layout/base/PresShell.h @@ -604,8 +604,7 @@ class PresShell final : public nsIPresShell, private: static bool InZombieDocument(nsIContent* aContent); - static nsIFrame* GetNearestFrameContainingPresShell( - nsIPresShell* aPresShell); + static nsIFrame* GetNearestFrameContainingPresShell(PresShell* aPresShell); static already_AddRefed GetDocumentURIToCompareWithBlacklist( PresShell& aPresShell); diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 05fce5ae7110..80cfe1bb5382 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -1188,8 +1188,8 @@ static bool IsPrimaryFrameOfRootOrBodyElement(nsIFrame* aFrame) { return false; } -static void ApplyRenderingChangeToTree(nsIPresShell* aPresShell, - nsIFrame* aFrame, nsChangeHint aChange) { +static void ApplyRenderingChangeToTree(PresShell* aPresShell, nsIFrame* aFrame, + nsChangeHint aChange) { // We check StyleDisplay()->HasTransformStyle() in addition to checking // IsTransformed() since we can get here for some frames that don't support // CSS transforms. diff --git a/layout/base/ZoomConstraintsClient.cpp b/layout/base/ZoomConstraintsClient.cpp index 269a2ddc5e5b..40073162fc20 100644 --- a/layout/base/ZoomConstraintsClient.cpp +++ b/layout/base/ZoomConstraintsClient.cpp @@ -44,11 +44,11 @@ ZoomConstraintsClient::ZoomConstraintsClient() ZoomConstraintsClient::~ZoomConstraintsClient() {} -static nsIWidget* GetWidget(nsIPresShell* aShell) { - if (!aShell) { +static nsIWidget* GetWidget(PresShell* aPresShell) { + if (!aPresShell) { return nullptr; } - if (nsIFrame* rootFrame = aShell->GetRootFrame()) { + if (nsIFrame* rootFrame = aPresShell->GetRootFrame()) { #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_UIKIT) return rootFrame->GetNearestWidget(); #else @@ -96,8 +96,7 @@ void ZoomConstraintsClient::Destroy() { mPresShell = nullptr; } -void ZoomConstraintsClient::Init(nsIPresShell* aPresShell, - Document* aDocument) { +void ZoomConstraintsClient::Init(PresShell* aPresShell, Document* aDocument) { if (!(aPresShell && aDocument)) { return; } diff --git a/layout/base/ZoomConstraintsClient.h b/layout/base/ZoomConstraintsClient.h index 799aa2fc978a..a6a488c78b8f 100644 --- a/layout/base/ZoomConstraintsClient.h +++ b/layout/base/ZoomConstraintsClient.h @@ -13,9 +13,8 @@ #include "nsIDOMEventListener.h" #include "nsIObserver.h" -class nsIPresShell; - namespace mozilla { +class PresShell; namespace dom { class EventTarget; } // namespace dom @@ -34,7 +33,7 @@ class ZoomConstraintsClient final : public nsIDOMEventListener, ~ZoomConstraintsClient(); public: - void Init(nsIPresShell* aPresShell, mozilla::dom::Document* aDocument); + void Init(mozilla::PresShell* aPresShell, mozilla::dom::Document* aDocument); void Destroy(); void ScreenSizeChanged(); @@ -43,7 +42,7 @@ class ZoomConstraintsClient final : public nsIDOMEventListener, RefPtr mDocument; // raw ref since the presShell owns this - nsIPresShell* MOZ_NON_OWNING_REF mPresShell; + mozilla::PresShell* MOZ_NON_OWNING_REF mPresShell; nsCOMPtr mEventTarget; mozilla::Maybe mGuid; }; diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 2214eeb56137..34120d13284e 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -6909,8 +6909,7 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent, #ifdef ACCESSIBILITY if (nsAccessibilityService* accService = nsIPresShell::AccService()) { - accService->ContentRangeInserted(static_cast(mPresShell), - aFirstNewContent, nullptr); + accService->ContentRangeInserted(mPresShell, aFirstNewContent, nullptr); } #endif } @@ -7022,8 +7021,7 @@ void nsCSSFrameConstructor::ContentRangeInserted( #ifdef ACCESSIBILITY if (nsAccessibilityService* accService = nsIPresShell::AccService()) { - accService->ContentRangeInserted(static_cast(mPresShell), - aStartChild, aEndChild); + accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild); } #endif @@ -7389,8 +7387,7 @@ void nsCSSFrameConstructor::ContentRangeInserted( #ifdef ACCESSIBILITY if (nsAccessibilityService* accService = nsIPresShell::AccService()) { - accService->ContentRangeInserted(static_cast(mPresShell), - aStartChild, aEndChild); + accService->ContentRangeInserted(mPresShell, aStartChild, aEndChild); } #endif } @@ -7590,7 +7587,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild, #ifdef ACCESSIBILITY if (nsAccessibilityService* accService = nsIPresShell::AccService()) { - accService->ContentRemoved(static_cast(mPresShell), aChild); + accService->ContentRemoved(mPresShell, aChild); } #endif @@ -11724,8 +11721,7 @@ void nsCSSFrameConstructor::GenerateChildFrames(nsContainerFrame* aFrame) { #ifdef ACCESSIBILITY if (nsAccessibilityService* accService = nsIPresShell::AccService()) { if (nsIContent* child = aFrame->GetContent()->GetFirstChild()) { - accService->ContentRangeInserted(static_cast(mPresShell), - child, nullptr); + accService->ContentRangeInserted(mPresShell, child, nullptr); } } #endif diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 730fa7200afe..cc6635cf734b 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -117,27 +117,19 @@ nsCaret::nsCaret() nsCaret::~nsCaret() { StopBlinking(); } -nsresult nsCaret::Init(nsIPresShell* inPresShell) { - NS_ENSURE_ARG(inPresShell); +nsresult nsCaret::Init(PresShell* aPresShell) { + NS_ENSURE_ARG(aPresShell); mPresShell = - do_GetWeakReference(inPresShell); // the presshell owns us, so no addref + do_GetWeakReference(aPresShell); // the presshell owns us, so no addref NS_ASSERTION(mPresShell, "Hey, pres shell should support weak refs"); mShowDuringSelection = LookAndFeel::GetInt(LookAndFeel::eIntID_ShowCaretDuringSelection, mShowDuringSelection ? 1 : 0) != 0; - // get the selection from the pres shell, and set ourselves up as a selection - // listener - - nsCOMPtr selCon = do_QueryReferent(mPresShell); - if (!selCon) { - return NS_ERROR_FAILURE; - } - RefPtr selection = - selCon->GetSelection(nsISelectionController::SELECTION_NORMAL); + aPresShell->GetSelection(nsISelectionController::SELECTION_NORMAL); if (!selection) { return NS_ERROR_FAILURE; } diff --git a/layout/base/nsCaret.h b/layout/base/nsCaret.h index 0f4c9077569f..fe2ed66e8f4f 100644 --- a/layout/base/nsCaret.h +++ b/layout/base/nsCaret.h @@ -23,10 +23,10 @@ class nsFrameSelection; class nsIContent; class nsIFrame; class nsINode; -class nsIPresShell; class nsITimer; namespace mozilla { +class PresShell; namespace gfx { class DrawTarget; } // namespace gfx @@ -47,7 +47,7 @@ class nsCaret final : public nsISelectionListener { typedef mozilla::CaretAssociationHint CaretAssociationHint; - nsresult Init(nsIPresShell* inPresShell); + nsresult Init(mozilla::PresShell* aPresShell); void Terminate(); void SetSelection(mozilla::dom::Selection* aDOMSel); diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp index 2ba929556abc..b3d35b9ed728 100644 --- a/layout/base/nsFrameManager.cpp +++ b/layout/base/nsFrameManager.cpp @@ -9,12 +9,12 @@ #include "nsFrameManager.h" #include "nscore.h" -#include "nsIPresShell.h" #include "nsCOMPtr.h" #include "plhash.h" #include "nsPlaceholderFrame.h" #include "nsGkAtoms.h" #include "nsILayoutHistoryState.h" +#include "mozilla/PresShell.h" #include "mozilla/PresState.h" #include "mozilla/ComputedStyle.h" #include "mozilla/dom/Element.h" diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 4d1460561b0e..b3436c2c3abc 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -760,8 +760,8 @@ bool nsLayoutUtils::AllowZoomingForDocument( nsLayoutUtils::ShouldHandleMetaViewport(aDocument)); } -float nsLayoutUtils::GetCurrentAPZResolutionScale(nsIPresShell* aShell) { - return aShell ? aShell->GetCumulativeNonRootScaleResolution() : 1.0; +float nsLayoutUtils::GetCurrentAPZResolutionScale(PresShell* aPresShell) { + return aPresShell ? aPresShell->GetCumulativeNonRootScaleResolution() : 1.0; } // Return the maximum displayport size, based on the LayerManager's maximum @@ -1262,7 +1262,7 @@ void nsLayoutUtils::InvalidateForDisplayPortChange( } bool nsLayoutUtils::SetDisplayPortMargins(nsIContent* aContent, - nsIPresShell* aPresShell, + PresShell* aPresShell, const ScreenMargin& aMargins, uint32_t aPriority, RepaintMode aRepaintMode) { @@ -3379,8 +3379,8 @@ bool nsLayoutUtils::MaybeCreateDisplayPortInFirstScrollFrameEncountered( } } if (aFrame->IsSubDocumentFrame()) { - nsIPresShell* presShell = static_cast(aFrame) - ->GetSubdocumentPresShellForPainting(0); + PresShell* presShell = static_cast(aFrame) + ->GetSubdocumentPresShellForPainting(0); nsIFrame* root = presShell ? presShell->GetRootFrame() : nullptr; if (root) { if (MaybeCreateDisplayPortInFirstScrollFrameEncountered(root, aBuilder)) { @@ -8771,8 +8771,8 @@ void nsLayoutUtils::SetBSizeFromFontMetrics(const nsIFrame* aFrame, /* static */ bool nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents( - nsIPresShell* aShell) { - if (Document* doc = aShell->GetDocument()) { + PresShell* aPresShell) { + if (Document* doc = aPresShell->GetDocument()) { WidgetEvent event(true, eVoidEvent); nsTArray targets; nsresult rv = EventDispatcher::Dispatch( @@ -8826,7 +8826,7 @@ static void MaybeReflowForInflationScreenSizeChange( } /* static */ -void nsLayoutUtils::SetVisualViewportSize(nsIPresShell* aPresShell, +void nsLayoutUtils::SetVisualViewportSize(PresShell* aPresShell, CSSSize aSize) { MOZ_ASSERT(aSize.width >= 0.0 && aSize.height >= 0.0); @@ -9441,12 +9441,11 @@ CSSRect nsLayoutUtils::GetBoundingContentRect( return result; } -static already_AddRefed GetPresShell(const nsIContent* aContent) { - nsCOMPtr result; +static PresShell* GetPresShell(const nsIContent* aContent) { if (Document* doc = aContent->GetComposedDoc()) { - result = doc->GetPresShell(); + return doc->GetPresShell(); } - return result.forget(); + return nullptr; } static void UpdateDisplayPortMarginsForPendingMetrics( @@ -9456,15 +9455,15 @@ static void UpdateDisplayPortMarginsForPendingMetrics( return; } - nsCOMPtr shell = GetPresShell(content); - if (!shell) { + RefPtr presShell = GetPresShell(content); + if (!presShell) { return; } - if (nsLayoutUtils::AllowZoomingForDocument(shell->GetDocument()) && + if (nsLayoutUtils::AllowZoomingForDocument(presShell->GetDocument()) && aMetrics.IsRootContent()) { // See APZCCallbackHelper::UpdateRootFrame for details. - float presShellResolution = shell->GetResolution(); + float presShellResolution = presShell->GetResolution(); if (presShellResolution != aMetrics.GetPresShellResolution()) { return; } @@ -9497,7 +9496,8 @@ static void UpdateDisplayPortMarginsForPendingMetrics( APZCCallbackHelper::AdjustDisplayPortForScrollDelta(aMetrics, frameScrollOffset); - nsLayoutUtils::SetDisplayPortMargins(content, shell, displayPortMargins, 0); + nsLayoutUtils::SetDisplayPortMargins(content, presShell, displayPortMargins, + 0); } /* static */ diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index ee7e8c9b6e12..9988b7b960a5 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -180,6 +180,7 @@ class nsLayoutUtils { typedef mozilla::ScreenMargin ScreenMargin; typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize; typedef mozilla::LayoutDeviceRect LayoutDeviceRect; + typedef mozilla::PresShell PresShell; typedef mozilla::StyleGeometryBox StyleGeometryBox; typedef mozilla::SVGImageContext SVGImageContext; typedef mozilla::LogicalSize LogicalSize; @@ -284,9 +285,8 @@ class nsLayoutUtils { * @return true if the new margins were applied. */ static bool SetDisplayPortMargins( - nsIContent* aContent, nsIPresShell* aPresShell, - const ScreenMargin& aMargins, uint32_t aPriority = 0, - RepaintMode aRepaintMode = RepaintMode::Repaint); + nsIContent* aContent, PresShell* aPresShell, const ScreenMargin& aMargins, + uint32_t aPriority = 0, RepaintMode aRepaintMode = RepaintMode::Repaint); /** * Set the display port base rect for given element to be used with display @@ -797,7 +797,7 @@ class nsLayoutUtils { * Set nullptr if you don't need this. */ MOZ_CAN_RUN_SCRIPT - static void GetContainerAndOffsetAtEvent(mozilla::PresShell* aPresShell, + static void GetContainerAndOffsetAtEvent(PresShell* aPresShell, const mozilla::WidgetEvent* aEvent, nsIContent** aContainer, int32_t* aOffset); @@ -1136,7 +1136,7 @@ class nsLayoutUtils { * If PAINT_DOCUMENT_RELATIVE is used, the visible region is interpreted * as being relative to the document (normally it's relative to the CSS * viewport) and the document is painted as if no scrolling has occured. - * Only considered if nsIPresShell::IgnoringViewportScrolling is true. + * Only considered if PresShell::IgnoringViewportScrolling is true. * PAINT_TO_WINDOW sets painting to window to true on the display list * builder even if we can't tell that we are painting to the window. * If PAINT_EXISTING_TRANSACTION is set, then BeginTransaction() has already @@ -2711,7 +2711,7 @@ class nsLayoutUtils { * Returns the current APZ Resolution Scale. When Java Pan/Zoom is * enabled in Fennec it will always return 1.0. */ - static float GetCurrentAPZResolutionScale(nsIPresShell* aShell); + static float GetCurrentAPZResolutionScale(PresShell* aPresShell); /** * Returns true if aDocument should be allowed to use resolution @@ -2761,7 +2761,7 @@ class nsLayoutUtils { * * Note that for the RCD-RSF, the scroll offset returned is the layout * viewport offset; if you need the visual viewport offset, that needs to - * be queried independently via nsIPresShell::GetVisualViewportOffset(). + * be queried independently via PresShell::GetVisualViewportOffset(). * * By contrast, ComputeFrameMetrics() computes all the fields, but requires * extra inputs and can only be called during frame layer building. @@ -2817,14 +2817,14 @@ class nsLayoutUtils { const mozilla::LogicalMargin& aFramePadding, mozilla::WritingMode aLineWM, mozilla::WritingMode aFrameWM); - static bool HasDocumentLevelListenersForApzAwareEvents(nsIPresShell* aShell); + static bool HasDocumentLevelListenersForApzAwareEvents(PresShell* aPresShell); /** * Set the viewport size for the purpose of clamping the scroll position * for the root scroll frame of this document * (see nsIDOMWindowUtils.setVisualViewportSize). */ - static void SetVisualViewportSize(nsIPresShell* aPresShell, CSSSize aSize); + static void SetVisualViewportSize(PresShell* aPresShell, CSSSize aSize); /** * Returns true if the given scroll origin is "higher priority" than APZ. diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 46c951e4a118..ca0d307e762d 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1508,8 +1508,8 @@ static nsDocShell* GetDocShell(nsPresContext* aPresContext) { return static_cast(aPresContext->GetDocShell()); } -static bool HasPendingAnimations(nsIPresShell* aShell) { - Document* doc = aShell->GetDocument(); +static bool HasPendingAnimations(PresShell* aPresShell) { + Document* doc = aPresShell->GetDocument(); if (!doc) { return false; } @@ -1861,9 +1861,9 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) { // Resize events should be fired before layout flushes or // calling animation frame callbacks. - AutoTArray observers; + AutoTArray observers; observers.AppendElements(mResizeEventFlushObservers); - for (nsIPresShell* shell : Reversed(observers)) { + for (PresShell* shell : Reversed(observers)) { if (!mPresContext || !mPresContext->GetPresShell()) { StopTimer(); return; @@ -1905,17 +1905,17 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) { RunFrameRequestCallbacks(aNowTime); if (mPresContext && mPresContext->GetPresShell()) { - AutoTArray observers; + AutoTArray observers; observers.AppendElements(mStyleFlushObservers); for (uint32_t j = observers.Length(); j && mPresContext && mPresContext->GetPresShell(); --j) { // Make sure to not process observers which might have been removed // during previous iterations. - nsIPresShell* rawPresShell = observers[j - 1]; + PresShell* rawPresShell = observers[j - 1]; if (!mStyleFlushObservers.RemoveElement(rawPresShell)) { continue; } - RefPtr presShell = static_cast(rawPresShell); + RefPtr presShell = rawPresShell; presShell->mObservingStyleFlushes = false; presShell->FlushPendingNotifications( ChangesToFlush(FlushType::Style, false)); @@ -1928,17 +1928,17 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) { } } else if (i == 2) { // This is the FlushType::Layout case. - AutoTArray observers; + AutoTArray observers; observers.AppendElements(mLayoutFlushObservers); for (uint32_t j = observers.Length(); j && mPresContext && mPresContext->GetPresShell(); --j) { // Make sure to not process observers which might have been removed // during previous iterations. - nsIPresShell* rawPresShell = observers[j - 1]; + PresShell* rawPresShell = observers[j - 1]; if (!mLayoutFlushObservers.RemoveElement(rawPresShell)) { continue; } - RefPtr presShell = static_cast(rawPresShell); + RefPtr presShell = rawPresShell; presShell->mObservingLayoutFlushes = false; presShell->mWasLastReflowInterrupted = false; FlushType flushType = HasPendingAnimations(presShell) diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 8763be8ceff1..a258192b2e78 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -29,7 +29,6 @@ #include "mozilla/VsyncDispatcher.h" class nsPresContext; -class nsIPresShell; class imgIRequest; class nsINode; @@ -38,6 +37,7 @@ class nsIRunnable; namespace mozilla { class AnimationEventDispatcher; class PendingFullscreenEvent; +class PresShell; class RefreshDriverTimer; class Runnable; @@ -189,50 +189,50 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator, /** * Add / remove presshells which have pending resize event. */ - void AddResizeEventFlushObserver(nsIPresShell* aShell, + void AddResizeEventFlushObserver(mozilla::PresShell* aPresShell, bool aDelayed = false) { MOZ_DIAGNOSTIC_ASSERT( - !mResizeEventFlushObservers.Contains(aShell) && - !mDelayedResizeEventFlushObservers.Contains(aShell), + !mResizeEventFlushObservers.Contains(aPresShell) && + !mDelayedResizeEventFlushObservers.Contains(aPresShell), "Double-adding resize event flush observer"); if (aDelayed) { - mDelayedResizeEventFlushObservers.AppendElement(aShell); + mDelayedResizeEventFlushObservers.AppendElement(aPresShell); } else { - mResizeEventFlushObservers.AppendElement(aShell); + mResizeEventFlushObservers.AppendElement(aPresShell); EnsureTimerStarted(); } } - void RemoveResizeEventFlushObserver(nsIPresShell* aShell) { - mResizeEventFlushObservers.RemoveElement(aShell); - mDelayedResizeEventFlushObservers.RemoveElement(aShell); + void RemoveResizeEventFlushObserver(mozilla::PresShell* aPresShell) { + mResizeEventFlushObservers.RemoveElement(aPresShell); + mDelayedResizeEventFlushObservers.RemoveElement(aPresShell); } /** * Add / remove presshells that we should flush style and layout on */ - void AddStyleFlushObserver(nsIPresShell* aShell) { - MOZ_DIAGNOSTIC_ASSERT(!mStyleFlushObservers.Contains(aShell), + void AddStyleFlushObserver(mozilla::PresShell* aPresShell) { + MOZ_DIAGNOSTIC_ASSERT(!mStyleFlushObservers.Contains(aPresShell), "Double-adding style flush observer"); - mStyleFlushObservers.AppendElement(aShell); + mStyleFlushObservers.AppendElement(aPresShell); EnsureTimerStarted(); } - void RemoveStyleFlushObserver(nsIPresShell* aShell) { - mStyleFlushObservers.RemoveElement(aShell); + void RemoveStyleFlushObserver(mozilla::PresShell* aPresShell) { + mStyleFlushObservers.RemoveElement(aPresShell); } - void AddLayoutFlushObserver(nsIPresShell* aShell) { - MOZ_DIAGNOSTIC_ASSERT(!IsLayoutFlushObserver(aShell), + void AddLayoutFlushObserver(mozilla::PresShell* aPresShell) { + MOZ_DIAGNOSTIC_ASSERT(!IsLayoutFlushObserver(aPresShell), "Double-adding layout flush observer"); - mLayoutFlushObservers.AppendElement(aShell); + mLayoutFlushObservers.AppendElement(aPresShell); EnsureTimerStarted(); } - void RemoveLayoutFlushObserver(nsIPresShell* aShell) { - mLayoutFlushObservers.RemoveElement(aShell); + void RemoveLayoutFlushObserver(mozilla::PresShell* aPresShell) { + mLayoutFlushObservers.RemoveElement(aPresShell); } - bool IsLayoutFlushObserver(nsIPresShell* aShell) { - return mLayoutFlushObservers.Contains(aShell); + bool IsLayoutFlushObserver(mozilla::PresShell* aPresShell) { + return mLayoutFlushObservers.Contains(aPresShell); } /** @@ -566,10 +566,10 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator, // Scroll events on documents that might have events suppressed. ScrollEventArray mDelayedScrollEvents; - AutoTArray mResizeEventFlushObservers; - AutoTArray mDelayedResizeEventFlushObservers; - AutoTArray mStyleFlushObservers; - AutoTArray mLayoutFlushObservers; + AutoTArray mResizeEventFlushObservers; + AutoTArray mDelayedResizeEventFlushObservers; + AutoTArray mStyleFlushObservers; + AutoTArray mLayoutFlushObservers; // nsTArray on purpose, because we want to be able to swap. nsTArray mFrameRequestCallbackDocs; nsTArray mThrottledFrameRequestCallbackDocs; diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index f9108761996d..d5bf9ce47aed 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -9,6 +9,7 @@ #include "nsStyleSheetService.h" #include "mozilla/MemoryReporting.h" #include "mozilla/PreloadedStyleSheet.h" +#include "mozilla/PresShell.h" #include "mozilla/StyleSheet.h" #include "mozilla/StyleSheetInlines.h" #include "mozilla/Unused.h" @@ -155,8 +156,8 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI* aSheetURI, rv = LoadAndRegisterSheetInternal(aSheetURI, aSheetType); if (NS_SUCCEEDED(rv)) { // Hold on to a copy of the registered PresShells. - nsTArray> toNotify(mPresShells); - for (nsIPresShell* presShell : toNotify) { + nsTArray> toNotify(mPresShells); + for (PresShell* presShell : toNotify) { StyleSheet* sheet = mSheets[aSheetType].LastElement(); presShell->NotifyStyleSheetServiceSheetAdded(sheet, aSheetType); } @@ -321,8 +322,8 @@ nsStyleSheetService::UnregisterSheet(nsIURI* aSheetURI, uint32_t aSheetType) { } // Hold on to a copy of the registered PresShells. - nsTArray> toNotify(mPresShells); - for (nsIPresShell* presShell : toNotify) { + nsTArray> toNotify(mPresShells); + for (PresShell* presShell : toNotify) { if (presShell->StyleSet()) { if (sheet) { presShell->NotifyStyleSheetServiceSheetRemoved(sheet, aSheetType); @@ -389,12 +390,12 @@ size_t nsStyleSheetService::SizeOfIncludingThis( return n; } -void nsStyleSheetService::RegisterPresShell(nsIPresShell* aPresShell) { +void nsStyleSheetService::RegisterPresShell(PresShell* aPresShell) { MOZ_ASSERT(!mPresShells.Contains(aPresShell)); mPresShells.AppendElement(aPresShell); } -void nsStyleSheetService::UnregisterPresShell(nsIPresShell* aPresShell) { +void nsStyleSheetService::UnregisterPresShell(PresShell* aPresShell) { MOZ_ASSERT(mPresShells.Contains(aPresShell)); mPresShells.RemoveElement(aPresShell); } diff --git a/layout/base/nsStyleSheetService.h b/layout/base/nsStyleSheetService.h index db036cafd2e5..83e1f1602665 100644 --- a/layout/base/nsStyleSheetService.h +++ b/layout/base/nsStyleSheetService.h @@ -20,9 +20,12 @@ class nsICategoryManager; class nsIMemoryReporter; -class nsIPresShell; class nsISimpleEnumerator; +namespace mozilla { +class PresShell; +} // namespace mozilla + #define NS_STYLESHEETSERVICE_CID \ { \ 0x3b55e72e, 0xab7e, 0x431b, { \ @@ -50,8 +53,8 @@ class nsStyleSheetService final : public nsIStyleSheetService, SheetArray* UserStyleSheets() { return &mSheets[USER_SHEET]; } SheetArray* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; } - void RegisterPresShell(nsIPresShell* aPresShell); - void UnregisterPresShell(nsIPresShell* aPresShell); + void RegisterPresShell(mozilla::PresShell* aPresShell); + void UnregisterPresShell(mozilla::PresShell* aPresShell); size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; @@ -76,7 +79,7 @@ class nsStyleSheetService final : public nsIStyleSheetService, // Registered PresShells that will be notified when sheets are added and // removed from the style sheet service. - nsTArray> mPresShells; + nsTArray> mPresShells; }; #endif diff --git a/layout/doc/DD-SpaceManager.html b/layout/doc/DD-SpaceManager.html index 39cd165974f7..611e2f3726c4 100644 --- a/layout/doc/DD-SpaceManager.html +++ b/layout/doc/DD-SpaceManager.html @@ -64,7 +64,7 @@ impact intervals. */ class nsSpaceManager { public: - nsSpaceManager(nsIPresShell* aPresShell, nsIFrame* aFrame); + nsSpaceManager(PresShell* aPresShell, nsIFrame* aFrame); ~nsSpaceManager(); void* operator new(size_t aSize); @@ -328,7 +328,7 @@ private: space of this Space Manager is relative to the frame passed in to the constructor.

-
  nsSpaceManager(nsIPresShell* aPresShell, nsIFrame* aFrame);
+
  nsSpaceManager(PresShell* aPresShell, nsIFrame* aFrame);
   ~nsSpaceManager();
 

diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index e47f34d43ab2..a8070c89885f 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -1330,12 +1330,12 @@ nsTextControlFrame::EditorInitializer::Run() { // Need to block script to avoid bug 669767. nsAutoScriptBlocker scriptBlocker; - nsCOMPtr shell = mFrame->PresContext()->GetPresShell(); - bool observes = shell->ObservesNativeAnonMutationsForPrint(); - shell->ObserveNativeAnonMutationsForPrint(true); + RefPtr presShell = mFrame->PresShell(); + bool observes = presShell->ObservesNativeAnonMutationsForPrint(); + presShell->ObserveNativeAnonMutationsForPrint(true); // This can cause the frame to be destroyed (and call Revoke()). mFrame->EnsureEditorInitialized(); - shell->ObserveNativeAnonMutationsForPrint(observes); + presShell->ObserveNativeAnonMutationsForPrint(observes); // The frame can *still* be destroyed even though we have a scriptblocker, // bug 682684. diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index ad814b48ee33..9899a4184a0d 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -150,7 +150,7 @@ void nsContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) { } } - nsIPresShell* shell = PresShell(); + mozilla::PresShell* presShell = PresShell(); nsContainerFrame* lastParent = nullptr; // Loop and destroy aOldFrame and all of its continuations. @@ -167,8 +167,8 @@ void nsContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) { parent->StealFrame(continuation); continuation->Destroy(); if (generateReflowCommand && parent != lastParent) { - shell->FrameNeedsReflow(parent, nsIPresShell::eTreeChange, - NS_FRAME_HAS_DIRTY_CHILDREN); + presShell->FrameNeedsReflow(parent, nsIPresShell::eTreeChange, + NS_FRAME_HAS_DIRTY_CHILDREN); lastParent = parent; } } @@ -185,7 +185,7 @@ void nsContainerFrame::DestroyAbsoluteFrames( void nsContainerFrame::SafelyDestroyFrameListProp( nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData, - nsIPresShell* aPresShell, FrameListPropertyDescriptor aProp) { + mozilla::PresShell* aPresShell, FrameListPropertyDescriptor aProp) { // Note that the last frame can be removed through another route and thus // delete the property -- that's why we fetch the property again before // removing each frame rather than fetching it once and iterating the list. diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index afa2f3d0a8aa..a6425d1ee4de 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -26,6 +26,10 @@ class nsOverflowContinuationTracker; +namespace mozilla { +class PresShell; +} // namespace mozilla + // Some macros for container classes to do sanity checking on // width/height/x/y values computed during reflow. // NOTE: AppUnitsPerCSSPixel value hardwired here to remove the @@ -650,7 +654,7 @@ class nsContainerFrame : public nsSplittableFrame { */ void SafelyDestroyFrameListProp(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData, - nsIPresShell* aPresShell, + mozilla::PresShell* aPresShell, FrameListPropertyDescriptor aProp); // ========================================================================== diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index e4f20ff2072b..ca733aaf7de5 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -12,13 +12,13 @@ #include #include "gfxContext.h" +#include "mozilla/PresShell.h" #include "mozilla/ReflowInput.h" #include "mozilla/ShapeUtils.h" #include "nsBlockFrame.h" #include "nsDeviceContext.h" #include "nsError.h" #include "nsImageRenderer.h" -#include "nsIPresShell.h" #include "nsMemory.h" using namespace mozilla; @@ -31,7 +31,7 @@ void* nsFloatManager::sCachedFloatManagers[NS_FLOAT_MANAGER_CACHE_SIZE]; ///////////////////////////////////////////////////////////////////////////// // nsFloatManager -nsFloatManager::nsFloatManager(nsIPresShell* aPresShell, WritingMode aWM) +nsFloatManager::nsFloatManager(PresShell* aPresShell, WritingMode aWM) : #ifdef DEBUG mWritingMode(aWM), diff --git a/layout/generic/nsFloatManager.h b/layout/generic/nsFloatManager.h index c6238b7f4377..c8614d9f0b94 100644 --- a/layout/generic/nsFloatManager.h +++ b/layout/generic/nsFloatManager.h @@ -19,11 +19,11 @@ #include "nsPoint.h" #include "nsTArray.h" -class nsIPresShell; class nsIFrame; class nsPresContext; namespace mozilla { struct ReflowInput; +class PresShell; class StyleBasicShape; } // namespace mozilla @@ -92,7 +92,8 @@ struct nsFlowAreaRect { */ class nsFloatManager { public: - explicit nsFloatManager(nsIPresShell* aPresShell, mozilla::WritingMode aWM); + explicit nsFloatManager(mozilla::PresShell* aPresShell, + mozilla::WritingMode aWM); ~nsFloatManager(); void* operator new(size_t aSize) CPP_THROW_NEW; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index cfb152d41482..a7b27f3ce61b 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -767,7 +767,7 @@ void nsFrame::DestroyFrom(nsIFrame* aDestructRoot, } nsPresContext* presContext = PresContext(); - nsIPresShell* shell = presContext->GetPresShell(); + mozilla::PresShell* presShell = presContext->GetPresShell(); if (mState & NS_FRAME_OUT_OF_FLOW) { nsPlaceholderFrame* placeholder = GetPlaceholderFrame(); NS_ASSERTION( @@ -817,10 +817,10 @@ void nsFrame::DestroyFrom(nsIFrame* aDestructRoot, // Ensure that we're not in the approximately visible list anymore. PresContext()->GetPresShell()->RemoveFrameFromApproximatelyVisibleList(this); - shell->NotifyDestroyingFrame(this); + presShell->NotifyDestroyingFrame(this); if (mState & NS_FRAME_EXTERNAL_REFERENCE) { - shell->ClearFrameRefs(this); + presShell->ClearFrameRefs(this); } nsView* view = GetView(); @@ -858,7 +858,7 @@ void nsFrame::DestroyFrom(nsIFrame* aDestructRoot, #ifdef DEBUG { - nsIFrame* rootFrame = shell->GetRootFrame(); + nsIFrame* rootFrame = presShell->GetRootFrame(); MOZ_ASSERT(rootFrame); if (this != rootFrame) { const RetainedDisplayListData* data = @@ -876,7 +876,7 @@ void nsFrame::DestroyFrom(nsIFrame* aDestructRoot, // Now that we're totally cleaned out, we need to add ourselves to // the presshell's recycler. - shell->FreeFrame(id, this); + presShell->FreeFrame(id, this); } nsresult nsFrame::GetOffsets(int32_t& aStart, int32_t& aEnd) const { @@ -4037,7 +4037,7 @@ nsresult nsFrame::HandleEvent(nsPresContext* aPresContext, } nsresult nsFrame::GetDataForTableSelection( - const nsFrameSelection* aFrameSelection, nsIPresShell* aPresShell, + const nsFrameSelection* aFrameSelection, mozilla::PresShell* aPresShell, WidgetMouseEvent* aMouseEvent, nsIContent** aParentContent, int32_t* aContentOffset, TableSelection* aTarget) { if (!aFrameSelection || !aPresShell || !aMouseEvent || !aParentContent || diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 14b4fac912bd..ca3cde576403 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -99,18 +99,18 @@ class PresShell; #define NS_DECL_FRAMEARENA_HELPERS(class) \ NS_DECL_QUERYFRAME_TARGET(class) \ static constexpr nsIFrame::ClassID kClassID = nsIFrame::ClassID::class##_id; \ - void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE; \ + void* operator new(size_t, mozilla::PresShell*) MOZ_MUST_OVERRIDE; \ nsQueryFrame::FrameIID GetFrameId() const override MOZ_MUST_OVERRIDE { \ return nsQueryFrame::class##_id; \ } -#define NS_IMPL_FRAMEARENA_HELPERS(class) \ - void* class ::operator new(size_t sz, nsIPresShell* aShell) { \ - return aShell->AllocateFrame(nsQueryFrame::class##_id, sz); \ +#define NS_IMPL_FRAMEARENA_HELPERS(class) \ + void* class ::operator new(size_t sz, mozilla::PresShell* aShell) { \ + return aShell->AllocateFrame(nsQueryFrame::class##_id, sz); \ } -#define NS_DECL_ABSTRACT_FRAME(class) \ - void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE = delete; \ +#define NS_DECL_ABSTRACT_FRAME(class) \ + void* operator new(size_t, mozilla::PresShell*) MOZ_MUST_OVERRIDE = delete; \ nsQueryFrame::FrameIID GetFrameId() const override MOZ_MUST_OVERRIDE = 0; //---------------------------------------------------------------------- @@ -158,7 +158,7 @@ class nsFrame : public nsBox { virtual nsQueryFrame::FrameIID GetFrameId() const MOZ_MUST_OVERRIDE { return kFrameIID; } - void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE; + void* operator new(size_t, mozilla::PresShell*) MOZ_MUST_OVERRIDE; // nsIFrame void Init(nsIContent* aContent, nsContainerFrame* aParent, @@ -648,7 +648,7 @@ class nsFrame : public nsBox { // aTarget tells us what table element to select (currently only cell and // table supported) (enums for this are defined in nsIFrame.h) nsresult GetDataForTableSelection(const nsFrameSelection* aFrameSelection, - nsIPresShell* aPresShell, + mozilla::PresShell* aPresShell, mozilla::WidgetMouseEvent* aMouseEvent, nsIContent** aParentContent, int32_t* aContentOffset, diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp index 226e1ae03f2a..5cc3fcbbdc6e 100644 --- a/layout/generic/nsFrameList.cpp +++ b/layout/generic/nsFrameList.cpp @@ -25,11 +25,11 @@ const AlignedFrameListBytes gEmptyFrameListBytes = {0}; } // namespace layout } // namespace mozilla -void* nsFrameList::operator new(size_t sz, nsIPresShell* aPresShell) { +void* nsFrameList::operator new(size_t sz, mozilla::PresShell* aPresShell) { return aPresShell->AllocateByObjectID(eArenaObjectID_nsFrameList, sz); } -void nsFrameList::Delete(nsIPresShell* aPresShell) { +void nsFrameList::Delete(mozilla::PresShell* aPresShell) { MOZ_ASSERT(this != &EmptyList(), "Shouldn't Delete() this list"); NS_ASSERTION(IsEmpty(), "Shouldn't Delete() a non-empty list"); diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h index 2368abc1806c..0f58349b9472 100644 --- a/layout/generic/nsFrameList.h +++ b/layout/generic/nsFrameList.h @@ -23,10 +23,10 @@ class nsContainerFrame; class nsIContent; class nsIFrame; -class nsIPresShell; class nsPresContext; namespace mozilla { +class PresShell; namespace layout { class FrameChildList; enum FrameChildListID { @@ -86,13 +86,13 @@ class nsFrameList { /** * Infallibly allocate a nsFrameList from the shell arena. */ - void* operator new(size_t sz, nsIPresShell* aPresShell); + void* operator new(size_t sz, mozilla::PresShell* aPresShell); /** * Deallocate this list that was allocated from the shell arena. * The list is required to be empty. */ - void Delete(nsIPresShell* aPresShell); + void Delete(mozilla::PresShell* aPresShell); /** * For each frame in this list: remove it from the list then call diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp index 232b2c36ddd1..2ed684b316d3 100644 --- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -2741,7 +2741,7 @@ void nsFrameSelection::DisconnectFromPresShell() { */ nsresult nsFrameSelection::UpdateSelectionCacheOnRepaintSelection( Selection* aSel) { - PresShell* presShell = static_cast(aSel->GetPresShell()); + PresShell* presShell = aSel->GetPresShell(); if (!presShell) { return NS_OK; } diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 672a3fae175d..45b1883bd137 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -3827,7 +3827,7 @@ class nsIFrame : public nsQueryFrame { /** * @return true if we painted @aPresShell during the last repaint. */ - bool DidPaintPresShell(nsIPresShell* aShell) { + bool DidPaintPresShell(mozilla::PresShell* aShell) { for (nsWeakPtr& item : *PaintedPresShellList()) { nsCOMPtr shell = do_QueryReferent(item); if (shell == aShell) { diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index c0fd3bfff1b1..7a6c939108ff 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -172,8 +172,8 @@ bool nsImageFrame::ShouldShowBrokenImageIcon() const { return loader->GetImageBlockingStatus() != nsIContentPolicy::ACCEPT; } -nsImageFrame* nsImageFrame::CreateContinuingFrame(nsIPresShell* aPresShell, - ComputedStyle* aStyle) const { +nsImageFrame* nsImageFrame::CreateContinuingFrame( + mozilla::PresShell* aPresShell, ComputedStyle* aStyle) const { return new (aPresShell) nsImageFrame(aStyle, aPresShell->GetPresContext(), mKind); } diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 3ba7537532f4..f0609e229434 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -195,7 +195,8 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback { }; // Creates a suitable continuing frame for this frame. - nsImageFrame* CreateContinuingFrame(nsIPresShell*, ComputedStyle*) const; + nsImageFrame* CreateContinuingFrame(mozilla::PresShell*, + ComputedStyle*) const; private: friend nsIFrame* NS_NewImageFrame(mozilla::PresShell*, ComputedStyle*); diff --git a/layout/generic/nsIntervalSet.cpp b/layout/generic/nsIntervalSet.cpp index 6d8c6ad2bdb6..28fed4964e4a 100644 --- a/layout/generic/nsIntervalSet.cpp +++ b/layout/generic/nsIntervalSet.cpp @@ -9,11 +9,11 @@ #include "nsIntervalSet.h" #include #include -#include "nsIPresShell.h" // for allocation +#include "mozilla/PresShell.h" // for allocation using namespace mozilla; -nsIntervalSet::nsIntervalSet(nsIPresShell *aPresShell) +nsIntervalSet::nsIntervalSet(PresShell *aPresShell) : mList(nullptr), mPresShell(aPresShell) {} nsIntervalSet::~nsIntervalSet() { diff --git a/layout/generic/nsIntervalSet.h b/layout/generic/nsIntervalSet.h index bd1f7e82e8d4..1a6424ed73ec 100644 --- a/layout/generic/nsIntervalSet.h +++ b/layout/generic/nsIntervalSet.h @@ -11,7 +11,9 @@ #include "nsCoord.h" -class nsIPresShell; +namespace mozilla { +class PresShell; +} // namespace mozilla /* * A list-based class (hopefully tree-based when I get around to it) @@ -21,7 +23,7 @@ class nsIntervalSet { public: typedef nscoord coord_type; - explicit nsIntervalSet(nsIPresShell *aPresShell); + explicit nsIntervalSet(mozilla::PresShell *aPresShell); ~nsIntervalSet(); /* @@ -64,7 +66,7 @@ class nsIntervalSet { void FreeInterval(Interval *aInterval); Interval *mList; - nsIPresShell *mPresShell; + mozilla::PresShell *mPresShell; }; #endif // !defined(nsIntervalSet_h___) diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp index 451a5fc144eb..5ecab7f65982 100644 --- a/layout/generic/nsLineBox.cpp +++ b/layout/generic/nsLineBox.cpp @@ -76,12 +76,12 @@ nsLineBox::~nsLineBox() { Cleanup(); } -nsLineBox* NS_NewLineBox(nsIPresShell* aPresShell, nsIFrame* aFrame, +nsLineBox* NS_NewLineBox(PresShell* aPresShell, nsIFrame* aFrame, bool aIsBlock) { return new (aPresShell) nsLineBox(aFrame, 1, aIsBlock); } -nsLineBox* NS_NewLineBox(nsIPresShell* aPresShell, nsLineBox* aFromLine, +nsLineBox* NS_NewLineBox(PresShell* aPresShell, nsLineBox* aFromLine, nsIFrame* aFrame, int32_t aCount) { nsLineBox* newLine = new (aPresShell) nsLineBox(aFrame, aCount, false); newLine->NoteFramesMovedFrom(aFromLine); @@ -154,11 +154,11 @@ void nsLineBox::NoteFramesMovedFrom(nsLineBox* aFromLine) { } } -void* nsLineBox::operator new(size_t sz, nsIPresShell* aPresShell) { +void* nsLineBox::operator new(size_t sz, PresShell* aPresShell) { return aPresShell->AllocateByObjectID(eArenaObjectID_nsLineBox, sz); } -void nsLineBox::Destroy(nsIPresShell* aPresShell) { +void nsLineBox::Destroy(PresShell* aPresShell) { this->nsLineBox::~nsLineBox(); aPresShell->FreeByObjectID(eArenaObjectID_nsLineBox, this); } diff --git a/layout/generic/nsLineBox.h b/layout/generic/nsLineBox.h index 4765da159709..588973360e38 100644 --- a/layout/generic/nsLineBox.h +++ b/layout/generic/nsLineBox.h @@ -22,6 +22,10 @@ class nsFloatCacheList; class nsFloatCacheFreeList; class nsWindowSizes; +namespace mozilla { +class PresShell; +} // namespace mozilla + // State cached after reflowing a float. This state is used during // incremental reflow when we avoid reflowing a float. class nsFloatCache { @@ -140,13 +144,13 @@ class nsFloatCacheFreeList : private nsFloatCacheList { * it's better to use the next function that does that for you in an * optimal way. */ -nsLineBox* NS_NewLineBox(nsIPresShell* aPresShell, nsIFrame* aFrame, +nsLineBox* NS_NewLineBox(mozilla::PresShell* aPresShell, nsIFrame* aFrame, bool aIsBlock); /** * Function to create a line box and initialize it with aCount frames * that are currently on aFromLine. The allocation is infallible. */ -nsLineBox* NS_NewLineBox(nsIPresShell* aPresShell, nsLineBox* aFromLine, +nsLineBox* NS_NewLineBox(mozilla::PresShell* aPresShell, nsLineBox* aFromLine, nsIFrame* aFrame, int32_t aCount); class nsLineList; @@ -191,17 +195,17 @@ class nsLineBox final : public nsLineLink { // Infallible overloaded new operator. Uses an arena (which comes from the // presShell) to perform the allocation. - void* operator new(size_t sz, nsIPresShell* aPresShell); + void* operator new(size_t sz, mozilla::PresShell* aPresShell); void operator delete(void* aPtr, size_t sz) = delete; public: // Use these functions to allocate and destroy line boxes - friend nsLineBox* NS_NewLineBox(nsIPresShell* aPresShell, nsIFrame* aFrame, - bool aIsBlock); - friend nsLineBox* NS_NewLineBox(nsIPresShell* aPresShell, + friend nsLineBox* NS_NewLineBox(mozilla::PresShell* aPresShell, + nsIFrame* aFrame, bool aIsBlock); + friend nsLineBox* NS_NewLineBox(mozilla::PresShell* aPresShell, nsLineBox* aFromLine, nsIFrame* aFrame, int32_t aCount); - void Destroy(nsIPresShell* aPresShell); + void Destroy(mozilla::PresShell* aPresShell); // mBlock bit bool IsBlock() const { return mFlags.mBlock; } diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 7e7dc64d366f..f36217a7b681 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -194,7 +194,7 @@ nsIFrame* nsSubDocumentFrame::GetSubdocumentRootFrame() { return subdocView ? subdocView->GetFrame() : nullptr; } -nsIPresShell* nsSubDocumentFrame::GetSubdocumentPresShellForPainting( +mozilla::PresShell* nsSubDocumentFrame::GetSubdocumentPresShellForPainting( uint32_t aFlags) { if (!mInnerView) return nullptr; @@ -353,7 +353,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, return; } - nsCOMPtr presShell = GetSubdocumentPresShellForPainting( + RefPtr presShell = GetSubdocumentPresShellForPainting( aBuilder->IsIgnoringPaintSuppression() ? IGNORE_PAINT_SUPPRESSION : 0); if (!presShell) { @@ -892,7 +892,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsSubDocumentFrame) class nsHideViewer : public Runnable { public: nsHideViewer(nsIContent* aFrameElement, nsFrameLoader* aFrameLoader, - nsIPresShell* aPresShell, bool aHideViewerIfFrameless) + PresShell* aPresShell, bool aHideViewerIfFrameless) : mozilla::Runnable("nsHideViewer"), mFrameElement(aFrameElement), mFrameLoader(aFrameLoader), @@ -936,7 +936,7 @@ class nsHideViewer : public Runnable { private: nsCOMPtr mFrameElement; RefPtr mFrameLoader; - nsCOMPtr mPresShell; + RefPtr mPresShell; bool mHideViewerIfFrameless; }; diff --git a/layout/generic/nsSubDocumentFrame.h b/layout/generic/nsSubDocumentFrame.h index b40711a27247..3af002aeed0a 100644 --- a/layout/generic/nsSubDocumentFrame.h +++ b/layout/generic/nsSubDocumentFrame.h @@ -14,6 +14,7 @@ #include "Units.h" namespace mozilla { +class PresShell; namespace layout { class RenderFrame; } @@ -94,7 +95,7 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame, nsView* EnsureInnerView(); nsIFrame* GetSubdocumentRootFrame(); enum { IGNORE_PAINT_SUPPRESSION = 0x1 }; - nsIPresShell* GetSubdocumentPresShellForPainting(uint32_t aFlags); + mozilla::PresShell* GetSubdocumentPresShellForPainting(uint32_t aFlags); mozilla::ScreenIntSize GetSubdocumentSize(); // nsIReflowCallback diff --git a/layout/painting/RetainedDisplayListBuilder.cpp b/layout/painting/RetainedDisplayListBuilder.cpp index 700a9b51c14f..227904f85f17 100644 --- a/layout/painting/RetainedDisplayListBuilder.cpp +++ b/layout/painting/RetainedDisplayListBuilder.cpp @@ -208,7 +208,7 @@ void RetainedDisplayListBuilder::IncrementSubDocPresShellPaintCount( static_cast(aItem)->SubDocumentFrame(); MOZ_ASSERT(subDocFrame); - nsIPresShell* presShell = subDocFrame->GetSubdocumentPresShellForPainting(0); + PresShell* presShell = subDocFrame->GetSubdocumentPresShellForPainting(0); MOZ_ASSERT(presShell); mBuilder.IncrementPresShellPaintCount(presShell); @@ -725,11 +725,10 @@ static nsIFrame* GetRootFrameForPainting(nsDisplayListBuilder* aBuilder, nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(subDocFrame); MOZ_ASSERT(subdocumentFrame); - presShell = static_cast( - subdocumentFrame->GetSubdocumentPresShellForPainting( - aBuilder->IsIgnoringPaintSuppression() - ? nsSubDocumentFrame::IGNORE_PAINT_SUPPRESSION - : 0)); + presShell = subdocumentFrame->GetSubdocumentPresShellForPainting( + aBuilder->IsIgnoringPaintSuppression() + ? nsSubDocumentFrame::IGNORE_PAINT_SUPPRESSION + : 0); return presShell ? presShell->GetRootFrame() : nullptr; } diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index f715a798c1aa..63cd1b156dfa 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -1438,10 +1438,9 @@ nsCaret* nsDisplayListBuilder::GetCaret() { return caret; } -void nsDisplayListBuilder::IncrementPresShellPaintCount( - nsIPresShell* aPresShell) { +void nsDisplayListBuilder::IncrementPresShellPaintCount(PresShell* aPresShell) { if (mIsPaintingToWindow) { - mReferenceFrame->AddPaintedPresShell(static_cast(aPresShell)); + mReferenceFrame->AddPaintedPresShell(aPresShell); aPresShell->IncrementPaintCount(); } } diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index f31e60dce9d2..798f3c3ad72d 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -69,6 +69,7 @@ struct WrFiltersHolder; namespace mozilla { class FrameLayerBuilder; +class PresShell; struct MotionPathData; namespace layers { struct FrameMetrics; @@ -823,7 +824,7 @@ class nsDisplayListBuilder { void LeavePresShell(nsIFrame* aReferenceFrame, nsDisplayList* aPaintedContents); - void IncrementPresShellPaintCount(nsIPresShell* aPresShell); + void IncrementPresShellPaintCount(mozilla::PresShell* aPresShell); /** * Returns true if we're currently building a display list that's @@ -1886,7 +1887,7 @@ class nsDisplayListBuilder { bool AddToAGRBudget(nsIFrame* aFrame); struct PresShellState { - nsIPresShell* mPresShell; + mozilla::PresShell* mPresShell; #ifdef DEBUG mozilla::Maybe mAutoLayoutPhase; #endif diff --git a/layout/printing/nsPrintJob.cpp b/layout/printing/nsPrintJob.cpp index 933155ef74c5..57855851108b 100644 --- a/layout/printing/nsPrintJob.cpp +++ b/layout/printing/nsPrintJob.cpp @@ -1642,7 +1642,7 @@ nsresult nsPrintJob::ReconstructAndReflow(bool doSetPixelScale) { } } - RefPtr presShell = static_cast(po->mPresShell.get()); + RefPtr presShell = po->mPresShell; presShell->FlushPendingNotifications(FlushType::Layout); // If the printing was canceled or restarted with different data, @@ -2282,8 +2282,7 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr& aPO) { if (mIsCreatingPrintPreview && documentIsTopLevel) { mDocViewerPrint->SetPrintPreviewPresentation( - aPO->mViewManager, aPO->mPresContext, - static_cast(aPO->mPresShell.get())); + aPO->mViewManager, aPO->mPresContext, aPO->mPresShell.get()); } rv = aPO->mPresShell->Initialize(); @@ -2292,7 +2291,7 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr& aPO) { NS_ASSERTION(aPO->mPresShell, "Presshell should still be here"); // Process the reflow event Initialize posted - RefPtr presShell = static_cast(aPO->mPresShell.get()); + RefPtr presShell = aPO->mPresShell; presShell->FlushPendingNotifications(FlushType::Layout); rv = UpdateSelectionAndShrinkPrintObject(aPO.get(), documentIsTopLevel); @@ -2512,7 +2511,7 @@ nsresult nsPrintJob::DoPrint(const UniquePtr& aPO) { gFrameTypesStr[aPO->mFrameType])); PR_PL(("****** In DV::DoPrint PO: %p \n", aPO.get())); - nsIPresShell* poPresShell = aPO->mPresShell; + PresShell* poPresShell = aPO->mPresShell; nsPresContext* poPresContext = aPO->mPresContext; NS_ASSERTION(poPresContext, "PrintObject has not been reflowed"); @@ -3487,9 +3486,8 @@ static void RootFrameList(nsPresContext* aPresContext, FILE* out, const char* aPrefix) { if (!aPresContext || !out) return; - nsIPresShell* shell = aPresContext->GetPresShell(); - if (shell) { - nsIFrame* frame = shell->GetRootFrame(); + if (PresShell* presShell = aPresContext->GetPresShell()) { + nsIFrame* frame = presShell->GetRootFrame(); if (frame) { frame->List(out, aPrefix); } @@ -3537,9 +3535,8 @@ static void DumpViews(nsIDocShell* aDocShell, FILE* out) { if (nullptr != aDocShell) { fprintf(out, "docshell=%p \n", aDocShell); - nsIPresShell* shell = aDocShell->GetPresShell(); - if (shell) { - nsViewManager* vm = shell->GetViewManager(); + if (PresShell* presShell = aDocShell->GetPresShell()) { + nsViewManager* vm = presShell->GetViewManager(); if (vm) { nsView* root = vm->GetRootView(); if (root) { diff --git a/layout/printing/nsPrintJob.h b/layout/printing/nsPrintJob.h index d437d74b9dac..c5079472b079 100644 --- a/layout/printing/nsPrintJob.h +++ b/layout/printing/nsPrintJob.h @@ -32,6 +32,7 @@ class nsIDocShell; class nsIPageSequenceFrame; namespace mozilla { +class PresShell; namespace dom { class Document; } @@ -161,7 +162,7 @@ class nsPrintJob final : public nsIObserver, bool CheckBeforeDestroy(); nsresult Cancelled(); - nsIPresShell* GetPrintPreviewPresShell() { + mozilla::PresShell* GetPrintPreviewPresShell() { return mPrtPreview->mPrintObject->mPresShell; } diff --git a/layout/printing/nsPrintObject.cpp b/layout/printing/nsPrintObject.cpp index 3b7c596bcc96..4f37c96b9f16 100644 --- a/layout/printing/nsPrintObject.cpp +++ b/layout/printing/nsPrintObject.cpp @@ -15,10 +15,11 @@ #include "nsComponentManagerUtils.h" #include "nsIDocShellTreeItem.h" #include "nsIBaseWindow.h" -#include "mozilla/dom/Document.h" #include "nsDocShell.h" +#include "mozilla/PresShell.h" #include "mozilla/dom/BrowsingContext.h" +#include "mozilla/dom/Document.h" #include "mozilla/dom/Element.h" using mozilla::dom::BrowsingContext; @@ -116,9 +117,9 @@ void nsPrintObject::DestroyPresentation() { if (mPresShell) { mPresShell->EndObservingDocument(); nsAutoScriptBlocker scriptBlocker; - nsCOMPtr shell = mPresShell; + RefPtr presShell = mPresShell; mPresShell = nullptr; - shell->Destroy(); + presShell->Destroy(); } mPresContext = nullptr; mViewManager = nullptr; diff --git a/layout/printing/nsPrintObject.h b/layout/printing/nsPrintObject.h index 591c2a741c76..7411745cf7da 100644 --- a/layout/printing/nsPrintObject.h +++ b/layout/printing/nsPrintObject.h @@ -16,9 +16,12 @@ #include "nsIDocShellTreeOwner.h" class nsIContent; -class nsIPresShell; class nsPresContext; +namespace mozilla { +class PresShell; +} // namespace mozilla + // nsPrintObject Document Type enum PrintObjectType { eDoc = 0, eFrame = 1, eIFrame = 2, eFrameSet = 3 }; @@ -43,7 +46,7 @@ class nsPrintObject { RefPtr mDocument; RefPtr mPresContext; - nsCOMPtr mPresShell; + RefPtr mPresShell; RefPtr mViewManager; nsCOMPtr mContent; diff --git a/layout/style/ComputedStyle.h b/layout/style/ComputedStyle.h index 2a8c4da6ec33..98c82abe5db7 100644 --- a/layout/style/ComputedStyle.h +++ b/layout/style/ComputedStyle.h @@ -25,7 +25,6 @@ #include "nsStyleStructFwd.h" enum nsChangeHint : uint32_t; -class nsIPresShell; class nsPresContext; class nsWindowSizes; diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index 39caf932335b..2fd08d66bdba 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -888,9 +888,10 @@ class DependentBuiltinCounterStyle final : public BuiltinCounterStyle { } void Destroy() { - nsIPresShell* shell = mManager->PresContext()->PresShell(); + PresShell* presShell = mManager->PresContext()->PresShell(); this->~DependentBuiltinCounterStyle(); - shell->FreeByObjectID(eArenaObjectID_DependentBuiltinCounterStyle, this); + presShell->FreeByObjectID(eArenaObjectID_DependentBuiltinCounterStyle, + this); } private: @@ -983,9 +984,9 @@ class CustomCounterStyle final : public CounterStyle { } void Destroy() { - nsIPresShell* shell = mManager->PresContext()->PresShell(); + PresShell* presShell = mManager->PresContext()->PresShell(); this->~CustomCounterStyle(); - shell->FreeByObjectID(eArenaObjectID_CustomCounterStyle, this); + presShell->FreeByObjectID(eArenaObjectID_CustomCounterStyle, this); } private: diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 6c0c9c42bc69..d64ed3023975 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -499,7 +499,7 @@ static inline PseudoStyleType GetPseudoType(nsAtom* aPseudo) { } already_AddRefed nsComputedDOMStyle::DoGetComputedStyleNoFlush( - Element* aElement, nsAtom* aPseudo, nsIPresShell* aPresShell, + Element* aElement, nsAtom* aPseudo, PresShell* aPresShell, StyleType aStyleType) { MOZ_ASSERT(aElement, "NULL element"); @@ -508,7 +508,8 @@ already_AddRefed nsComputedDOMStyle::DoGetComputedStyleNoFlush( // set. Using the pres shell from the content also means that any // content that's actually *in* a document will get the style from the // correct document. - nsIPresShell* presShell = nsContentUtils::GetPresShellForContent(aElement); + PresShell* presShell = + static_cast(nsContentUtils::GetPresShellForContent(aElement)); bool inDocWithShell = true; if (!presShell) { inDocWithShell = false; @@ -822,7 +823,7 @@ void nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) { mFlushedPendingReflows = aNeedsLayoutFlush; #endif - nsCOMPtr presShellForContent = + RefPtr presShellForContent = nsContentUtils::GetPresShellForContent(mElement); if (presShellForContent && presShellForContent->GetDocument() != document) { presShellForContent->GetDocument()->FlushPendingNotifications( diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index ba50c69097e1..6d14ca316ad7 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -30,13 +30,13 @@ namespace dom { class DocGroup; class Element; } // namespace dom +class PresShell; struct ComputedGridTrackInfo; } // namespace mozilla struct ComputedStyleMap; struct nsCSSKTableEntry; class nsIFrame; -class nsIPresShell; class nsDOMCSSValueList; struct nsMargin; class nsROCSSPrimitiveValue; @@ -153,7 +153,7 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration, void SetFrameComputedStyle(ComputedStyle* aStyle, uint64_t aGeneration); static already_AddRefed DoGetComputedStyleNoFlush( - Element* aElement, nsAtom* aPseudo, nsIPresShell* aPresShell, + Element* aElement, nsAtom* aPseudo, mozilla::PresShell* aPresShell, StyleType aStyleType); #define STYLE_STRUCT(name_) \ @@ -433,7 +433,7 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration, * While computing style data, the presshell we're working with. Null * otherwise. */ - nsIPresShell* mPresShell; + mozilla::PresShell* mPresShell; /* * The kind of styles we should be returning. diff --git a/layout/style/nsFontFaceUtils.cpp b/layout/style/nsFontFaceUtils.cpp index 58a944724037..9ac8f877e442 100644 --- a/layout/style/nsFontFaceUtils.cpp +++ b/layout/style/nsFontFaceUtils.cpp @@ -84,7 +84,7 @@ static FontUsageKind FrameFontUsage(nsIFrame* aFrame, } // TODO(emilio): Can we use the restyle-hint machinery instead of this? -static void ScheduleReflow(nsIPresShell* aShell, nsIFrame* aFrame) { +static void ScheduleReflow(PresShell* aPresShell, nsIFrame* aFrame) { nsIFrame* f = aFrame; if (f->IsFrameOfType(nsIFrame::eSVG) || nsSVGUtils::IsInSVGTextSubtree(f)) { // SVG frames (and the non-SVG descendants of an SVGTextFrame) need special @@ -114,7 +114,8 @@ static void ScheduleReflow(nsIPresShell* aShell, nsIFrame* aFrame) { } } - aShell->FrameNeedsReflow(f, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY); + aPresShell->FrameNeedsReflow(f, nsIPresShell::eStyleChange, + NS_FRAME_IS_DIRTY); } enum class ReflowAlreadyScheduled { diff --git a/layout/svg/SVGObserverUtils.cpp b/layout/svg/SVGObserverUtils.cpp index efb1a386a22c..7d806cb358ed 100644 --- a/layout/svg/SVGObserverUtils.cpp +++ b/layout/svg/SVGObserverUtils.cpp @@ -93,7 +93,7 @@ struct nsSVGFrameReferenceFromProperty { private: // The frame that our property is attached to (may be null). nsIFrame* mFrame; - nsIPresShell* mFramePresShell; + mozilla::PresShell* mFramePresShell; }; void SVGRenderingObserver::StartObserving() { diff --git a/layout/xul/nsBoxLayoutState.h b/layout/xul/nsBoxLayoutState.h index df9b810e399f..b1f37efdba42 100644 --- a/layout/xul/nsBoxLayoutState.h +++ b/layout/xul/nsBoxLayoutState.h @@ -14,12 +14,12 @@ #ifndef nsBoxLayoutState_h___ #define nsBoxLayoutState_h___ -#include "mozilla/PresShell.h" #include "nsCOMPtr.h" #include "nsPresContext.h" class gfxContext; namespace mozilla { +class PresShell; struct ReflowInput; } // namespace mozilla @@ -35,7 +35,7 @@ class MOZ_STACK_CLASS nsBoxLayoutState { nsBoxLayoutState(const nsBoxLayoutState& aState); nsPresContext* PresContext() const { return mPresContext; } - nsIPresShell* PresShell() const { return mPresContext->PresShell(); } + mozilla::PresShell* PresShell() const { return mPresContext->PresShell(); } uint32_t LayoutFlags() const { return mLayoutFlags; } void SetLayoutFlags(uint32_t aFlags) { mLayoutFlags = aFlags; } diff --git a/layout/xul/nsGroupBoxFrame.cpp b/layout/xul/nsGroupBoxFrame.cpp index 40479b09da59..611ae91bc617 100644 --- a/layout/xul/nsGroupBoxFrame.cpp +++ b/layout/xul/nsGroupBoxFrame.cpp @@ -71,8 +71,8 @@ class nsGroupBoxFrame final : public nsBoxFrame { class nsGroupBoxInnerFrame : public nsBoxFrame { public: - nsGroupBoxInnerFrame(nsIPresShell* aShell, ComputedStyle* aStyle): - nsBoxFrame(aShell, aContext) {} + nsGroupBoxInnerFrame(PresShell* aPresShell, ComputedStyle* aStyle): + nsBoxFrame(aPresShell, aContext) {} #ifdef DEBUG_FRAME_DUMP diff --git a/layout/xul/nsIPopupContainer.h b/layout/xul/nsIPopupContainer.h index 0e56b1a2d386..b3d1758b6afb 100644 --- a/layout/xul/nsIPopupContainer.h +++ b/layout/xul/nsIPopupContainer.h @@ -9,10 +9,10 @@ #include "nsQueryFrame.h" class nsPopupSetFrame; -class nsIPresShell; class nsIContent; namespace mozilla { +class PresShell; namespace dom { class Element; } @@ -28,7 +28,7 @@ class nsIPopupContainer { virtual mozilla::dom::Element* GetDefaultTooltip() = 0; virtual void SetDefaultTooltip(mozilla::dom::Element* aTooltip) = 0; - static nsIPopupContainer* GetPopupContainer(nsIPresShell* aShell); + static nsIPopupContainer* GetPopupContainer(mozilla::PresShell* aShell); }; #endif diff --git a/layout/xul/nsResizerFrame.cpp b/layout/xul/nsResizerFrame.cpp index 091be60020b6..d1103ffd81f7 100644 --- a/layout/xul/nsResizerFrame.cpp +++ b/layout/xul/nsResizerFrame.cpp @@ -320,7 +320,7 @@ nsresult nsResizerFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } -nsIContent* nsResizerFrame::GetContentToResize(nsIPresShell* aPresShell, +nsIContent* nsResizerFrame::GetContentToResize(mozilla::PresShell* aPresShell, nsIBaseWindow** aWindow) { *aWindow = nullptr; diff --git a/layout/xul/nsResizerFrame.h b/layout/xul/nsResizerFrame.h index 2a536db3da74..4de0715bc4e4 100644 --- a/layout/xul/nsResizerFrame.h +++ b/layout/xul/nsResizerFrame.h @@ -41,7 +41,7 @@ class nsResizerFrame final : public nsTitleBarFrame { virtual void MouseClicked(mozilla::WidgetMouseEvent* aEvent) override; protected: - nsIContent* GetContentToResize(nsIPresShell* aPresShell, + nsIContent* GetContentToResize(mozilla::PresShell* aPresShell, nsIBaseWindow** aWindow); Direction GetDirection(); diff --git a/layout/xul/nsRootBoxFrame.cpp b/layout/xul/nsRootBoxFrame.cpp index ab592d763aeb..49f19517a4cf 100644 --- a/layout/xul/nsRootBoxFrame.cpp +++ b/layout/xul/nsRootBoxFrame.cpp @@ -7,7 +7,6 @@ #include "nsHTMLParts.h" #include "nsStyleConsts.h" #include "nsGkAtoms.h" -#include "nsIPresShell.h" #include "nsBoxFrame.h" #include "nsDisplayList.h" #include "nsStackLayout.h" @@ -24,11 +23,11 @@ using namespace mozilla; //#define DEBUG_REFLOW // static -nsIPopupContainer* nsIPopupContainer::GetPopupContainer(nsIPresShell* aShell) { - if (!aShell) { +nsIPopupContainer* nsIPopupContainer::GetPopupContainer(PresShell* aPresShell) { + if (!aPresShell) { return nullptr; } - nsIFrame* rootFrame = aShell->GetRootFrame(); + nsIFrame* rootFrame = aPresShell->GetRootFrame(); if (!rootFrame) { return nullptr; } diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index 61dfed4c5213..7a4136d5a770 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -893,7 +893,7 @@ nsresult nsSliderMediator::HandleEvent(dom::Event* aEvent) { class AsyncScrollbarDragStarter final : public nsAPostRefreshObserver { public: - AsyncScrollbarDragStarter(nsIPresShell* aPresShell, nsIWidget* aWidget, + AsyncScrollbarDragStarter(mozilla::PresShell* aPresShell, nsIWidget* aWidget, const AsyncDragMetrics& aDragMetrics) : mPresShell(aPresShell), mWidget(aWidget), mDragMetrics(aDragMetrics) {} virtual ~AsyncScrollbarDragStarter() {} @@ -922,7 +922,7 @@ class AsyncScrollbarDragStarter final : public nsAPostRefreshObserver { } private: - RefPtr mPresShell; + RefPtr mPresShell; RefPtr mWidget; AsyncDragMetrics mDragMetrics; }; diff --git a/layout/xul/nsStackFrame.cpp b/layout/xul/nsStackFrame.cpp index 94af6a99382d..81f1ccf8e49e 100644 --- a/layout/xul/nsStackFrame.cpp +++ b/layout/xul/nsStackFrame.cpp @@ -18,7 +18,6 @@ #include "nsIContent.h" #include "nsCOMPtr.h" #include "nsHTMLParts.h" -#include "nsIPresShell.h" #include "nsCSSRendering.h" #include "nsBoxLayoutState.h" #include "nsStackLayout.h" diff --git a/layout/xul/nsStackLayout.h b/layout/xul/nsStackLayout.h index d934435b7008..46eabed79ff8 100644 --- a/layout/xul/nsStackLayout.h +++ b/layout/xul/nsStackLayout.h @@ -20,8 +20,6 @@ one time. So the can be flipped though like a deck of cards. #include "nsCOMPtr.h" #include "nsCoord.h" -class nsIPresShell; - nsresult NS_NewStackLayout(nsCOMPtr& aNewLayout); class nsStackLayout : public nsBoxLayout { diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index a6707d06ee5d..1e8a7b24fa41 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -449,7 +449,7 @@ void nsXULPopupManager::AdjustPopupsOnWindowChange( } } -void nsXULPopupManager::AdjustPopupsOnWindowChange(nsIPresShell* aPresShell) { +void nsXULPopupManager::AdjustPopupsOnWindowChange(PresShell* aPresShell) { if (aPresShell->GetDocument()) { AdjustPopupsOnWindowChange(aPresShell->GetDocument()->GetWindow()); } @@ -2630,7 +2630,7 @@ nsXULMenuCommandEvent::Run() { nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); if (!pm) return NS_OK; - // The order of the nsViewManager and nsIPresShell COM pointers is + // The order of the nsViewManager and PresShell COM pointers is // important below. We want the pres shell to get released before the // associated view manager on exit from this function. // See bug 54233. diff --git a/layout/xul/nsXULPopupManager.h b/layout/xul/nsXULPopupManager.h index 4df46007ea92..4522adf1d4b1 100644 --- a/layout/xul/nsXULPopupManager.h +++ b/layout/xul/nsXULPopupManager.h @@ -58,6 +58,7 @@ class nsPIDOMWindowOuter; class nsRefreshDriver; namespace mozilla { +class PresShell; namespace dom { class Event; class KeyboardEvent; @@ -362,7 +363,7 @@ class nsXULPopupManager final : public nsIDOMEventListener, // This should be called when a window is moved or resized to adjust the // popups accordingly. void AdjustPopupsOnWindowChange(nsPIDOMWindowOuter* aWindow); - void AdjustPopupsOnWindowChange(nsIPresShell* aPresShell); + void AdjustPopupsOnWindowChange(mozilla::PresShell* aPresShell); // given a menu frame, find the prevous or next menu frame. If aPopup is // true then navigate a menupopup, from one item on the menu to the previous