Bug 1455674 part 13. Remove remaining xpidl uses of nsIDOMElement. r=qdot

This commit is contained in:
Boris Zbarsky
2018-04-26 23:37:29 -04:00
parent c57db8c7b3
commit 9a8e024fa0
25 changed files with 73 additions and 70 deletions

View File

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

View File

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

View File

@@ -22,10 +22,13 @@
#include "nsString.h"
#include "nsIDocShell.h"
#include "nsILoadContext.h"
#include "mozilla/dom/Element.h"
#include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
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<nsIContent> 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<nsILoadContext> loadContext;
nsCOMPtr<nsISupports> container = content->OwnerDoc()->GetContainer();
nsCOMPtr<nsISupports> container = aElement->OwnerDoc()->GetContainer();
nsCOMPtr<nsIDocShell> 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);
}

View File

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

View File

@@ -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<nsIDOMElement> element = do_QueryReferent(mTopFrameElement);
nsCOMPtr<dom::Element> element = do_QueryReferent(mTopFrameElement);
element.forget(aElement);
return NS_OK;
}

View File

@@ -13079,7 +13079,7 @@ nsDocShell::GetTopWindow(mozIDOMWindowProxy** aWindow)
}
NS_IMETHODIMP
nsDocShell::GetTopFrameElement(nsIDOMElement** aElement)
nsDocShell::GetTopFrameElement(Element** aElement)
{
*aElement = nullptr;
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
@@ -13093,8 +13093,7 @@ nsDocShell::GetTopFrameElement(nsIDOMElement** aElement)
// GetFrameElementInternal, /not/ GetScriptableFrameElement -- if |top| is
// inside <iframe mozbrowser>, we want to return the iframe, not null.
// And we want to cross the content/chrome boundary.
nsCOMPtr<nsIDOMElement> elt =
do_QueryInterface(top->GetFrameElementInternal());
RefPtr<Element> elt = top->GetFrameElementInternal();
elt.forget(aElement);
return NS_OK;
}

View File

@@ -232,7 +232,7 @@ public:
// are shared with nsIDocShell (appID, etc.) and can't be declared twice.
NS_IMETHOD GetAssociatedWindow(mozIDOMWindowProxy**) override;
NS_IMETHOD GetTopWindow(mozIDOMWindowProxy**) override;
NS_IMETHOD GetTopFrameElement(nsIDOMElement**) override;
NS_IMETHOD GetTopFrameElement(mozilla::dom::Element**) override;
NS_IMETHOD GetNestedFrameId(uint64_t*) override;
NS_IMETHOD GetIsContent(bool*) override;
NS_IMETHOD GetUsePrivateBrowsing(bool*) override;

View File

@@ -7,7 +7,8 @@
#include "nsISupports.idl"
interface mozIDOMWindowProxy;
interface nsIDOMElement;
webidl Element;
[ref] native OriginAttributes(mozilla::OriginAttributes);
@@ -52,7 +53,7 @@ interface nsILoadContext : nsISupports
* Note that topFrameElement may be in chrome even when the nsILoadContext is
* associated with content.
*/
readonly attribute nsIDOMElement topFrameElement;
readonly attribute Element topFrameElement;
/**
* If this LoadContext corresponds to a nested remote iframe, we don't have

View File

@@ -9700,13 +9700,12 @@ nsContentUtils::GetPresentationURL(nsIDocShell* aDocShell, nsAString& aPresentat
}
nsCOMPtr<nsILoadContext> loadContext(do_QueryInterface(aDocShell));
nsCOMPtr<nsIDOMElement> topFrameElement;
loadContext->GetTopFrameElement(getter_AddRefs(topFrameElement));
if (!topFrameElement) {
RefPtr<Element> topFrameElt;
loadContext->GetTopFrameElement(getter_AddRefs(topFrameElt));
if (!topFrameElt) {
return;
}
nsCOMPtr<Element> topFrameElt = do_QueryInterface(topFrameElement);
topFrameElt->GetAttribute(NS_LITERAL_STRING("mozpresentation"), aPresentationUrl);
}

View File

@@ -294,6 +294,9 @@ interface ChannelWrapper : EventTarget {
* For cross-process requests, the <browser> or <iframe> element to which the
* content loading this request belongs. For requests that don't originate
* from a remote browser, this is null.
*
* This is not an Element because those are by default only exposed in
* Window, but we're exposed in System.
*/
[Cached, Pure]
readonly attribute nsISupports? browserElement;

