Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.
Additonally, "shell" is unclear ("docshell" vs. "presshell"). Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.
Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.
Differential Revision: https://phabricator.services.mozilla.com/D25338
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
/* container for a document and its presentation */
|
||||
|
||||
#include "gfxContext.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "nscore.h"
|
||||
@@ -21,7 +22,6 @@
|
||||
#include "mozilla/dom/PopupBlocker.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
@@ -402,7 +402,7 @@ class nsDocumentViewer final : public nsIContentViewer,
|
||||
nsCOMPtr<nsIWidget> mWindow; // may be null
|
||||
RefPtr<nsViewManager> mViewManager;
|
||||
RefPtr<nsPresContext> mPresContext;
|
||||
nsCOMPtr<nsIPresShell> mPresShell;
|
||||
RefPtr<PresShell> mPresShell;
|
||||
|
||||
RefPtr<nsDocViewerSelectionListener> mSelectionListener;
|
||||
RefPtr<nsDocViewerFocusListener> mFocusListener;
|
||||
@@ -730,8 +730,8 @@ nsresult nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow) {
|
||||
UniquePtr<ServoStyleSet> styleSet = CreateStyleSet(mDocument);
|
||||
|
||||
// Now make the shell for the document
|
||||
mPresShell =
|
||||
mDocument->CreateShell(mPresContext, mViewManager, std::move(styleSet));
|
||||
mPresShell = mDocument->CreatePresShell(mPresContext, mViewManager,
|
||||
std::move(styleSet));
|
||||
if (!mPresShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@@ -770,9 +770,9 @@ nsresult nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow) {
|
||||
|
||||
p2a = mPresContext->AppUnitsPerDevPixel(); // zoom may have changed it
|
||||
if (aDoInitialReflow) {
|
||||
nsCOMPtr<nsIPresShell> shell = mPresShell;
|
||||
RefPtr<PresShell> presShell = mPresShell;
|
||||
// Initial reflow
|
||||
shell->Initialize();
|
||||
presShell->Initialize();
|
||||
}
|
||||
|
||||
// now register ourselves as a selection listener, so that we get
|
||||
@@ -880,7 +880,7 @@ nsresult nsDocumentViewer::InitInternal(nsIWidget* aParentWidget,
|
||||
if (!mPresContext &&
|
||||
(aParentWidget || containerView || mDocument->IsBeingUsedAsImage() ||
|
||||
(mDocument->GetDisplayDocument() &&
|
||||
mDocument->GetDisplayDocument()->GetShell()))) {
|
||||
mDocument->GetDisplayDocument()->GetPresShell()))) {
|
||||
// Create presentation context
|
||||
if (mIsPageMode) {
|
||||
// Presentation context already created in SetPageMode which is calling
|
||||
@@ -1009,8 +1009,8 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) {
|
||||
// checking for our mDocument and its window.
|
||||
if (mPresShell && !mStopped) {
|
||||
// Hold strong ref because this could conceivably run script
|
||||
nsCOMPtr<nsIPresShell> shell = mPresShell;
|
||||
shell->FlushPendingNotifications(FlushType::Layout);
|
||||
RefPtr<PresShell> presShell = mPresShell;
|
||||
presShell->FlushPendingNotifications(FlushType::Layout);
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
@@ -1144,8 +1144,8 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) {
|
||||
// Now that the document has loaded, we can tell the presshell
|
||||
// to unsuppress painting.
|
||||
if (mPresShell) {
|
||||
nsCOMPtr<nsIPresShell> shell(mPresShell);
|
||||
shell->UnsuppressPainting();
|
||||
RefPtr<PresShell> presShell = mPresShell;
|
||||
presShell->UnsuppressPainting();
|
||||
// mPresShell could have been removed now, see bug 378682/421432
|
||||
if (mPresShell) {
|
||||
mPresShell->LoadComplete();
|
||||
@@ -1867,8 +1867,8 @@ nsDocumentViewer::Stop(void) {
|
||||
|
||||
if (!mLoaded && mPresShell) {
|
||||
// Well, we might as well paint what we have so far.
|
||||
nsCOMPtr<nsIPresShell> shell(mPresShell); // bug 378682
|
||||
shell->UnsuppressPainting();
|
||||
RefPtr<PresShell> presShell = mPresShell; // bug 378682
|
||||
presShell->UnsuppressPainting();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@@ -2192,8 +2192,8 @@ nsDocumentViewer::Show(void) {
|
||||
// shown...
|
||||
|
||||
if (mPresShell) {
|
||||
nsCOMPtr<nsIPresShell> shell(mPresShell); // bug 378682
|
||||
shell->UnsuppressPainting();
|
||||
RefPtr<PresShell> presShell = mPresShell; // bug 378682
|
||||
presShell->UnsuppressPainting();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4270,7 +4270,7 @@ void nsDocumentViewer::SetPrintPreviewPresentation(nsViewManager* aViewManager,
|
||||
mWindow = nullptr;
|
||||
mViewManager = aViewManager;
|
||||
mPresContext = aPresContext;
|
||||
mPresShell = aPresShell;
|
||||
mPresShell = static_cast<PresShell*>(aPresShell);
|
||||
|
||||
if (ShouldAttachToTopLevel()) {
|
||||
DetachFromTopLevelWidget();
|
||||
|
||||
Reference in New Issue
Block a user