bug 825419 - outparamdel nsIDocShell::GetPresShell() r=smaug

This commit is contained in:
Trevor Saunders 2012-12-28 20:56:42 -05:00
parent 23e3365c2f
commit efffc97c2d
24 changed files with 82 additions and 160 deletions

View File

@ -117,9 +117,7 @@ public:
static DocAccessible* GetDocAccessibleFor(nsIDocShellTreeItem* aContainer)
{
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aContainer));
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
return GetAccService()->GetDocAccessible(presShell);
return GetAccService()->GetDocAccessible(docShell->GetPresShell());
}
/**

View File

@ -196,9 +196,7 @@ nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
if (treeItem != rootTreeItem) {
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(rootTreeItem));
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
ps = presShell;
ps = docShell->GetPresShell();
}
return aCanCreate ? GetDocAccessible(ps) : ps->GetDocAccessible();

View File

@ -6392,8 +6392,7 @@ nsContentUtils::FindPresShellForDocument(nsIDocument* aDoc)
// Walk the docshell tree to find the nearest container that has a presshell,
// and return that.
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(docShellTreeItem);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsIPresShell* presShell = docShell->GetPresShell();
if (presShell) {
return presShell;
}

View File

@ -801,8 +801,7 @@ nsFrameLoader::Show(int32_t marginWidth, int32_t marginHeight,
scrollbarPrefY);
}
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (presShell) {
// Ensure root scroll frame is reflowed in case scroll preferences or
// margins have changed
@ -847,8 +846,7 @@ nsFrameLoader::Show(int32_t marginWidth, int32_t marginHeight,
// sub-document. This shouldn't be necessary, but given the way our
// editor works, it is. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=284245
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (presShell) {
nsCOMPtr<nsIDOMHTMLDocument> doc =
do_QueryInterface(presShell->GetDocument());

View File

@ -744,9 +744,7 @@ protected:
return mCanvasElement->OwnerDoc()->GetShell();
}
if (mDocShell) {
nsCOMPtr<nsIPresShell> shell;
mDocShell->GetPresShell(getter_AddRefs(shell));
return shell.get();
return mDocShell->GetPresShell();
}
return nullptr;
}

View File

@ -175,8 +175,7 @@ PrintDocTree(nsIDocShellTreeItem* aParentItem, int aLevel)
nsCOMPtr<nsIDocShell> parentAsDocShell(do_QueryInterface(aParentItem));
int32_t type;
aParentItem->GetItemType(&type);
nsCOMPtr<nsIPresShell> presShell;
parentAsDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = parentAsDocShell->GetPresShell();
nsRefPtr<nsPresContext> presContext;
parentAsDocShell->GetPresContext(getter_AddRefs(presContext));
nsCOMPtr<nsIContentViewer> cv;
@ -1467,8 +1466,7 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
nsCOMPtr<nsIDocShell> subDS = do_QueryInterface(subShellItem);
if (subDS && IsShellVisible(subDS)) {
nsCOMPtr<nsIPresShell> subPS;
subDS->GetPresShell(getter_AddRefs(subPS));
nsCOMPtr<nsIPresShell> subPS = subDS->GetPresShell();
// Docshells need not have a presshell (eg. display:none
// iframes, docshells in transition between documents, etc).
@ -1504,9 +1502,7 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
docShell->GetParent(getter_AddRefs(parentShellItem));
nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parentShellItem);
if (parentDS) {
nsCOMPtr<nsIPresShell> parentPS;
parentDS->GetPresShell(getter_AddRefs(parentPS));
nsCOMPtr<nsIPresShell> parentPS = parentDS->GetPresShell();
NS_ASSERTION(parentPS, "Our PresShell exists but the parent's does not?");
nsPresContext *parentPC = parentPS->GetPresContext();

View File

@ -2760,9 +2760,7 @@ static bool HasPresShell(nsPIDOMWindow *aWindow)
nsIDocShell *docShell = aWindow->GetDocShell();
if (!docShell)
return false;
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
return presShell != nullptr;
return docShell->GetPresShell() != nullptr;
}
nsresult

View File

@ -426,7 +426,7 @@ nsXBLWindowKeyHandler::IsEditor()
nsIDocShell *docShell = piwin->GetDocShell();
nsCOMPtr<nsIPresShell> presShell;
if (docShell)
docShell->GetPresShell(getter_AddRefs(presShell));
presShell = docShell->GetPresShell();
if (presShell) {
return presShell->GetSelectionFlags() == nsISelectionDisplay::DISPLAY_ALL;

View File

@ -1037,9 +1037,8 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
return NS_OK;
}
else if (aIID.Equals(NS_GET_IID(nsISelectionDisplay))) {
nsCOMPtr<nsIPresShell> shell;
nsresult rv = GetPresShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell)
nsIPresShell* shell = GetPresShell();
if (shell)
return shell->QueryInterface(aIID,aSink);
}
else if (aIID.Equals(NS_GET_IID(nsIDocShellTreeOwner))) {
@ -1733,22 +1732,12 @@ nsDocShell::GetPresContext(nsPresContext ** aPresContext)
return mContentViewer->GetPresContext(aPresContext);
}
NS_IMETHODIMP
nsDocShell::GetPresShell(nsIPresShell ** aPresShell)
NS_IMETHODIMP_(nsIPresShell*)
nsDocShell::GetPresShell()
{
nsresult rv = NS_OK;
NS_ENSURE_ARG_POINTER(aPresShell);
*aPresShell = nullptr;
nsRefPtr<nsPresContext> presContext;
(void) GetPresContext(getter_AddRefs(presContext));
if (presContext) {
NS_IF_ADDREF(*aPresShell = presContext->GetPresShell());
}
return rv;
return presContext ? presContext->GetPresShell() : nullptr;
}
NS_IMETHODIMP
@ -1869,8 +1858,7 @@ nsDocShell::GetCharset(char** aCharset)
NS_ENSURE_ARG_POINTER(aCharset);
*aCharset = nullptr;
nsCOMPtr<nsIPresShell> presShell;
GetPresShell(getter_AddRefs(presShell));
nsIPresShell* presShell = GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsIDocument *doc = presShell->GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
@ -3246,8 +3234,7 @@ PrintDocTree(nsIDocShellTreeItem * aParentNode, int aLevel)
nsCOMPtr<nsIDocShell> parentAsDocShell(do_QueryInterface(aParentNode));
int32_t type;
aParentNode->GetItemType(&type);
nsCOMPtr<nsIPresShell> presShell;
parentAsDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = parentAsDocShell->GetPresShell();
nsRefPtr<nsPresContext> presContext;
parentAsDocShell->GetPresContext(getter_AddRefs(presContext));
nsIDocument *doc = presShell->GetDocument();
@ -5051,8 +5038,7 @@ nsDocShell::DoGetPositionAndSize(int32_t * x, int32_t * y, int32_t * cx,
NS_IMETHODIMP
nsDocShell::Repaint(bool aForce)
{
nsCOMPtr<nsIPresShell> presShell;
GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell =GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsIViewManager* viewManager = presShell->GetViewManager();
@ -5117,8 +5103,7 @@ nsDocShell::GetVisibility(bool * aVisibility)
if (!mContentViewer)
return NS_OK;
nsCOMPtr<nsIPresShell> presShell;
GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (!presShell)
return NS_OK;
@ -5143,11 +5128,10 @@ nsDocShell::GetVisibility(bool * aVisibility)
treeItem->GetParent(getter_AddRefs(parentItem));
while (parentItem) {
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(treeItem));
docShell->GetPresShell(getter_AddRefs(presShell));
presShell = docShell->GetPresShell();
nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parentItem);
nsCOMPtr<nsIPresShell> pPresShell;
parentDS->GetPresShell(getter_AddRefs(pPresShell));
nsCOMPtr<nsIPresShell> pPresShell = parentDS->GetPresShell();
// Null-check for crash in bug 267804
if (!pPresShell) {
@ -5208,8 +5192,7 @@ nsDocShell::SetIsActive(bool aIsActive)
mIsActive = aIsActive;
// Tell the PresShell about it.
nsCOMPtr<nsIPresShell> pshell;
GetPresShell(getter_AddRefs(pshell));
nsCOMPtr<nsIPresShell> pshell = GetPresShell();
if (pshell)
pshell->SetIsActive(aIsActive);
@ -7396,8 +7379,7 @@ nsDocShell::RestoreFromHistory()
nsView *rootViewSibling = nullptr, *rootViewParent = nullptr;
nsIntRect newBounds(0, 0, 0, 0);
nsCOMPtr<nsIPresShell> oldPresShell;
nsDocShell::GetPresShell(getter_AddRefs(oldPresShell));
nsCOMPtr<nsIPresShell> oldPresShell = GetPresShell();
if (oldPresShell) {
nsIViewManager *vm = oldPresShell->GetViewManager();
if (vm) {
@ -7618,8 +7600,7 @@ nsDocShell::RestoreFromHistory()
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIPresShell> shell;
nsDocShell::GetPresShell(getter_AddRefs(shell));
nsCOMPtr<nsIPresShell> shell = GetPresShell();
nsIViewManager *newVM = shell ? shell->GetViewManager() : nullptr;
nsView *newRootView = newVM ? newVM->GetRootView() : nullptr;
@ -7899,8 +7880,7 @@ nsDocShell::CreateContentViewer(const char *aContentType,
// the ID can be used to distinguish it from the other parts.
nsCOMPtr<nsIMultiPartChannel> multiPartChannel(do_QueryInterface(request));
if (multiPartChannel) {
nsCOMPtr<nsIPresShell> shell;
rv = GetPresShell(getter_AddRefs(shell));
nsCOMPtr<nsIPresShell> shell = GetPresShell();
if (NS_SUCCEEDED(rv) && shell) {
nsIDocument *doc = shell->GetDocument();
if (doc) {
@ -9605,12 +9585,11 @@ nsDocShell::ScrollToAnchor(nsACString & aCurHash, nsACString & aNewHash,
return NS_OK;
}
nsCOMPtr<nsIPresShell> shell;
nsresult rv = GetPresShell(getter_AddRefs(shell));
if (NS_FAILED(rv) || !shell) {
nsCOMPtr<nsIPresShell> shell = GetPresShell();
if (!shell) {
// If we failed to get the shell, or if there is no shell,
// nothing left to do here.
return rv;
return NS_OK;
}
// If we have no new anchor, we do not want to scroll, unless there is a
@ -9652,7 +9631,7 @@ nsDocShell::ScrollToAnchor(nsACString & aCurHash, nsACString & aNewHash,
// conversion will fail and give us an empty Unicode string.
// In that case, we should just fall through to using the
// page's charset.
rv = NS_ERROR_FAILURE;
nsresult rv = NS_ERROR_FAILURE;
NS_ConvertUTF8toUTF16 uStr(str);
if (!uStr.IsEmpty()) {
rv = shell->GoToAnchor(NS_ConvertUTF8toUTF16(str), scroll);
@ -10635,9 +10614,8 @@ NS_IMETHODIMP nsDocShell::PersistLayoutHistoryState()
nsresult rv = NS_OK;
if (mOSHE) {
nsCOMPtr<nsIPresShell> shell;
rv = GetPresShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
nsCOMPtr<nsIPresShell> shell = GetPresShell();
if (shell) {
nsCOMPtr<nsILayoutHistoryState> layoutState;
rv = shell->CaptureHistoryState(getter_AddRefs(layoutState));
}
@ -11283,8 +11261,7 @@ nsDocShell::GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
nsIScrollableFrame *
nsDocShell::GetRootScrollFrame()
{
nsCOMPtr<nsIPresShell> shell;
NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(shell)), nullptr);
nsCOMPtr<nsIPresShell> shell = GetPresShell();
NS_ENSURE_TRUE(shell, nullptr);
return shell->GetRootScrollFrameAsScrollableExternal();

View File

@ -39,7 +39,7 @@ interface nsIWebBrowserPrint;
interface nsIVariant;
interface nsIPrivacyTransitionObserver;
[scriptable, builtinclass, uuid(ed04b29f-ae9a-460a-858e-960b523bb3a5)]
[scriptable, builtinclass, uuid(008f5c86-b915-458c-aaf1-78de3b484e68)]
interface nsIDocShell : nsISupports
{
/**
@ -186,7 +186,7 @@ interface nsIDocShell : nsISupports
/**
* Presentation shell for the currently loaded document. This may be null.
*/
[noscript] readonly attribute nsIPresShell presShell;
[noscript,notxpcom] nsIPresShell GetPresShell();
/**
* Presentation shell for the oldest document, if this docshell is

View File

@ -108,9 +108,7 @@ nsDOMWindowUtils::GetPresShell()
if (!docShell)
return nullptr;
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
return presShell;
return docShell->GetPresShell();
}
nsPresContext*
@ -1055,8 +1053,7 @@ nsDOMWindowUtils::GetWidget(nsPoint* aOffset)
if (window) {
nsIDocShell *docShell = window->GetDocShell();
if (docShell) {
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (presShell) {
nsIFrame* frame = presShell->GetRootFrame();
if (frame)
@ -1374,8 +1371,7 @@ nsDOMWindowUtils::DisableNonTestMouseEvents(bool aDisable)
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsIDocShell *docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
presShell->DisableNonTestMouseEvents(aDisable);
return NS_OK;
@ -1765,8 +1761,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
nsIDocShell *docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsPresContext* presContext = presShell->GetPresContext();
@ -2814,8 +2809,7 @@ nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
nsIDocShell *docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
*aPaintingSuppressed = presShell->IsPaintingSuppressed();

View File

@ -618,8 +618,7 @@ nsFocusManager::MoveCaretToFocus(nsIDOMWindow* aWindow)
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(dsti);
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWindow));
@ -716,8 +715,7 @@ nsFocusManager::WindowRaised(nsIDOMWindow* aWindow)
nsCOMPtr<nsIDocShell> currentDocShell = currentWindow->GetDocShell();
nsCOMPtr<nsIPresShell> presShell;
currentDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = currentDocShell->GetPresShell();
if (presShell) {
// disable selection mousedown state on activation
// XXXndeakin P3 not sure if this is necessary, but it doesn't hurt
@ -927,8 +925,7 @@ nsFocusManager::WindowHidden(nsIDOMWindow* aWindow)
nsCOMPtr<nsIContent> oldFocusedContent = mFocusedContent.forget();
nsCOMPtr<nsIDocShell> focusedDocShell = mFocusedWindow->GetDocShell();
nsCOMPtr<nsIPresShell> presShell;
focusedDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = focusedDocShell->GetPresShell();
if (oldFocusedContent && oldFocusedContent->IsInDoc()) {
NotifyFocusStateChange(oldFocusedContent,
@ -1056,8 +1053,7 @@ nsFocusManager::EnsureCurrentWidgetFocused()
// platform knows that this widget is focused.
nsCOMPtr<nsIDocShell> docShell = mFocusedWindow->GetDocShell();
if (docShell) {
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (presShell) {
nsIViewManager* vm = presShell->GetViewManager();
if (vm) {
@ -1262,8 +1258,7 @@ nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags,
if (aFocusChanged) {
nsCOMPtr<nsIDocShell> docShell = newWindow->GetDocShell();
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (presShell)
ScrollIntoView(presShell, contentToFocus, aFlags);
}
@ -1513,8 +1508,7 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear,
// Keep a ref to presShell since dispatching the DOM event may cause
// the document to be destroyed.
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (!presShell) {
mFocusedContent = nullptr;
return true;
@ -1664,8 +1658,7 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
if (!docShell)
return;
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (!presShell)
return;
@ -1977,8 +1970,7 @@ nsFocusManager::RaiseWindow(nsPIDOMWindow* aWindow)
if (!docShell)
return;
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (!presShell)
return;
@ -2026,8 +2018,7 @@ nsFocusManager::UpdateCaret(bool aMoveCaretToFocus,
bool browseWithCaret =
Preferences::GetBool("accessibility.browsewithcaret");
nsCOMPtr<nsIPresShell> presShell;
focusedDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = focusedDocShell->GetPresShell();
if (!presShell)
return;

View File

@ -1546,8 +1546,7 @@ nsGlobalWindow::SetInitialPrincipalToSubject()
GetDocShell()->CreateAboutBlankContentViewer(newWindowPrincipal);
mDoc->SetIsInitialDocument(true);
nsCOMPtr<nsIPresShell> shell;
GetDocShell()->GetPresShell(getter_AddRefs(shell));
nsCOMPtr<nsIPresShell> shell = GetDocShell()->GetPresShell();
if (shell && !shell->DidInitialize()) {
// Ensure that if someone plays with this document they will get
@ -3670,8 +3669,7 @@ nsGlobalWindow::SetInnerWidth(int32_t aInnerWidth)
NS_ERROR_FAILURE);
nsRefPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsRefPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (presShell && presShell->GetIsViewportOverridden())
{
@ -3737,8 +3735,7 @@ nsGlobalWindow::SetInnerHeight(int32_t aInnerHeight)
NS_ENSURE_SUCCESS(CheckSecurityWidthAndHeight(nullptr, &aInnerHeight),
NS_ERROR_FAILURE);
nsRefPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsRefPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (presShell && presShell->GetIsViewportOverridden())
{
@ -3892,8 +3889,7 @@ nsGlobalWindow::GetInnerScreenRect()
rootWindow->FlushPendingNotifications(Flush_Layout);
}
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (!presShell)
return nsRect();
nsIFrame* rootFrame = presShell->GetRootFrame();
@ -3953,8 +3949,7 @@ nsGlobalWindow::GetMozPaintCount(uint64_t* aResult)
if (!mDocShell)
return NS_OK;
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (!presShell)
return NS_OK;
@ -4493,8 +4488,7 @@ nsGlobalWindow::GetNearestWidget()
{
nsIDocShell* docShell = GetDocShell();
NS_ENSURE_TRUE(docShell, nullptr);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
NS_ENSURE_TRUE(presShell, nullptr);
nsIFrame* rootFrame = presShell->GetRootFrame();
NS_ENSURE_TRUE(rootFrame, nullptr);
@ -4681,8 +4675,7 @@ nsGlobalWindow::EnsureReflowFlushAndPaint()
if (!mDocShell)
return;
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (!presShell)
return;
@ -7427,8 +7420,7 @@ nsGlobalWindow::GetSelection(nsISelection** aSelection)
if (!mDocShell)
return NS_OK;
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (!presShell)
return NS_OK;
@ -8257,8 +8249,7 @@ nsGlobalWindow::UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent)
return;
}
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (!presShell || !mDocument)
return;
@ -8325,8 +8316,7 @@ nsGlobalWindow::GetComputedStyleHelper(nsIDOMElement* aElt,
return NS_OK;
}
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (!presShell) {
// Try flushing frames on our parent in case there's a pending
@ -8344,8 +8334,7 @@ nsGlobalWindow::GetComputedStyleHelper(nsIDOMElement* aElt,
return NS_OK;
}
mDocShell->GetPresShell(getter_AddRefs(presShell));
presShell = mDocShell->GetPresShell();
if (!presShell) {
return NS_OK;
}
@ -10354,8 +10343,7 @@ nsGlobalWindow::GetScrollFrame()
return nullptr;
}
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (presShell) {
return presShell->GetRootScrollFrameAsScrollable();
}
@ -11033,8 +11021,7 @@ nsGlobalChromeWindow::SetCursor(const nsAString& aCursor)
if (presContext) {
// Need root widget.
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsIViewManager* vm = presShell->GetViewManager();

View File

@ -173,7 +173,8 @@ nsSelectionCommandsBase::GetPresShellFromWindow(nsPIDOMWindow *aWindow, nsIPresS
nsIDocShell *docShell = aWindow->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
return docShell->GetPresShell(aPresShell);
NS_IF_ADDREF(*aPresShell = docShell->GetPresShell());
return NS_OK;
}
nsresult
@ -362,8 +363,7 @@ nsClipboardCommand::DoCommand(const char *aCommandName, nsISupports *aContext)
nsIDocShell *docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCopySupport::FireClipboardEvent(NS_COPY, presShell, nullptr);

View File

@ -1438,7 +1438,7 @@ ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer,
do_GetInterface(static_cast<nsIWebBrowser*>(self->mWebBrowser));
nsCOMPtr<nsIPresShell> shell;
if (docShell) {
docShell->GetPresShell(getter_AddRefs(shell));
shell = docShell->GetPresShell();
}
nsIWidget* widget = nullptr;

View File

@ -2369,7 +2369,7 @@ nsDocumentViewer::FindContainerView()
docShellItem->GetParent(getter_AddRefs(parentDocShellItem));
if (parentDocShellItem) {
nsCOMPtr<nsIDocShell> parentDocShell = do_QueryInterface(parentDocShellItem);
parentDocShell->GetPresShell(getter_AddRefs(parentPresShell));
parentPresShell = parentDocShell->GetPresShell();
}
}
if (!parentPresShell) {

View File

@ -5522,9 +5522,8 @@ PresShell::GetParentPresShell()
nsCOMPtr<nsIDocShell> parentDocShell = do_QueryInterface(parentTreeItem);
NS_ENSURE_TRUE(parentDocShell && treeItem != parentTreeItem, nullptr);
nsIPresShell* parentPresShell = nullptr;
parentDocShell->GetPresShell(&parentPresShell);
return parentPresShell;
nsCOMPtr<nsIPresShell> parentPresShell = parentDocShell->GetPresShell();
return parentPresShell.forget();
}
nsresult

View File

@ -331,7 +331,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
mFrameLoader->GetDocShell(getter_AddRefs(docShell));
if (!docShell)
return NS_OK;
docShell->GetPresShell(getter_AddRefs(presShell));
presShell = docShell->GetPresShell();
if (!presShell)
return NS_OK;
}
@ -1117,8 +1117,7 @@ nsSubDocumentFrame::ObtainIntrinsicSizeFrame()
nsCOMPtr<nsIDocShell> docShell;
GetDocShell(getter_AddRefs(docShell));
if (docShell) {
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
if (presShell) {
nsIScrollableFrame* scrollable = presShell->GetRootScrollFrameAsScrollable();
if (scrollable) {

View File

@ -36,10 +36,7 @@ inLayoutUtils::GetPresShellFor(nsISupports* aThing)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aThing);
nsCOMPtr<nsIPresShell> presShell;
window->GetDocShell()->GetPresShell(getter_AddRefs(presShell));
return presShell;
return window->GetDocShell()->GetPresShell();
}
/*static*/

