Bug 1455674 part 16. Remove most use of nsIDOMElement in dom. r=qdot

This commit is contained in:
Boris Zbarsky
2018-04-26 23:37:34 -04:00
parent 5378e40459
commit 599ef690cf
57 changed files with 67 additions and 134 deletions

View File

@@ -6,7 +6,7 @@
/* /*
* Base class for all element classes; this provides an implementation * Base class for all element classes; this provides an implementation
* of DOM Core's nsIDOMElement, implements nsIContent, provides * of DOM Core's Element, implements nsIContent, provides
* utility methods for subclasses, and so forth. * utility methods for subclasses, and so forth.
*/ */

View File

@@ -6,7 +6,7 @@
/* /*
* Base class for all element classes; this provides an implementation * Base class for all element classes; this provides an implementation
* of DOM Core's nsIDOMElement, implements nsIContent, provides * of DOM Core's Element, implements nsIContent, provides
* utility methods for subclasses, and so forth. * utility methods for subclasses, and so forth.
*/ */
@@ -18,7 +18,6 @@
#include "mozilla/EventStates.h" // for member #include "mozilla/EventStates.h" // for member
#include "mozilla/ServoTypes.h" #include "mozilla/ServoTypes.h"
#include "mozilla/dom/DirectionalityUtils.h" #include "mozilla/dom/DirectionalityUtils.h"
#include "nsIDOMElement.h"
#include "nsILinkHandler.h" #include "nsILinkHandler.h"
#include "nsINodeList.h" #include "nsINodeList.h"
#include "nsNodeUtils.h" #include "nsNodeUtils.h"

View File

@@ -5,9 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* /*
* Base class for all element classes; this provides an implementation * Base class for all element classes and DocumentFragment.
* of DOM Core's nsIDOMElement, implements nsIContent, provides
* utility methods for subclasses, and so forth.
*/ */
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"

View File

@@ -70,8 +70,8 @@ private:
}; };
/** /**
* A generic base class for DOM elements, implementing many nsIContent, * A generic base class for DOM elements and document fragments,
* nsIDOMNode and nsIDOMElement methods. * implementing many nsIContent, nsIDOMNode and Element methods.
*/ */
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {

View File

@@ -13,7 +13,6 @@
#include "nsEscape.h" #include "nsEscape.h"
#include "nsXBLPrototypeBinding.h" #include "nsXBLPrototypeBinding.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
namespace mozilla { namespace mozilla {

View File

@@ -6,7 +6,6 @@
#include <map> #include <map>
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIDOMElement.h"
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentParent.h"

View File

@@ -17,7 +17,6 @@
#include "nsContentPolicy.h" #include "nsContentPolicy.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIDOMElement.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsITabChild.h" #include "nsITabChild.h"

View File

@@ -134,7 +134,6 @@
#include "nsIDocumentEncoder.h" #include "nsIDocumentEncoder.h"
#include "nsIDOMChromeWindow.h" #include "nsIDOMChromeWindow.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
#include "nsIDOMWindowUtils.h" #include "nsIDOMWindowUtils.h"
#include "nsIDragService.h" #include "nsIDragService.h"

View File

@@ -32,7 +32,6 @@
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIHTMLDocument.h" #include "nsIHTMLDocument.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"

View File

@@ -113,7 +113,6 @@
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsIDOMElement.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
// for radio group stuff // for radio group stuff

View File

@@ -20,7 +20,6 @@
#include "nsIContentSerializer.h" #include "nsIContentSerializer.h"
#include "mozilla/Encoding.h" #include "mozilla/Encoding.h"
#include "nsIOutputStream.h" #include "nsIOutputStream.h"
#include "nsIDOMElement.h"
#include "nsRange.h" #include "nsRange.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"

View File

@@ -18,7 +18,6 @@
#include "nsIContentParent.h" #include "nsIContentParent.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsIDOMChromeWindow.h" #include "nsIDOMChromeWindow.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMRange.h" #include "nsIDOMRange.h"
#include "nsIHTMLDocument.h" #include "nsIHTMLDocument.h"

View File

@@ -64,7 +64,7 @@ public:
/** /**
* A faster version of nsIFocusManager::GetFocusedElement, returning a * A faster version of nsIFocusManager::GetFocusedElement, returning a
* raw Element pointer (instead of having AddRef-ed nsIDOMElement * raw Element pointer (instead of having AddRef-ed Element
* pointer filled in to an out-parameter). * pointer filled in to an out-parameter).
*/ */
mozilla::dom::Element* GetFocusedElement() { return mFocusedElement; } mozilla::dom::Element* GetFocusedElement() { return mFocusedElement; }

View File

@@ -8,7 +8,6 @@
#include "nsGlobalWindowCommands.h" #include "nsGlobalWindowCommands.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIDOMElement.h"
#include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsCRT.h" #include "nsCRT.h"

View File

@@ -111,7 +111,6 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "Crypto.h" #include "Crypto.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMOfflineResourceList.h" #include "nsIDOMOfflineResourceList.h"
#include "nsDOMString.h" #include "nsDOMString.h"
#include "nsIEmbeddingSiteWindow.h" #include "nsIEmbeddingSiteWindow.h"
@@ -4974,28 +4973,6 @@ nsGlobalWindowInner::GetDefaultComputedStyle(Element& aElt,
return GetComputedStyleHelper(aElt, aPseudoElt, true, aError); return GetComputedStyleHelper(aElt, aPseudoElt, true, aError);
} }
nsresult
nsGlobalWindowInner::GetComputedStyleHelper(nsIDOMElement* aElt,
const nsAString& aPseudoElt,
bool aDefaultStylesOnly,
nsICSSDeclaration** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nullptr;
nsCOMPtr<dom::Element> element = do_QueryInterface(aElt);
if (!element) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
ErrorResult rv;
nsCOMPtr<nsICSSDeclaration> cs =
GetComputedStyleHelper(*element, aPseudoElt, aDefaultStylesOnly, rv);
cs.forget(aReturn);
return rv.StealNSResult();
}
already_AddRefed<nsICSSDeclaration> already_AddRefed<nsICSSDeclaration>
nsGlobalWindowInner::GetComputedStyleHelper(Element& aElt, nsGlobalWindowInner::GetComputedStyleHelper(Element& aElt,
const nsAString& aPseudoElt, const nsAString& aPseudoElt,

View File

@@ -1241,10 +1241,6 @@ protected:
const nsAString& aPseudoElt, const nsAString& aPseudoElt,
bool aDefaultStylesOnly, bool aDefaultStylesOnly,
mozilla::ErrorResult& aError); mozilla::ErrorResult& aError);
nsresult GetComputedStyleHelper(nsIDOMElement* aElt,
const nsAString& aPseudoElt,
bool aDefaultStylesOnly,
nsICSSDeclaration** aReturn);
nsGlobalWindowInner* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError); nsGlobalWindowInner* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);

