diff --git a/browser/components/shell/nsGNOMEShellService.cpp b/browser/components/shell/nsGNOMEShellService.cpp index 13b21eaa797c..f264fbc6432a 100644 --- a/browser/components/shell/nsGNOMEShellService.cpp +++ b/browser/components/shell/nsGNOMEShellService.cpp @@ -23,11 +23,11 @@ #include "nsIProcess.h" #include "nsServiceManagerUtils.h" #include "nsComponentManagerUtils.h" -#include "nsIDOMElement.h" #include "nsIImageLoadingContent.h" #include "imgIRequest.h" #include "imgIContainer.h" #include "mozilla/Sprintf.h" +#include "mozilla/dom/Element.h" #if defined(MOZ_WIDGET_GTK) #include "nsIImageToPixbuf.h" #endif @@ -411,7 +411,7 @@ WriteImage(const nsCString& aPath, imgIContainer* aImage) } NS_IMETHODIMP -nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, +nsGNOMEShellService::SetDesktopBackground(dom::Element* aElement, int32_t aPosition, const nsACString& aImageName) { diff --git a/browser/components/shell/nsIShellService.idl b/browser/components/shell/nsIShellService.idl index 33ab9e8d6ef3..adf0beafb378 100644 --- a/browser/components/shell/nsIShellService.idl +++ b/browser/components/shell/nsIShellService.idl @@ -5,9 +5,10 @@ #include "nsISupports.idl" -interface nsIDOMElement; interface nsIFile; +webidl Element; + [scriptable, uuid(2d1a95e4-5bd8-4eeb-b0a8-c1455fd2a357)] interface nsIShellService : nsISupports { @@ -58,7 +59,7 @@ interface nsIShellService : nsISupports * @param aImageName The image name. Equivalent to the leaf name of the * location.href. */ - void setDesktopBackground(in nsIDOMElement aElement, + void setDesktopBackground(in Element aElement, in long aPosition, in ACString aImageName); diff --git a/browser/components/shell/nsMacShellService.cpp b/browser/components/shell/nsMacShellService.cpp index 0c0c8cb700f0..5dc35eaad814 100644 --- a/browser/components/shell/nsMacShellService.cpp +++ b/browser/components/shell/nsMacShellService.cpp @@ -22,10 +22,13 @@ #include "nsString.h" #include "nsIDocShell.h" #include "nsILoadContext.h" +#include "mozilla/dom/Element.h" #include #include +using mozilla::dom::Element; + #define NETWORK_PREFPANE NS_LITERAL_CSTRING("/System/Library/PreferencePanes/Network.prefPane") #define DESKTOP_PREFPANE NS_LITERAL_CSTRING("/System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane") @@ -97,7 +100,7 @@ nsMacShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) } NS_IMETHODIMP -nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement, +nsMacShellService::SetDesktopBackground(Element* aElement, int32_t aPosition, const nsACString& aImageName) { @@ -112,11 +115,7 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement, rv = imageContent->GetCurrentURI(getter_AddRefs(imageURI)); NS_ENSURE_SUCCESS(rv, rv); - // We need the referer URI for nsIWebBrowserPersist::saveURI - nsCOMPtr content = do_QueryInterface(aElement, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - nsIURI *docURI = content->OwnerDoc()->GetDocumentURI(); + nsIURI *docURI = aElement->OwnerDoc()->GetDocumentURI(); if (!docURI) return NS_ERROR_FAILURE; @@ -149,14 +148,14 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement, wbp->SetProgressListener(this); nsCOMPtr loadContext; - nsCOMPtr container = content->OwnerDoc()->GetContainer(); + nsCOMPtr container = aElement->OwnerDoc()->GetContainer(); nsCOMPtr docShell = do_QueryInterface(container); if (docShell) { loadContext = do_QueryInterface(docShell); } return wbp->SaveURI(imageURI, 0, - docURI, content->OwnerDoc()->GetReferrerPolicy(), + docURI, aElement->OwnerDoc()->GetReferrerPolicy(), nullptr, nullptr, mBackgroundFile, loadContext); } diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index b6ff42dfd5a4..05e02e0e9167 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -33,6 +33,7 @@ #include "nsIURLFormatter.h" #include "nsXULAppAPI.h" #include "mozilla/WindowsVersion.h" +#include "mozilla/dom/Element.h" #include "windows.h" #include "shellapi.h" @@ -575,12 +576,11 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage) } NS_IMETHODIMP -nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement, +nsWindowsShellService::SetDesktopBackground(dom::Element* aElement, int32_t aPosition, const nsACString& aImageName) { - nsCOMPtr content(do_QueryInterface(aElement)); - if (!content || !content->IsHTMLElement(nsGkAtoms::img)) { + if (!aElement || !aElement->IsHTMLElement(nsGkAtoms::img)) { // XXX write background loading stuff! return NS_ERROR_NOT_AVAILABLE; } diff --git a/docshell/base/LoadContext.cpp b/docshell/base/LoadContext.cpp index e1785fe23835..f437bdc91190 100644 --- a/docshell/base/LoadContext.cpp +++ b/docshell/base/LoadContext.cpp @@ -8,6 +8,7 @@ #include "mozilla/BasePrincipal.h" #include "mozilla/LoadContext.h" #include "mozilla/Preferences.h" +#include "mozilla/dom/Element.h" #include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI #include "nsContentUtils.h" #include "xpcpublic.h" @@ -60,9 +61,9 @@ LoadContext::GetTopWindow(mozIDOMWindowProxy**) } NS_IMETHODIMP -LoadContext::GetTopFrameElement(nsIDOMElement** aElement) +LoadContext::GetTopFrameElement(dom::Element** aElement) { - nsCOMPtr element = do_QueryReferent(mTopFrameElement); + nsCOMPtr element = do_QueryReferent(mTopFrameElement); element.forget(aElement); return NS_OK; } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 52e8e2be9b8d..5a7f94dcbdb5 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -13079,7 +13079,7 @@ nsDocShell::GetTopWindow(mozIDOMWindowProxy** aWindow) } NS_IMETHODIMP -nsDocShell::GetTopFrameElement(nsIDOMElement** aElement) +nsDocShell::GetTopFrameElement(Element** aElement) { *aElement = nullptr; nsCOMPtr win = GetWindow(); @@ -13093,8 +13093,7 @@ nsDocShell::GetTopFrameElement(nsIDOMElement** aElement) // GetFrameElementInternal, /not/ GetScriptableFrameElement -- if |top| is // inside