View File

@ -1066,7 +1066,7 @@ nsPrintEngine::IsThereARangeSelection(nsIDOMWindow* aDOMWin)
nsCOMPtr<nsIPresShell> presShell;
if (aDOMWin) {
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aDOMWin));
window->GetDocShell()->GetPresShell(getter_AddRefs(presShell));
presShell = window->GetDocShell()->GetPresShell();
}
if (!presShell)
@ -2022,8 +2022,7 @@ nsresult
nsPrintEngine::UpdateSelectionAndShrinkPrintObject(nsPrintObject* aPO,
bool aDocumentIsTopLevel)
{
nsCOMPtr<nsIPresShell> displayShell;
aPO->mDocShell->GetPresShell(getter_AddRefs(displayShell));
nsCOMPtr<nsIPresShell> displayShell = aPO->mDocShell->GetPresShell();
// Transfer Selection Ranges to the new Print PresShell
nsCOMPtr<nsISelection> selection, selectionPS;
// It's okay if there is no display shell, just skip copying the selection

View File

@ -74,8 +74,7 @@ nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump,
return NS_OK;
}
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
nsIFrame* root = presShell->GetRootFrame();

View File

@ -288,8 +288,7 @@ nsFormFillController::SetPopupOpen(bool aPopupOpen)
NS_ENSURE_STATE(content);
nsCOMPtr<nsIDocShell> docShell = GetDocShellForInput(mFocusedInput);
NS_ENSURE_STATE(docShell);
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
NS_ENSURE_STATE(presShell);
presShell->ScrollContentIntoView(content,
nsIPresShell::ScrollAxis(

View File

@ -160,7 +160,7 @@ nsTypeAheadFind::SetDocShell(nsIDocShell* aDocShell)
NS_ENSURE_TRUE(mWebBrowserFind, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> presShell;
aDocShell->GetPresShell(getter_AddRefs(presShell));
presShell = aDocShell->GetPresShell();
mPresShell = do_GetWeakReference(presShell);
mStartFindRange = nullptr;
@ -275,7 +275,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
nsCOMPtr<nsIDocShell> ds = do_QueryReferent(mDocShell);
NS_ENSURE_TRUE(ds, NS_ERROR_FAILURE);
ds->GetPresShell(getter_AddRefs(startingPresShell));
startingPresShell = ds->GetPresShell();
mPresShell = do_GetWeakReference(startingPresShell);
}
@ -683,8 +683,7 @@ nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer,
if (!docShell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
nsRefPtr<nsPresContext> presContext;
docShell->GetPresContext(getter_AddRefs(presContext));
@ -898,7 +897,7 @@ nsTypeAheadFind::Find(const nsAString& aSearchString, bool aLinksOnly,
nsCOMPtr<nsIDocShell> ds (do_QueryReferent(mDocShell));
NS_ENSURE_TRUE(ds, NS_ERROR_FAILURE);
ds->GetPresShell(getter_AddRefs(presShell));
presShell = ds->GetPresShell();
mPresShell = do_GetWeakReference(presShell);
}
nsCOMPtr<nsISelection> selection;

View File

@ -249,9 +249,7 @@ nsWebShellWindow::GetPresShell()
if (!mDocShell)
return nullptr;
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
return presShell.get();
return mDocShell->GetPresShell();
}
bool
@ -298,8 +296,7 @@ nsWebShellWindow::RequestWindowClose(nsIWidget* aWidget)
nsCOMPtr<nsPIDOMWindow> window(do_GetInterface(mDocShell));
nsCOMPtr<nsIDOMEventTarget> eventTarget = do_QueryInterface(window);
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (eventTarget) {
nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();