View File

@@ -108,7 +108,6 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "Crypto.h" #include "Crypto.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMOfflineResourceList.h" #include "nsIDOMOfflineResourceList.h"
#include "nsDOMString.h" #include "nsDOMString.h"
#include "nsIEmbeddingSiteWindow.h" #include "nsIEmbeddingSiteWindow.h"

View File

@@ -12,7 +12,6 @@
#include "nsHTMLContentSerializer.h" #include "nsHTMLContentSerializer.h"
#include "nsIDOMElement.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsElementTable.h" #include "nsElementTable.h"

View File

@@ -94,7 +94,6 @@ class nsIDocShellTreeItem;
class nsIDocumentEncoder; class nsIDocumentEncoder;
class nsIDocumentObserver; class nsIDocumentObserver;
class nsIDOMDocument; class nsIDOMDocument;
class nsIDOMElement;
class nsIHTMLCollection; class nsIHTMLCollection;
class nsILayoutHistoryState; class nsILayoutHistoryState;
class nsILoadContext; class nsILoadContext;

View File

@@ -42,7 +42,6 @@ class nsDOMAttributeMap;
class nsIAnimationObserver; class nsIAnimationObserver;
class nsIContent; class nsIContent;
class nsIDocument; class nsIDocument;
class nsIDOMElement;
class nsIFrame; class nsIFrame;
class nsIMutationObserver; class nsIMutationObserver;
class nsINode; class nsINode;

View File

@@ -17,7 +17,6 @@
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsIClassInfo.h" #include "nsIClassInfo.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIDOMElement.h"
#include "nsCOMArray.h" #include "nsCOMArray.h"
#include "nsIRunnable.h" #include "nsIRunnable.h"
#include "nsIGlobalObject.h" #include "nsIGlobalObject.h"

View File