View File

@@ -3225,9 +3225,9 @@ public:
}
NS_IMETHOD GetAssociatedWindow(mozIDOMWindowProxy**) NO_IMPL
NS_IMETHOD GetTopWindow(mozIDOMWindowProxy**) NO_IMPL
NS_IMETHOD GetTopFrameElement(nsIDOMElement** aElement) override
NS_IMETHOD GetTopFrameElement(Element** aElement) override
{
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(mElement);
nsCOMPtr<Element> elem = mElement;
elem.forget(aElement);
return NS_OK;
}

View File

@@ -7,7 +7,6 @@
#include "nsISupports.idl"
interface mozIDOMWindowProxy;
interface nsIDOMElement;
interface nsIDocShell;
[scriptable, uuid(718c662a-f810-4a80-a6c9-0b1810ecade2)]

View File

@@ -4,10 +4,10 @@
#include "nsISupports.idl"
interface nsIDOMElement;
interface nsIURI;
webidl DocumentFragment;
webidl Element;
/**
* Non-Web HTML parser functionality to Firefox extensions and XULRunner apps.
@@ -125,7 +125,7 @@ interface nsIParserUtils : nsISupports
in unsigned long flags,
in boolean isXML,
in nsIURI baseURI,
in nsIDOMElement element);
in Element element);
};

View File

@@ -5,10 +5,10 @@
#include "nsISupports.idl"
interface nsIDOMElement;
interface nsIURI;
webidl DocumentFragment;
webidl Element;
/**
* This interface is OBSOLETE and exists solely for legacy extensions.
@@ -44,7 +44,7 @@ interface nsIScriptableUnescapeHTML : nsISupports
DocumentFragment parseFragment(in AString fragment,
in boolean isXML,
in nsIURI baseURI,
in nsIDOMElement element);
in Element element);
};
%{ C++

View File

@@ -6,6 +6,7 @@
#include "nsParserUtils.h"
#include "NullPrincipal.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptLoader.h"
#include "nsAttrName.h"
#include "nsAutoPtr.h"
@@ -19,7 +20,6 @@
#include "nsIContent.h"
#include "nsIContentSink.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMNode.h"
#include "nsIDTD.h"
#include "nsIDocument.h"
@@ -107,7 +107,7 @@ NS_IMETHODIMP
nsParserUtils::ParseFragment(const nsAString& aFragment,
bool aIsXML,
nsIURI* aBaseURI,
nsIDOMElement* aContextElement,
Element* aContextElement,
DocumentFragment** aReturn)
{
return nsParserUtils::ParseFragment(
@@ -119,16 +119,14 @@ nsParserUtils::ParseFragment(const nsAString& aFragment,
uint32_t aFlags,
bool aIsXML,
nsIURI* aBaseURI,
nsIDOMElement* aContextElement,
Element* aContextElement,
DocumentFragment** aReturn)
{
NS_ENSURE_ARG(aContextElement);
*aReturn = nullptr;
nsCOMPtr<nsIDocument> document;
nsCOMPtr<nsINode> contextNode;
contextNode = do_QueryInterface(aContextElement);
document = contextNode->OwnerDoc();
document = aContextElement->OwnerDoc();
nsAutoScriptBlockerSuppressNodeRemoved autoBlocker;

View File

@@ -19,6 +19,7 @@
#include "mozilla/ErrorNames.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/TabParent.h"
#include "nsIContentPolicy.h"
@@ -334,11 +335,11 @@ ChannelWrapper::GetLoadContext() const
return nullptr;
}
already_AddRefed<nsIDOMElement>
already_AddRefed<Element>
ChannelWrapper::GetBrowserElement() const
{
if (nsCOMPtr<nsILoadContext> ctxt = GetLoadContext()) {
nsCOMPtr<nsIDOMElement> elem;
RefPtr<Element> elem;
if (NS_SUCCEEDED(ctxt->GetTopFrameElement(getter_AddRefs(elem)))) {
return elem.forget();
}

View File

@@ -36,14 +36,14 @@
{ 0xc06162d2, 0xb803, 0x43b4, \
{ 0xaa, 0x31, 0xcf, 0x69, 0x7f, 0x93, 0x68, 0x1c } }
class nsIDOMElement;
class nsILoadContext;
class nsITraceableChannel;
namespace mozilla {
namespace dom {
class nsIContentParent;
}
class Element;
} // namespace dom
namespace extensions {
namespace detail {
@@ -206,7 +206,7 @@ public:
already_AddRefed<nsILoadContext> GetLoadContext() const;
already_AddRefed<nsIDOMElement> GetBrowserElement() const;
already_AddRefed<dom::Element> GetBrowserElement() const;
bool CanModify() const;

View File

@@ -7,6 +7,7 @@
#include "BackgroundUtils.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/Unused.h"
@@ -209,7 +210,7 @@ OfflineCacheUpdateParent::GetTopWindow(mozIDOMWindowProxy** aTopWindow)
}
NS_IMETHODIMP
OfflineCacheUpdateParent::GetTopFrameElement(nsIDOMElement** aElement)
OfflineCacheUpdateParent::GetTopFrameElement(dom::Element** aElement)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -7,10 +7,12 @@
#include "nsStandaloneNativeMenu.h"
#include "nsMenuUtilsX.h"
#include "nsIDOMElement.h"
#include "nsIMutationObserver.h"
#include "nsGkAtoms.h"
#include "nsObjCExceptions.h"
#include "mozilla/dom/Element.h"
using mozilla::dom::Element;
NS_IMPL_ISUPPORTS_INHERITED(nsStandaloneNativeMenu, nsMenuGroupOwnerX,
@@ -28,24 +30,21 @@ nsStandaloneNativeMenu::~nsStandaloneNativeMenu()
}
NS_IMETHODIMP
nsStandaloneNativeMenu::Init(nsIDOMElement * aDOMElement)
nsStandaloneNativeMenu::Init(Element* aElement)
{
NS_ASSERTION(mMenu == nullptr, "nsNativeMenu::Init - mMenu not null!");
nsresult rv;
NS_ENSURE_ARG(aElement);
nsCOMPtr<nsIContent> content = do_QueryInterface(aDOMElement, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (!content->IsAnyOfXULElements(nsGkAtoms::menu, nsGkAtoms::menupopup))
if (!aElement->IsAnyOfXULElements(nsGkAtoms::menu, nsGkAtoms::menupopup))
return NS_ERROR_FAILURE;
rv = nsMenuGroupOwnerX::Create(content->AsElement());
nsresult rv = nsMenuGroupOwnerX::Create(aElement);
if (NS_FAILED(rv))
return rv;
mMenu = new nsMenuX();
rv = mMenu->Create(this, this, content);
rv = mMenu->Create(this, this, aElement);
if (NS_FAILED(rv)) {
delete mMenu;
mMenu = nullptr;

View File

@@ -9,22 +9,24 @@
#include "nsSystemStatusBarCocoa.h"
#include "nsStandaloneNativeMenu.h"
#include "nsObjCExceptions.h"
#include "nsIDOMElement.h"
#include "mozilla/dom/Element.h"
using mozilla::dom::Element;
NS_IMPL_ISUPPORTS(nsSystemStatusBarCocoa, nsISystemStatusBar)
NS_IMETHODIMP
nsSystemStatusBarCocoa::AddItem(nsIDOMElement* aDOMElement)
nsSystemStatusBarCocoa::AddItem(Element* aElement)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
RefPtr<nsStandaloneNativeMenu> menu = new nsStandaloneNativeMenu();
nsresult rv = menu->Init(aDOMElement);
nsresult rv = menu->Init(aElement);
if (NS_FAILED(rv)) {
return rv;
}
nsCOMPtr<nsISupports> keyPtr = aDOMElement;
nsCOMPtr<nsISupports> keyPtr = aElement;
mItems.Put(keyPtr, new StatusItem(menu));
return NS_OK;
@@ -33,11 +35,11 @@ nsSystemStatusBarCocoa::AddItem(nsIDOMElement* aDOMElement)
}
NS_IMETHODIMP
nsSystemStatusBarCocoa::RemoveItem(nsIDOMElement* aDOMElement)
nsSystemStatusBarCocoa::RemoveItem(Element* aElement)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
mItems.Remove(aDOMElement);
mItems.Remove(aElement);
return NS_OK;

View File

@@ -4,7 +4,7 @@
#include "nsISupports.idl"
interface nsIDOMElement;
webidl Element;
/**
* Platform-independent interface to platform native menu objects.
@@ -18,7 +18,7 @@ interface nsIStandaloneNativeMenu : nsISupports
*
* @param aDOMElement A XUL DOM element of tag type |menu| or |menupopup|.
*/
void init(in nsIDOMElement aDOMElement);
void init(in Element aElement);
/**
* This method must be called before the menu is opened and displayed to the

View File

@@ -4,7 +4,7 @@
#include "nsISupports.idl"
interface nsIDOMElement;
webidl Element;
/**
* Allow applications to interface with the Mac OS X system status bar.
@@ -25,12 +25,12 @@ interface nsISystemStatusBar : nsISupports
* a menu with the contents of the menupopup.
* The menu label is not shown.
*/
void addItem(in nsIDOMElement aDOMMenuElement);
void addItem(in Element aMenuElement);
/**
* Remove a previously-added item from the menu bar. Calling this with an
* element that has not been added before will be silently ignored.
* @param aDOMMenuElement The XUL menu element that you called addItem with.
*/
void removeItem(in nsIDOMElement aDOMMenuElement);
void removeItem(in Element aMenuElement);
};

