Bug 1544343 - part 3: Make layout use mozilla::PresShell instead of nsIPresShell as far as possible r=emilio

This patch changes remaining things under `layout/`.  However, there are some
places which still need to use `nsIPresShell`.  That will be fixed in a
follow up bug.

Differential Revision: https://phabricator.services.mozilla.com/D27477

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-04-16 07:25:10 +00:00
Родитель 2f9688c14e
Коммит f5737567dd
68 изменённых файлов: 301 добавлений и 298 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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<dom::AnonymousContent> mCaretElementHolder;

Просмотреть файл

@ -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() {

Просмотреть файл

@ -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<AccessibleCaretManager> mManager;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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.

Просмотреть файл

@ -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<nsPIDOMWindowOuter> 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<nsIPresShell> presShell = mPresShell;
RefPtr<PresShell> presShell = mPresShell;
presShell->ResizeReflowIgnoreOverride(
nsPresContext::CSSPixelsToAppUnits(aNewSize.width),
nsPresContext::CSSPixelsToAppUnits(aNewSize.height),

Просмотреть файл

@ -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<dom::Document> mDocument;
// raw ref since the presShell owns this
nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
PresShell* MOZ_NON_OWNING_REF mPresShell;
nsCOMPtr<dom::EventTarget> mEventTarget;
};

Просмотреть файл

@ -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;

Просмотреть файл

@ -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<PresShell*>(this)), \
"Unexpected state"); \
} else { \
MOZ_ASSERT(!mPresContext->RefreshDriver()->IsLayoutFlushObserver( \
static_cast<PresShell*>(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<PresShell*>(this));
}
if (mObservingLayoutFlushes) {
rd->RemoveLayoutFlushObserver(this);
rd->RemoveLayoutFlushObserver(static_cast<PresShell*>(this));
}
if (mObservingStyleFlushes) {
rd->RemoveStyleFlushObserver(this);
rd->RemoveStyleFlushObserver(static_cast<PresShell*>(this));
}
}
void nsIPresShell::StartObservingRefreshDriver() {
nsRefreshDriver* rd = mPresContext->RefreshDriver();
if (mResizeEventPending) {
rd->AddResizeEventFlushObserver(this);
rd->AddResizeEventFlushObserver(static_cast<PresShell*>(this));
}
if (mObservingLayoutFlushes) {
rd->AddLayoutFlushObserver(this);
rd->AddLayoutFlushObserver(static_cast<PresShell*>(this));
}
if (mObservingStyleFlushes) {
rd->AddStyleFlushObserver(this);
rd->AddStyleFlushObserver(static_cast<PresShell*>(this));
}
}
@ -1682,7 +1683,7 @@ nsresult PresShell::Initialize() {
NS_ASSERTION(!mDidInitialize, "Why are we being called?");
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
RefPtr<PresShell> kungFuDeathGrip(this);
RecomputeFontSizeInflationEnabled();
MOZ_DIAGNOSTIC_ASSERT(!mIsDestroying);
@ -1892,7 +1893,7 @@ nsresult PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight,
GetPresContext()->SuppressingResizeReflow();
RefPtr<nsViewManager> viewManager = mViewManager;
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
RefPtr<PresShell> 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<PresShell*>(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<nsIPresShell> kungFuDeathGrip = this;
RefPtr<PresShell> 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<PresShell*>(this));
mFrameConstructor->NotifyCounterStylesAreDirty();
}
@ -4392,7 +4394,7 @@ void PresShell::ReconstructFrames() {
return;
}
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
RefPtr<PresShell> 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<nsIPresShell> kungFuDeathGrip(this);
RefPtr<PresShell> 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<PresShell*>(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<PresShell*>(this));
}
}
@ -9560,7 +9562,8 @@ void nsIPresShell::DoObserveLayoutFlushes() {
mObservingLayoutFlushes = true;
if (MOZ_LIKELY(!mDocument->GetBFCacheEntry())) {
mPresContext->RefreshDriver()->AddLayoutFlushObserver(this);
mPresContext->RefreshDriver()->AddLayoutFlushObserver(
static_cast<PresShell*>(this));
}
}
@ -9880,7 +9883,7 @@ bool nsIPresShell::VerifyIncrementalReflow() {
// reflowing the test frame tree
vm->SetPresShell(presShell);
{
nsAutoCauseReflowNotifier crNotifier(this);
nsAutoCauseReflowNotifier crNotifier(static_cast<PresShell*>(this));
presShell->Initialize();
}
mDocument->BindingManager()->ProcessAttachedQueue();

Просмотреть файл

@ -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<nsIURI> GetDocumentURIToCompareWithBlacklist(
PresShell& aPresShell);

Просмотреть файл

@ -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.

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<mozilla::dom::Document> mDocument;
// raw ref since the presShell owns this
nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
mozilla::PresShell* MOZ_NON_OWNING_REF mPresShell;
nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
mozilla::Maybe<mozilla::layers::ScrollableLayerGuid> mGuid;
};

Просмотреть файл