@@ -12,7 +12,6 @@
#include "nsXHTMLContentSerializer.h" #include "nsXHTMLContentSerializer.h"
#include "nsIDOMElement.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsElementTable.h" #include "nsElementTable.h"

View File

@@ -134,8 +134,7 @@ function test4() {
'<child xmlns:b="ns2" xmlns:a="ns3">'+ '<child xmlns:b="ns2" xmlns:a="ns3">'+
'<child2/></child></root>'); '<child2/></child></root>');
root = doc.documentElement; root = doc.documentElement;
// Have to QI here -- no classinfo flattening in xpcshell, apparently var node = root.firstChild.firstChild;
var node = root.firstChild.firstChild.QueryInterface(nsIDOMElement);
node.setAttributeNS("ns4", "l1", "v1"); node.setAttributeNS("ns4", "l1", "v1");
node.setAttributeNS("ns4", "p2:l2", "v2"); node.setAttributeNS("ns4", "p2:l2", "v2");
node.setAttributeNS("", "l3", "v3"); node.setAttributeNS("", "l3", "v3");
@@ -251,8 +250,7 @@ function test7() {
'<child1 xmlns=""><child2/></child1></root>') '<child1 xmlns=""><child2/></child1></root>')
root = doc.documentElement; root = doc.documentElement;
// No interface flattening in xpcshell var child1 = root.firstChild;
var child1 = root.firstChild.QueryInterface(nsIDOMElement);
child1.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", child1.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
"http://www.w3.org/1999/xhtml"); "http://www.w3.org/1999/xhtml");
do_check_serialize(doc); do_check_serialize(doc);
@@ -265,9 +263,8 @@ function test7() {
'<child2 xmlns="http://www.w3.org/1999/xhtml"></child2>' + '<child2 xmlns="http://www.w3.org/1999/xhtml"></child2>' +
'</child1></root>') '</child1></root>')
root = doc.documentElement; root = doc.documentElement;
// No interface flattening in xpcshell child1 = root.firstChild;
child1 = root.firstChild.QueryInterface(nsIDOMElement); var child2 = child1.firstChild;
var child2 = child1.firstChild.QueryInterface(nsIDOMElement);
child1.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", child1.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
"http://www.w3.org/1999/xhtml"); "http://www.w3.org/1999/xhtml");
child2.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", ""); child2.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "");

View File

@@ -11,7 +11,6 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "nsIVariant.h" #include "nsIVariant.h"
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
#include "nsIDOMElement.h"
#include "nsIDragService.h" #include "nsIDragService.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"

View File