View File

@@ -8,7 +8,6 @@
interface nsIURI;
interface nsIDOMWindow;
interface nsIDOMElement;
interface nsIDOMGeoPosition;
interface nsIGeolocationPrompt;

View File

@@ -451,7 +451,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetStatusWithContext(uint32_t aStatusType,
{
case STATUS_LINK:
{
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aStatusContext);
nsCOMPtr<dom::Element> element = do_QueryInterface(aStatusContext);
xulBrowserWindow->SetOverLink(aStatusText, element);
break;
}

View File

@@ -10,7 +10,6 @@
interface nsIBrowser;
interface nsIRequest;
interface nsIDOMElement;
interface nsIInputStream;
interface nsIDocShell;
interface nsIFrameLoaderOwner;
@@ -18,6 +17,8 @@ interface nsITabParent;
interface nsIPrincipal;
interface mozIDOMWindowProxy;
webidl Element;
/**
* The nsIXULBrowserWindow supplies the methods that may be called from the
* internals of the browser area to tell the containing xul window to update
@@ -30,7 +31,7 @@ interface nsIXULBrowserWindow : nsISupports
* Tells the object implementing this function what link we are currently
* over.
*/
void setOverLink(in AString link, in nsIDOMElement element);
void setOverLink(in AString link, in Element element);
/**
* Determines the appropriate target for a link.