Bug 1402102 - Remove nsIDOMHTMLObjectElement; r=bz
Removes the nsIDOMHTMLObjectElement XPCOM interface, replacing it with
HTMLObjectElement and FromContent conversion usage.
MozReview-Commit-ID: dmsjSO97uh
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -37,17 +37,16 @@
#include "mozilla/dom/SVGTitleElement.h"
#include "nsIDOMEvent.h"
#include "nsIDOMFileList.h"
#include "nsIDOMMouseEvent.h"
#include "nsIFormControl.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLHtmlElement.h"
-#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIImageLoadingContent.h"
#include "nsIWebNavigation.h"
#include "nsIDOMHTMLElement.h"
#include "nsIPresShell.h"
#include "nsIStringBundle.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
@@ -1576,23 +1575,21 @@ ChromeContextMenuListener::HandleEvent(n
targetDOMnode = node;
}
}
}
// always consume events for plugins who may throw their own context menus
// but not for image objects. Document objects will never be targets or
// ancestors of targets, so that's OK.
- nsCOMPtr<nsIDOMHTMLObjectElement> objectElement;
- if (!(flags & nsIContextMenuListener::CONTEXT_IMAGE)) {
- objectElement = do_QueryInterface(node);
- }
-
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
- if (objectElement || (content && content->IsHTMLElement(nsGkAtoms::embed))) {
+ if (content &&
+ (content->IsHTMLElement(nsGkAtoms::embed) ||
+ (!(flags & nsIContextMenuListener::CONTEXT_IMAGE) &&
+ content->IsHTMLElement(nsGkAtoms::object)))) {
return NS_OK;
}
}
// Bubble out, looking for items of interest
do {
uint16_t nodeType;
res = node->GetNodeType(&nodeType);
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -15,17 +15,16 @@
#include "nsIConsoleService.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsIDocShell.h"
#include "nsIDocShellLoadInfo.h"
#include "nsIDocument.h"
#include "nsIDOMCustomEvent.h"
#include "nsIDOMDocument.h"
-#include "nsIDOMHTMLObjectElement.h"
#include "nsIExternalProtocolHandler.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIObjectFrame.h"
#include "nsIOService.h"
#include "nsIPermissionManager.h"
#include "nsPluginHost.h"
#include "nsPluginInstanceOwner.h"
#include "nsJSNPRuntime.h"
@@ -887,24 +886,24 @@ nsObjectLoadingContent::GetNestedParams(
nsAutoString name;
element->GetAttribute(NS_LITERAL_STRING("name"), name);
if (name.IsEmpty())
continue;
nsCOMPtr<nsIContent> parent = element->GetParent();
- nsCOMPtr<nsIDOMHTMLObjectElement> domObject;
- while (!domObject && parent) {
- domObject = do_QueryInterface(parent);
+ RefPtr<HTMLObjectElement> objectElement;
+ while (!objectElement && parent) {
+ objectElement = HTMLObjectElement::FromContent(parent);
parent = parent->GetParent();
}
- if (domObject) {
- parent = do_QueryInterface(domObject);
+ if (objectElement) {
+ parent = objectElement;
} else {
continue;
}
if (parent == ourElement) {
MozPluginParameter param;
element->GetAttribute(NS_LITERAL_STRING("name"), param.mName);
element->GetAttribute(NS_LITERAL_STRING("value"), param.mValue);
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -93,17 +93,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLObjectElement,
nsGenericHTMLFormElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLObjectElement,
nsGenericHTMLFormElement,
- nsIDOMHTMLObjectElement,
imgINotificationObserver,
nsIRequestObserver,
nsIStreamListener,
nsIFrameLoaderOwner,
nsIObjectLoadingContent,
nsIImageLoadingContent,
imgIOnloadBlocker,
nsIChannelEventSink,
@@ -229,22 +228,16 @@ NS_IMETHODIMP
HTMLObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
{
HandleFocusBlurPlugin(this, aVisitor.mEvent);
return NS_OK;
}
#endif // #ifdef XP_MACOSX
-NS_IMETHODIMP
-HTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm)
-{
- return nsGenericHTMLFormElement::GetForm(aForm);
-}
-
nsresult
HTMLObjectElement::BindToTree(nsIDocument *aDocument,
nsIContent *aParent,
nsIContent *aBindingParent,
bool aCompileEventHandlers)
{
nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
aBindingParent,
@@ -433,50 +426,22 @@ HTMLObjectElement::SubmitNamesValues(HTM
nsAutoString value;
nsresult rv = pi->GetFormValue(value);
NS_ENSURE_SUCCESS(rv, rv);
return aFormSubmission->AddNameValuePair(name, value);
}
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Align, align)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Archive, archive)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Border, border)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Code, code)
-NS_IMPL_URI_ATTR(HTMLObjectElement, CodeBase, codebase)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, CodeType, codetype)
-NS_IMPL_URI_ATTR_WITH_BASE(HTMLObjectElement, Data, data, codebase)
-NS_IMPL_BOOL_ATTR(HTMLObjectElement, Declare, declare)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Height, height)
-NS_IMPL_INT_ATTR(HTMLObjectElement, Hspace, hspace)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Name, name)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Standby, standby)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Type, type)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, UseMap, usemap)
-NS_IMPL_INT_ATTR(HTMLObjectElement, Vspace, vspace)
-NS_IMPL_STRING_ATTR(HTMLObjectElement, Width, width)
-
int32_t
HTMLObjectElement::TabIndexDefault()
{
return IsFocusableForTabIndex() ? 0 : -1;
}
-NS_IMETHODIMP
-HTMLObjectElement::GetContentDocument(nsIDOMDocument **aContentDocument)
-{
- NS_ENSURE_ARG_POINTER(aContentDocument);
-
- nsCOMPtr<nsIDOMDocument> domDoc =
- do_QueryInterface(GetContentDocument(*nsContentUtils::SubjectPrincipal()));
- domDoc.forget(aContentDocument);
- return NS_OK;
-}
-
nsPIDOMWindowOuter*
HTMLObjectElement::GetContentWindow(nsIPrincipal& aSubjectPrincipal)
{
nsIDocument* doc = GetContentDocument(aSubjectPrincipal);
if (doc) {
return doc->GetWindow();
}
--- a/dom/html/HTMLObjectElement.h
+++ b/dom/html/HTMLObjectElement.h
@@ -5,27 +5,25 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_HTMLObjectElement_h
#define mozilla_dom_HTMLObjectElement_h
#include "mozilla/Attributes.h"
#include "nsGenericHTMLElement.h"
#include "nsObjectLoadingContent.h"
-#include "nsIDOMHTMLObjectElement.h"
#include "nsIConstraintValidation.h"
namespace mozilla {
namespace dom {
class HTMLFormSubmission;
class HTMLObjectElement final : public nsGenericHTMLFormElement
, public nsObjectLoadingContent
- , public nsIDOMHTMLObjectElement
, public nsIConstraintValidation
{
public:
explicit HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser = NOT_FROM_PARSER);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@@ -46,19 +44,16 @@ public:
#endif
// Element
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
// EventTarget
virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
- // nsIDOMHTMLObjectElement
- NS_DECL_NSIDOMHTMLOBJECTELEMENT
-
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,
bool aCompileEventHandlers) override;
virtual void UnbindFromTree(bool aDeep = true,
bool aNullParent = true) override;
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
virtual IMEState GetDesiredIMEState() override;
@@ -90,17 +85,20 @@ public:
nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
void StartObjectLoad() { StartObjectLoad(true, false); }
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLObjectElement,
nsGenericHTMLFormElement)
// Web IDL binding methods
- // XPCOM GetData is ok; note that it's a URI attribute with a weird base URI
+ void GetData(DOMString& aValue)
+ {
+ GetURIAttr(nsGkAtoms::data, nsGkAtoms::codebase, aValue);
+ }
void SetData(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::data, aValue, aRv);
}
void GetType(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::type, aValue);
}
@@ -167,17 +165,20 @@ public:
void GetArchive(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::archive, aValue);
}
void SetArchive(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::archive, aValue, aRv);
}
- // XPCOM GetCode is ok
+ void GetCode(DOMString& aValue)
+ {
+ GetHTMLAttr(nsGkAtoms::code, aValue);
+ }
void SetCode(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::code, aValue, aRv);
}
bool Declare()
{
return GetBoolAttr(nsGkAtoms::declare);
}
@@ -204,17 +205,20 @@ public:
uint32_t Vspace()
{
return GetUnsignedIntAttr(nsGkAtoms::vspace, 0);
}
void SetVspace(uint32_t aValue, ErrorResult& aRv)
{
SetUnsignedIntAttr(nsGkAtoms::vspace, aValue, 0, aRv);
}
- // XPCOM GetCodebase is ok; note that it's a URI attribute
+ void GetCodeBase(DOMString& aValue)
+ {
+ GetURIAttr(nsGkAtoms::codebase, nullptr, aValue);
+ }
void SetCodeBase(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::codebase, aValue, aRv);
}
void GetCodeType(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::codetype, aValue);
}
--- a/dom/interfaces/html/moz.build
+++ b/dom/interfaces/html/moz.build
@@ -20,17 +20,16 @@ XPIDL_SOURCES += [
'nsIDOMHTMLFrameElement.idl',
'nsIDOMHTMLHtmlElement.idl',
'nsIDOMHTMLIFrameElement.idl',
'nsIDOMHTMLImageElement.idl',
'nsIDOMHTMLInputElement.idl',
'nsIDOMHTMLLinkElement.idl',
'nsIDOMHTMLMediaElement.idl',
'nsIDOMHTMLMenuItemElement.idl',
- 'nsIDOMHTMLObjectElement.idl',
'nsIDOMHTMLOptionElement.idl',
'nsIDOMHTMLOptionsCollection.idl',
'nsIDOMHTMLScriptElement.idl',
'nsIDOMHTMLSelectElement.idl',
'nsIDOMHTMLSourceElement.idl',
'nsIDOMHTMLTextAreaElement.idl',
'nsIDOMMozBrowserFrame.idl',
'nsIDOMTimeRanges.idl',
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMHTMLObjectElement.idl
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIDOMHTMLElement.idl"
-
-/**
- * The nsIDOMHTMLObjectElement interface is the interface to a [X]HTML
- * object element.
- *
- * This interface is trying to follow the DOM Level 2 HTML specification:
- * http://www.w3.org/TR/DOM-Level-2-HTML/
- *
- * with changes from the work-in-progress WHATWG HTML specification:
- * http://www.whatwg.org/specs/web-apps/current-work/
- */
-
-interface nsIDOMValidityState;
-
-[uuid(baf443d2-da5d-40c9-be3c-c65a69a25250)]
-interface nsIDOMHTMLObjectElement : nsISupports
-{
- readonly attribute nsIDOMHTMLFormElement form;
- attribute DOMString code;
- attribute DOMString align;
- attribute DOMString archive;
- attribute DOMString border;
- attribute DOMString codeBase;
- attribute DOMString codeType;
- attribute DOMString data;
- attribute boolean declare;
- attribute DOMString height;
- attribute long hspace;
- attribute DOMString name;
- attribute DOMString standby;
- attribute DOMString type;
- attribute DOMString useMap;
- attribute long vspace;
- attribute DOMString width;
- // Introduced in DOM Level 2:
- readonly attribute nsIDOMDocument contentDocument;
-};
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -30,17 +30,16 @@ using mozilla::DefaultXDisplay;
#include "mozilla/Preferences.h"
#include "nsILinkHandler.h"
#include "nsIDocShellTreeItem.h"
#include "nsIWebBrowserChrome.h"
#include "nsLayoutUtils.h"
#include "nsIPluginWidget.h"
#include "nsViewManager.h"
#include "nsIDocShellTreeOwner.h"
-#include "nsIDOMHTMLObjectElement.h"
#include "nsIAppShell.h"
#include "nsIObjectLoadingContent.h"
#include "nsObjectLoadingContent.h"
#include "nsAttrName.h"
#include "nsIFocusManager.h"
#include "nsFocusManager.h"
#include "nsIDOMDragEvent.h"
#include "nsIScriptSecurityManager.h"
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -2,16 +2,17 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebBrowserPersistLocalDocument.h"
#include "WebBrowserPersistDocumentParent.h"
#include "mozilla/dom/HTMLInputElement.h"
+#include "mozilla/dom/HTMLObjectElement.h"
#include "mozilla/dom/HTMLSharedElement.h"
#include "mozilla/dom/TabParent.h"
#include "nsComponentManagerUtils.h"
#include "nsContentUtils.h"
#include "nsContentCID.h"
#include "nsCycleCollectionParticipant.h"
#include "nsFrameLoader.h"
#include "nsIComponentRegistrar.h"
@@ -25,17 +26,16 @@
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLMediaElement.h"
-#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMHTMLSourceElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMMozNamedAttrMap.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMNodeList.h"
@@ -527,18 +527,17 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
if (content->IsSVGElement(nsGkAtoms::script)) {
return OnWalkAttribute(aNode, "href", "http://www.w3.org/1999/xlink");
}
if (content->IsHTMLElement(nsGkAtoms::embed)) {
return OnWalkAttribute(aNode, "src");
}
- nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNode);
- if (nodeAsObject) {
+ if (content->IsHTMLElement(nsGkAtoms::object)) {
return OnWalkAttribute(aNode, "data");
}
nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNode);
if (nodeAsLink) {
// Test if the link has a rel value indicating it to be a stylesheet
nsAutoString linkRel;
if (NS_SUCCEEDED(nodeAsLink->GetRel(linkRel)) && !linkRel.IsEmpty()) {
@@ -1061,18 +1060,17 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
if (content->IsHTMLElement(nsGkAtoms::embed)) {
rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
FixupAttribute(*aNodeOut, "src");
}
return rv;
}
- nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNodeIn);
- if (nodeAsObject) {
+ if (content->IsHTMLElement(nsGkAtoms::object)) {
rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
FixupAttribute(*aNodeOut, "data");
}
return rv;
}
nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNodeIn);
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -40,17 +40,16 @@
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLinkElement.h"
-#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMNode.h"
#include "nsIDocument.h"
#include "nsIEditRules.h"
#include "nsIFile.h"
#include "nsIInputStream.h"
#include "nsIMIMEService.h"
#include "nsNameSpaceManager.h"
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -37,17 +37,16 @@ static const char sPrintSettingsServiceC
// Printing Events
#include "nsPrintPreviewListener.h"
#include "nsThreadUtils.h"
// Printing
#include "nsIWebBrowserPrint.h"
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMHTMLIFrameElement.h"
-#include "nsIDOMHTMLObjectElement.h"
// Print Preview
#include "imgIContainer.h" // image animation mode constants
#include "nsIWebBrowserPrint.h" // needed for PrintPreview Navigation constants
// Print Progress
#include "nsIPrintProgress.h"
#include "nsIPrintProgressParams.h"
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -57,17 +57,16 @@
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMHTMLMenuItemElement.h"
-#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLOptionsCollection.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMHTMLSourceElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMediaList.h"
@@ -334,17 +333,16 @@ const ComponentsInterfaceShimEntry kComp
DEFINE_SHIM(HTMLFrameElement),
DEFINE_SHIM(HTMLHtmlElement),
DEFINE_SHIM(HTMLIFrameElement),
DEFINE_SHIM(HTMLImageElement),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM(HTMLLinkElement),
DEFINE_SHIM(HTMLMediaElement),
DEFINE_SHIM(HTMLMenuItemElement),
- DEFINE_SHIM(HTMLObjectElement),
DEFINE_SHIM(HTMLOptionElement),
DEFINE_SHIM(HTMLOptionsCollection),
DEFINE_SHIM(HTMLScriptElement),
DEFINE_SHIM(HTMLSelectElement),
DEFINE_SHIM(HTMLSourceElement),
DEFINE_SHIM(HTMLTextAreaElement),
DEFINE_SHIM(KeyEvent),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),