@@ -3353,13 +3353,10 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
} }
if (activeContent) { if (activeContent) {
// The nearest enclosing element goes into the // The nearest enclosing element goes into the :active state. If
// :active state. If we fail the QI to DOMElement, // we're not an element (so we're text or something) we need to obtain
// then we know we're only a node, and that we need // our parent element and put it into :active instead.
// to obtain our parent element and put it into :active if (!activeContent->IsElement()) {
// instead.
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(activeContent));
if (!elt) {
nsIContent* par = activeContent->GetParent(); nsIContent* par = activeContent->GetParent();
if (par) if (par)
activeContent = par; activeContent = par;

View File

@@ -31,7 +31,6 @@
#include "nsIContentPolicy.h" #include "nsIContentPolicy.h"
#include "nsContentPolicyUtils.h" #include "nsContentPolicyUtils.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsIDOMElement.h"
#include "nsError.h" #include "nsError.h"
#include "nsURILoader.h" #include "nsURILoader.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"

View File

@@ -15,7 +15,6 @@
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsFrameLoader.h" #include "nsFrameLoader.h"
#include "nsIDOMElement.h"
#include "nsIMozBrowserFrame.h" #include "nsIMozBrowserFrame.h"
#include "nsINode.h" #include "nsINode.h"
#include "nsIPrincipal.h" #include "nsIPrincipal.h"

View File

@@ -23,7 +23,6 @@
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsPresContext.h" #include "nsPresContext.h"
#include "nsIDOMNode.h" // for Find #include "nsIDOMNode.h" // for Find
#include "nsIDOMElement.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsDOMString.h" #include "nsDOMString.h"
#include "nsIStreamListener.h" #include "nsIStreamListener.h"

View File

@@ -54,7 +54,6 @@
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIDocShellTreeOwner.h" #include "nsIDocShellTreeOwner.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsIDOMWindowUtils.h" #include "nsIDOMWindowUtils.h"
#include "nsIInterfaceRequestorUtils.h" #include "nsIInterfaceRequestorUtils.h"

View File

@@ -21,7 +21,6 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIXPConnect.h" #include "nsIXPConnect.h"
#include "xpcpublic.h" #include "xpcpublic.h"
#include "nsIDOMElement.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsPluginInstanceOwner.h" #include "nsPluginInstanceOwner.h"
#include "nsWrapperCacheInlines.h" #include "nsWrapperCacheInlines.h"

View File

@@ -26,7 +26,6 @@
#include "nsPluginsDir.h" #include "nsPluginsDir.h"
#include "nsPluginLogging.h" #include "nsPluginLogging.h"
#include "nsIDOMElement.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "nsIDocument.h" #include "nsIDocument.h"
@@ -38,7 +37,9 @@
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
#include "nsWildCard.h" #include "nsWildCard.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/ToJSValue.h"
#include "nsIXULRuntime.h" #include "nsIXULRuntime.h"
#include "nsIXPConnect.h" #include "nsIXPConnect.h"
@@ -713,7 +714,7 @@ _getpluginelement(NPP npp)
if (!inst) if (!inst)
return nullptr; return nullptr;
nsCOMPtr<nsIDOMElement> element; RefPtr<dom::Element> element;
inst->GetDOMElement(getter_AddRefs(element)); inst->GetDOMElement(getter_AddRefs(element));
if (!element) if (!element)
@@ -733,10 +734,16 @@ _getpluginelement(NPP npp)
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID())); nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID()));
NS_ENSURE_TRUE(xpc, nullptr); NS_ENSURE_TRUE(xpc, nullptr);
JS::RootedObject obj(cx); JS::RootedValue val(cx);
xpc->WrapNative(cx, ::JS::CurrentGlobalOrNull(cx), element, if (!ToJSValue(cx, element, &val)) {
NS_GET_IID(nsIDOMElement), obj.address()); return nullptr;
NS_ENSURE_TRUE(obj, nullptr); }
if (NS_WARN_IF(!val.isObject())) {
return nullptr;
}
JS::RootedObject obj(cx, &val.toObject());
return nsJSObjWrapper::GetNewOrUsed(npp, obj); return nsJSObjWrapper::GetNewOrUsed(npp, obj);
} }
@@ -1451,18 +1458,13 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
} }
nsCOMPtr<nsIDOMElement> element; RefPtr<dom::Element> element;
inst->GetDOMElement(getter_AddRefs(element)); inst->GetDOMElement(getter_AddRefs(element));
if (!element) { if (!element) {
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
} }
nsCOMPtr<nsIContent> content(do_QueryInterface(element)); nsIPrincipal* principal = element->NodePrincipal();
if (!content) {
return NPERR_GENERIC_ERROR;
}
nsIPrincipal* principal = content->NodePrincipal();
nsAutoString utf16Origin; nsAutoString utf16Origin;
res = nsContentUtils::GetUTFOrigin(principal, utf16Origin); res = nsContentUtils::GetUTFOrigin(principal, utf16Origin);

View File