@ -6909,8 +6909,7 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
#ifdef ACCESSIBILITY
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
accService->ContentRangeInserted(static_cast<PresShell*>(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<PresShell*>(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<PresShell*>(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<PresShell*>(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<PresShell*>(mPresShell),
child, nullptr);
accService->ContentRangeInserted(mPresShell, child, nullptr);
}
}
#endif

Просмотреть файл

@ -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<nsISelectionController> selCon = do_QueryReferent(mPresShell);
if (!selCon) {
return NS_ERROR_FAILURE;
}
RefPtr<Selection> selection =
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL);
aPresShell->GetSelection(nsISelectionController::SELECTION_NORMAL);
if (!selection) {
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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"

Просмотреть файл

@ -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<nsSubDocumentFrame*>(aFrame)
->GetSubdocumentPresShellForPainting(0);
PresShell* presShell = static_cast<nsSubDocumentFrame*>(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<EventTarget*> 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<nsIPresShell> GetPresShell(const nsIContent* aContent) {
nsCOMPtr<nsIPresShell> 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<nsIPresShell> shell = GetPresShell(content);
if (!shell) {
RefPtr<PresShell> 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 */

Просмотреть файл

@ -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.

Просмотреть файл

@ -1508,8 +1508,8 @@ static nsDocShell* GetDocShell(nsPresContext* aPresContext) {
return static_cast<nsDocShell*>(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<nsIPresShell*, 16> observers;
AutoTArray<PresShell*, 16> 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<nsIPresShell*, 16> observers;
AutoTArray<PresShell*, 16> 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> presShell = static_cast<PresShell*>(rawPresShell);
RefPtr<PresShell> 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<nsIPresShell*, 16> observers;
AutoTArray<PresShell*, 16> 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> presShell = static_cast<PresShell*>(rawPresShell);
RefPtr<PresShell> presShell = rawPresShell;
presShell->mObservingLayoutFlushes = false;
presShell->mWasLastReflowInterrupted = false;
FlushType flushType = HasPendingAnimations(presShell)

Просмотреть файл

@ -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<nsIPresShell*, 16> mResizeEventFlushObservers;
AutoTArray<nsIPresShell*, 16> mDelayedResizeEventFlushObservers;
AutoTArray<nsIPresShell*, 16> mStyleFlushObservers;
AutoTArray<nsIPresShell*, 16> mLayoutFlushObservers;
AutoTArray<mozilla::PresShell*, 16> mResizeEventFlushObservers;
AutoTArray<mozilla::PresShell*, 16> mDelayedResizeEventFlushObservers;
AutoTArray<mozilla::PresShell*, 16> mStyleFlushObservers;
AutoTArray<mozilla::PresShell*, 16> mLayoutFlushObservers;
// nsTArray on purpose, because we want to be able to swap.
nsTArray<Document*> mFrameRequestCallbackDocs;
nsTArray<Document*> mThrottledFrameRequestCallbackDocs;

Просмотреть файл

@ -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<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
for (nsIPresShell* presShell : toNotify) {
nsTArray<RefPtr<PresShell>> 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<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
for (nsIPresShell* presShell : toNotify) {
nsTArray<RefPtr<PresShell>> 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);
}

Просмотреть файл

@ -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<nsCOMPtr<nsIPresShell>> mPresShells;
nsTArray<RefPtr<mozilla::PresShell>> mPresShells;
};
#endif

Просмотреть файл

@ -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.
</p>
<pre> nsSpaceManager(nsIPresShell* aPresShell, nsIFrame* aFrame);
<pre> nsSpaceManager(PresShell* aPresShell, nsIFrame* aFrame);
~nsSpaceManager();
</pre>
<p>

Просмотреть файл

@ -1330,12 +1330,12 @@ nsTextControlFrame::EditorInitializer::Run() {
// Need to block script to avoid bug 669767.
nsAutoScriptBlocker scriptBlocker;
nsCOMPtr<nsIPresShell> shell = mFrame->PresContext()->GetPresShell();
bool observes = shell->ObservesNativeAnonMutationsForPrint();
shell->ObserveNativeAnonMutationsForPrint(true);
RefPtr<mozilla::PresShell> 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.

Просмотреть файл

@ -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.

Просмотреть файл

@ -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);
// ==========================================================================

Просмотреть файл

@ -12,13 +12,13 @@
#include <initializer_list>
#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),

Просмотреть файл

@ -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;

Просмотреть файл

@ -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 ||

Просмотреть файл

@ -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,

Просмотреть файл

@ -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");

Просмотреть файл

@ -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

Просмотреть файл

@ -2741,7 +2741,7 @@ void nsFrameSelection::DisconnectFromPresShell() {
*/
nsresult nsFrameSelection::UpdateSelectionCacheOnRepaintSelection(
Selection* aSel) {
PresShell* presShell = static_cast<PresShell*>(aSel->GetPresShell());
PresShell* presShell = aSel->GetPresShell();
if (!presShell) {
return NS_OK;
}

Просмотреть файл

@ -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<nsIPresShell> shell = do_QueryReferent(item);
if (shell == aShell) {

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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*);

Просмотреть файл

@ -9,11 +9,11 @@
#include "nsIntervalSet.h"
#include <new>
#include <algorithm>
#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() {

Просмотреть файл

@ -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___)

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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<nsIPresShell> presShell = GetSubdocumentPresShellForPainting(
RefPtr<mozilla::PresShell> 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<nsIContent> mFrameElement;
RefPtr<nsFrameLoader> mFrameLoader;
nsCOMPtr<nsIPresShell> mPresShell;
RefPtr<PresShell> mPresShell;
bool mHideViewerIfFrameless;
};

Просмотреть файл

@ -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

Просмотреть файл

@ -208,7 +208,7 @@ void RetainedDisplayListBuilder::IncrementSubDocPresShellPaintCount(
static_cast<nsDisplaySubDocument*>(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<PresShell*>(
subdocumentFrame->GetSubdocumentPresShellForPainting(
aBuilder->IsIgnoringPaintSuppression()
? nsSubDocumentFrame::IGNORE_PAINT_SUPPRESSION
: 0));
presShell = subdocumentFrame->GetSubdocumentPresShellForPainting(
aBuilder->IsIgnoringPaintSuppression()
? nsSubDocumentFrame::IGNORE_PAINT_SUPPRESSION
: 0);
return presShell ? presShell->GetRootFrame() : nullptr;
}

Просмотреть файл

@ -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<PresShell*>(aPresShell));
mReferenceFrame->AddPaintedPresShell(aPresShell);
aPresShell->IncrementPaintCount();
}
}

Просмотреть файл

@ -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<nsAutoLayoutPhase> mAutoLayoutPhase;
#endif

Просмотреть файл

@ -1642,7 +1642,7 @@ nsresult nsPrintJob::ReconstructAndReflow(bool doSetPixelScale) {
}
}
RefPtr<PresShell> presShell = static_cast<PresShell*>(po->mPresShell.get());
RefPtr<PresShell> 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<nsPrintObject>& aPO) {
if (mIsCreatingPrintPreview && documentIsTopLevel) {
mDocViewerPrint->SetPrintPreviewPresentation(
aPO->mViewManager, aPO->mPresContext,
static_cast<PresShell*>(aPO->mPresShell.get()));
aPO->mViewManager, aPO->mPresContext, aPO->mPresShell.get());
}
rv = aPO->mPresShell->Initialize();
@ -2292,7 +2291,7 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO) {
NS_ASSERTION(aPO->mPresShell, "Presshell should still be here");
// Process the reflow event Initialize posted
RefPtr<PresShell> presShell = static_cast<PresShell*>(aPO->mPresShell.get());
RefPtr<PresShell> presShell = aPO->mPresShell;
presShell->FlushPendingNotifications(FlushType::Layout);
rv = UpdateSelectionAndShrinkPrintObject(aPO.get(), documentIsTopLevel);
@ -2512,7 +2511,7 @@ nsresult nsPrintJob::DoPrint(const UniquePtr<nsPrintObject>& 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) {

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<nsIPresShell> shell = mPresShell;
RefPtr<PresShell> presShell = mPresShell;
mPresShell = nullptr;
shell->Destroy();
presShell->Destroy();
}
mPresContext = nullptr;
mViewManager = nullptr;

Просмотреть файл

@ -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<mozilla::dom::Document> mDocument;
RefPtr<nsPresContext> mPresContext;
nsCOMPtr<nsIPresShell> mPresShell;
RefPtr<mozilla::PresShell> mPresShell;
RefPtr<nsViewManager> mViewManager;
nsCOMPtr<nsIContent> mContent;

Просмотреть файл

@ -25,7 +25,6 @@
#include "nsStyleStructFwd.h"
enum nsChangeHint : uint32_t;
class nsIPresShell;
class nsPresContext;
class nsWindowSizes;

Просмотреть файл

@ -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:

Просмотреть файл

@ -499,7 +499,7 @@ static inline PseudoStyleType GetPseudoType(nsAtom* aPseudo) {
}
already_AddRefed<ComputedStyle> 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<ComputedStyle> 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<PresShell*>(nsContentUtils::GetPresShellForContent(aElement));
bool inDocWithShell = true;
if (!presShell) {
inDocWithShell = false;
@ -822,7 +823,7 @@ void nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) {
mFlushedPendingReflows = aNeedsLayoutFlush;
#endif
nsCOMPtr<nsIPresShell> presShellForContent =
RefPtr<PresShell> presShellForContent =
nsContentUtils::GetPresShellForContent(mElement);
if (presShellForContent && presShellForContent->GetDocument() != document) {
presShellForContent->GetDocument()->FlushPendingNotifications(

Просмотреть файл

@ -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<ComputedStyle> 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.

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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() {

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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();

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<nsIPresShell> mPresShell;
RefPtr<mozilla::PresShell> mPresShell;
RefPtr<nsIWidget> mWidget;
AsyncDragMetrics mDragMetrics;
};

Просмотреть файл

@ -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"

Просмотреть файл

@ -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<nsBoxLayout>& aNewLayout);
class nsStackLayout : public nsBoxLayout {

Просмотреть файл

@ -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.

Просмотреть файл

@ -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