@@ -18,7 +18,6 @@
#include "nsPluginInstanceOwner.h" #include "nsPluginInstanceOwner.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsIDOMElement.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
@@ -33,6 +32,7 @@
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
#include "nsILoadContext.h" #include "nsILoadContext.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLObjectElementBinding.h" #include "mozilla/dom/HTMLObjectElementBinding.h"
#include "AudioChannelService.h" #include "AudioChannelService.h"
@@ -1088,7 +1088,7 @@ nsNPAPIPluginInstance::ConvertPoint(double sourceX, double sourceY, NPCoordinate
} }
nsresult nsresult
nsNPAPIPluginInstance::GetDOMElement(nsIDOMElement* *result) nsNPAPIPluginInstance::GetDOMElement(Element** result)
{ {
if (!mOwner) { if (!mOwner) {
*result = nullptr; *result = nullptr;

View File

@@ -31,6 +31,12 @@ class nsIPluginInstanceOwner;
class nsIOutputStream; class nsIOutputStream;
class nsPluginInstanceOwner; class nsPluginInstanceOwner;
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
#if defined(OS_WIN) #if defined(OS_WIN)
const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin; const NPDrawingModel kDefaultDrawingModel = NPDrawingModelSyncWin;
#elif defined(MOZ_X11) #elif defined(MOZ_X11)
@@ -190,7 +196,7 @@ public:
nsresult IsPrivateBrowsing(bool *aEnabled); nsresult IsPrivateBrowsing(bool *aEnabled);
nsresult GetDOMElement(nsIDOMElement* *result); nsresult GetDOMElement(mozilla::dom::Element* *result);
nsNPAPITimer* TimerWithID(uint32_t id, uint32_t* index); nsNPAPITimer* TimerWithID(uint32_t id, uint32_t* index);
uint32_t ScheduleTimer(uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); uint32_t ScheduleTimer(uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));

View File

@@ -52,6 +52,7 @@
#include "nsPluginStreamListenerPeer.h" #include "nsPluginStreamListenerPeer.h"
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FakePluginTagInitBinding.h" #include "mozilla/dom/FakePluginTagInitBinding.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/LoadInfo.h" #include "mozilla/LoadInfo.h"
@@ -70,7 +71,6 @@
// for the dialog // for the dialog
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsNetCID.h" #include "nsNetCID.h"
@@ -3297,15 +3297,14 @@ nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL,
rv = listenerPeer->Initialize(url, aInstance, aListener); rv = listenerPeer->Initialize(url, aInstance, aListener);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMElement> element; RefPtr<dom::Element> element;
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIDocument> doc;
if (owner) { if (owner) {
owner->GetDOMElement(getter_AddRefs(element)); owner->GetDOMElement(getter_AddRefs(element));
owner->GetDocument(getter_AddRefs(doc)); owner->GetDocument(getter_AddRefs(doc));
} }
nsCOMPtr<nsINode> requestingNode(do_QueryInterface(element)); NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(requestingNode, NS_ERROR_FAILURE);
nsCOMPtr<nsIChannel> channel; nsCOMPtr<nsIChannel> channel;
// @arg loadgroup: // @arg loadgroup:
@@ -3314,7 +3313,7 @@ nsresult nsPluginHost::NewPluginURLStream(const nsString& aURL,
// form |nsDocShell::OnLinkClickSync| bug 166613 // form |nsDocShell::OnLinkClickSync| bug 166613
rv = NS_NewChannel(getter_AddRefs(channel), rv = NS_NewChannel(getter_AddRefs(channel),
url, url,
requestingNode, element,
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS | nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS |
nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL, nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
nsIContentPolicy::TYPE_OBJECT_SUBREQUEST, nsIContentPolicy::TYPE_OBJECT_SUBREQUEST,
@@ -3857,7 +3856,7 @@ nsPluginHost::PluginCrashed(nsNPAPIPlugin* aPlugin,
if (instance->GetPlugin() == aPlugin) { if (instance->GetPlugin() == aPlugin) {
// notify the content node (nsIObjectLoadingContent) that the // notify the content node (nsIObjectLoadingContent) that the
// plugin has crashed // plugin has crashed
nsCOMPtr<nsIDOMElement> domElement; RefPtr<dom::Element> domElement;
instance->GetDOMElement(getter_AddRefs(domElement)); instance->GetDOMElement(getter_AddRefs(domElement));
nsCOMPtr<nsIObjectLoadingContent> objectContent(do_QueryInterface(domElement)); nsCOMPtr<nsIObjectLoadingContent> objectContent(do_QueryInterface(domElement));
if (objectContent) { if (objectContent) {
@@ -3952,7 +3951,7 @@ nsPluginHost::DestroyRunningInstances(nsPluginTag* aPluginTag)
nsPluginTag* pluginTag = TagForPlugin(instance->GetPlugin()); nsPluginTag* pluginTag = TagForPlugin(instance->GetPlugin());
instance->SetWindow(nullptr); instance->SetWindow(nullptr);
nsCOMPtr<nsIDOMElement> domElement; RefPtr<dom::Element> domElement;
instance->GetDOMElement(getter_AddRefs(domElement)); instance->GetDOMElement(getter_AddRefs(domElement));
nsCOMPtr<nsIObjectLoadingContent> objectContent = nsCOMPtr<nsIObjectLoadingContent> objectContent =
do_QueryInterface(domElement); do_QueryInterface(domElement);

View File

@@ -52,6 +52,7 @@ using mozilla::DefaultXDisplay;
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
#include "mozilla/dom/DragEvent.h" #include "mozilla/dom/DragEvent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h" #include "mozilla/dom/Event.h"
#include "mozilla/dom/HTMLObjectElementBinding.h" #include "mozilla/dom/HTMLObjectElementBinding.h"
#include "mozilla/dom/TabChild.h" #include "mozilla/dom/TabChild.h"
@@ -387,7 +388,7 @@ void nsPluginInstanceOwner::GetAttributes(nsTArray<MozPluginParameter>& attribut
loadingContent->GetPluginAttributes(attributes); loadingContent->GetPluginAttributes(attributes);
} }
NS_IMETHODIMP nsPluginInstanceOwner::GetDOMElement(nsIDOMElement* *result) NS_IMETHODIMP nsPluginInstanceOwner::GetDOMElement(Element** result)
{ {
return CallQueryReferent(mContent.get(), result); return CallQueryReferent(mContent.get(), result);
} }

View File

@@ -37,6 +37,7 @@ class gfxContext;
namespace mozilla { namespace mozilla {
class TextComposition; class TextComposition;
namespace dom { namespace dom {
class Element;
class Event; class Event;
struct MozPluginParameter; struct MozPluginParameter;
} // namespace dom } // namespace dom
@@ -95,7 +96,7 @@ public:
* @param aDOMElement - resulting DOM element * @param aDOMElement - resulting DOM element
* @result - NS_OK if this operation was successful * @result - NS_OK if this operation was successful
*/ */
NS_IMETHOD GetDOMElement(nsIDOMElement* * aResult); NS_IMETHOD GetDOMElement(mozilla::dom::Element** aResult);
// nsIDOMEventListener interfaces // nsIDOMEventListener interfaces
NS_DECL_NSIDOMEVENTLISTENER NS_DECL_NSIDOMEVENTLISTENER

View File

@@ -6,7 +6,6 @@
#include "nsPluginStreamListenerPeer.h" #include "nsPluginStreamListenerPeer.h"
#include "nsIContentPolicy.h" #include "nsIContentPolicy.h"
#include "nsContentPolicyUtils.h" #include "nsContentPolicyUtils.h"
#include "nsIDOMElement.h"
#include "nsIStreamConverterService.h" #include "nsIStreamConverterService.h"
#include "nsIStreamLoader.h" #include "nsIStreamLoader.h"
#include "nsIHttpChannel.h" #include "nsIHttpChannel.h"

View File

@@ -26,7 +26,6 @@
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
#include "nsPluginInstanceOwner.h" #include "nsPluginInstanceOwner.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
#include "nsIDOMElement.h"
#ifdef MOZ_X11 #ifdef MOZ_X11
#include "gfxXlibSurface.h" #include "gfxXlibSurface.h"
#endif #endif
@@ -2222,11 +2221,10 @@ PluginInstanceParent::AnswerPluginFocusChange(const bool& gotFocus)
nsPluginInstanceOwner* owner = GetOwner(); nsPluginInstanceOwner* owner = GetOwner();
if (owner) { if (owner) {
nsIFocusManager* fm = nsFocusManager::GetFocusManager(); nsIFocusManager* fm = nsFocusManager::GetFocusManager();
nsCOMPtr<nsIDOMElement> element; RefPtr<dom::Element> element;
owner->GetDOMElement(getter_AddRefs(element)); owner->GetDOMElement(getter_AddRefs(element));
if (fm && element) { if (fm && element) {
nsCOMPtr<dom::Element> domElement(do_QueryInterface(element)); fm->SetFocus(element, 0);
fm->SetFocus(domElement, 0);
} }
} }
} }

View File

@@ -13,6 +13,7 @@
#include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentChild.h"
#include "mozilla/ipc/CrashReporterClient.h" #include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/CrashReporterHost.h" #include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/dom/Element.h"
#include "mozilla/ipc/GeckoChildProcessHost.h" #include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/ipc/MessageChannel.h" #include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/ipc/ProtocolUtils.h"
@@ -2472,10 +2473,10 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
// Any IPC messages for the PluginInstance actor should be dispatched to the // Any IPC messages for the PluginInstance actor should be dispatched to the
// DocGroup for the plugin's document. // DocGroup for the plugin's document.
RefPtr<nsPluginInstanceOwner> owner = parentInstance->GetOwner(); RefPtr<nsPluginInstanceOwner> owner = parentInstance->GetOwner();
nsCOMPtr<nsIDOMElement> elt; RefPtr<dom::Element> elt;
owner->GetDOMElement(getter_AddRefs(elt)); owner->GetDOMElement(getter_AddRefs(elt));
if (nsCOMPtr<nsINode> node = do_QueryInterface(elt)) { if (elt) {
nsCOMPtr<nsIDocument> doc = node->OwnerDoc(); nsCOMPtr<nsIDocument> doc = elt->OwnerDoc();
if (doc) { if (doc) {
nsCOMPtr<nsIEventTarget> eventTarget = doc->EventTargetFor(TaskCategory::Other); nsCOMPtr<nsIEventTarget> eventTarget = doc->EventTargetFor(TaskCategory::Other);
SetEventTargetForActor(parentInstance, eventTarget); SetEventTargetForActor(parentInstance, eventTarget);

View File

@@ -317,7 +317,7 @@ nsSMILTimedElement::GetTargetElement()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsIDOMElementTimeControl methods // ElementTimeControl methods
// //
// The definition of the ElementTimeControl interface differs between SMIL // The definition of the ElementTimeControl interface differs between SMIL
// Animation and SVG 1.1. In SMIL Animation all methods have a void return // Animation and SVG 1.1. In SMIL Animation all methods have a void return

View File

@@ -63,7 +63,7 @@ public:
mozilla::dom::Element* GetTargetElement(); mozilla::dom::Element* GetTargetElement();
/** /**
* Methods for supporting the nsIDOMElementTimeControl interface. * Methods for supporting the ElementTimeControl interface.
*/ */
/* /*

View File

@@ -32,10 +32,10 @@ var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
var gTests = [ var gTests = [
/* /*
nsIDOMElement elementFromPoint(in long aX, Element elementFromPoint(in long aX,
in long aY, in long aY,
in boolean aIgnoreRootScrollFrame, in boolean aIgnoreRootScrollFrame,
in boolean aFlushLayout); in boolean aFlushLayout);
*/ */
async function testElementFromPoint() { async function testElementFromPoint() {
let onscreen = document.getElementById("onscreen"); let onscreen = document.getElementById("onscreen");

View File

@@ -17,7 +17,6 @@
#include "plstr.h" #include "plstr.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIContentInlines.h" #include "nsIContentInlines.h"
#include "nsIDOMElement.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"

View File

@@ -14,7 +14,6 @@
#include "nsIInputStream.h" #include "nsIInputStream.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsIDOMElement.h"
#include "nsIURL.h" #include "nsIURL.h"
#include "nsIChannel.h" #include "nsIChannel.h"
#include "nsString.h" #include "nsString.h"
@@ -616,7 +615,8 @@ nsXBLService::AttachGlobalKeyHandler(EventTarget* aTarget)
if (contentNode && contentNode->GetProperty(nsGkAtoms::listener)) if (contentNode && contentNode->GetProperty(nsGkAtoms::listener))
return NS_OK; return NS_OK;
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(contentNode)); Element* elt =
contentNode && contentNode->IsElement() ? contentNode->AsElement() : nullptr;
// Create the key handler // Create the key handler
RefPtr<nsXBLWindowKeyHandler> handler = RefPtr<nsXBLWindowKeyHandler> handler =

View File

@@ -13,7 +13,6 @@
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsXBLDocumentInfo.h" #include "nsXBLDocumentInfo.h"
#include "nsIDOMElement.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
@@ -162,7 +161,7 @@ nsXBLWindowKeyHandler::EnsureSpecialDocInfo()
sXBLSpecialDocInfo->LoadDocInfo(); sXBLSpecialDocInfo->LoadDocInfo();
} }
nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(Element* aElement,
EventTarget* aTarget) EventTarget* aTarget)
: mTarget(aTarget), : mTarget(aTarget),
mHandler(nullptr), mHandler(nullptr),
@@ -953,7 +952,7 @@ nsXBLWindowKeyHandler::IsExecutableElement(Element* aElement) const
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
already_AddRefed<nsXBLWindowKeyHandler> already_AddRefed<nsXBLWindowKeyHandler>
NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, EventTarget* aTarget) NS_NewXBLWindowKeyHandler(Element* aElement, EventTarget* aTarget)
{ {
RefPtr<nsXBLWindowKeyHandler> result = RefPtr<nsXBLWindowKeyHandler> result =
new nsXBLWindowKeyHandler(aElement, aTarget); new nsXBLWindowKeyHandler(aElement, aTarget);

View File

@@ -13,7 +13,6 @@
#include "nsIDOMEventListener.h" #include "nsIDOMEventListener.h"
class nsAtom; class nsAtom;
class nsIDOMElement;
class nsXBLPrototypeHandler; class nsXBLPrototypeHandler;
namespace mozilla { namespace mozilla {
@@ -35,7 +34,8 @@ class nsXBLWindowKeyHandler : public nsIDOMEventListener
typedef mozilla::dom::KeyboardEvent KeyboardEvent; typedef mozilla::dom::KeyboardEvent KeyboardEvent;
public: public:
nsXBLWindowKeyHandler(nsIDOMElement* aElement, mozilla::dom::EventTarget* aTarget); nsXBLWindowKeyHandler(mozilla::dom::Element* aElement,
mozilla::dom::EventTarget* aTarget);
void InstallKeyboardEventListenersTo( void InstallKeyboardEventListenersTo(
EventListenerManager* aEventListenerManager); EventListenerManager* aEventListenerManager);
@@ -138,7 +138,7 @@ protected:
}; };
already_AddRefed<nsXBLWindowKeyHandler> already_AddRefed<nsXBLWindowKeyHandler>
NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, NS_NewXBLWindowKeyHandler(mozilla::dom::Element* aElement,
mozilla::dom::EventTarget* aTarget); mozilla::dom::EventTarget* aTarget);
#endif #endif

View File

@@ -15,7 +15,6 @@
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsHTMLParts.h" #include "nsHTMLParts.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIDOMElement.h"
#include "nsIBaseWindow.h" #include "nsIBaseWindow.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"

View File

@@ -9,7 +9,6 @@
#include "nsIObserver.h" #include "nsIObserver.h"
#include "nsSyncLoadService.h" #include "nsSyncLoadService.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsIDOMElement.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"

View File

@@ -7,7 +7,6 @@
#include "nsAtom.h" #include "nsAtom.h"
#include "nsIAttribute.h" #include "nsIAttribute.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsINode.h" #include "nsINode.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "nsReadableUtils.h" #include "nsReadableUtils.h"

View File

@@ -8,7 +8,6 @@
#include "nsError.h" #include "nsError.h"
#include "nsIChannel.h" #include "nsIChannel.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsIDOMElement.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIIOService.h" #include "nsIIOService.h"

View File

@@ -14,7 +14,6 @@
#include "nsFocusManager.h" #include "nsFocusManager.h"
#include "nsIControllers.h" #include "nsIControllers.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsPresContext.h" #include "nsPresContext.h"

View File

@@ -18,7 +18,6 @@
#include "nsIContent.h" #include "nsIContent.h"
#include "nsICollation.h" #include "nsICollation.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMXULCommandDispatcher.h"
#include "nsIRDFService.h" #include "nsIRDFService.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"

View File

@@ -13,7 +13,6 @@
#include "nsString.h" #include "nsString.h"
#include "nsIControllers.h" #include "nsIControllers.h"
#include "nsIDOMElement.h"
#include "nsXULControllers.h" #include "nsXULControllers.h"
#include "nsIController.h" #include "nsIController.h"

View File

@@ -650,11 +650,6 @@ protected:
// Implementation methods // Implementation methods
nsresult EnsureContentsGenerated(void) const; nsresult EnsureContentsGenerated(void) const;
nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsAString& attrName);
static nsresult
ExecuteJSCode(nsIDOMElement* anElement, mozilla::WidgetEvent* aEvent);
// Helper routine that crawls a parent chain looking for a tree element. // Helper routine that crawls a parent chain looking for a tree element.
NS_IMETHOD GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement); NS_IMETHOD GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement);

View File

@@ -220,7 +220,6 @@ nsXULPopupListener::FireFocusOnTargetContent(nsIDOMNode* aTargetNode, bool aIsTo
nsCOMPtr<nsIContent> content = do_QueryInterface(aTargetNode); nsCOMPtr<nsIContent> content = do_QueryInterface(aTargetNode);
nsCOMPtr<nsIDocument> doc = content->OwnerDoc(); nsCOMPtr<nsIDocument> doc = content->OwnerDoc();
// Get nsIDOMElement for targetNode
// strong reference to keep this from going away between events // strong reference to keep this from going away between events
// XXXbz between what events? We don't use this local at all! // XXXbz between what events? We don't use this local at all!
RefPtr<nsPresContext> context = doc->GetPresContext(); RefPtr<nsPresContext> context = doc->GetPresContext();

View File

@@ -13,7 +13,6 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventListener.h" #include "nsIDOMEventListener.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"

View File

@@ -9,7 +9,6 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"