Bug 1402102 - Remove nsIDOMHTMLObjectElement; r=bz

Removes the nsIDOMHTMLObjectElement XPCOM interface, replacing it with
HTMLObjectElement and FromContent conversion usage.

MozReview-Commit-ID: dmsjSO97uh

--HG--
extra : rebase_source : 9b2c25b8681f754bc34233afccdb6fc5d38f0804
This commit is contained in:
Kyle Machulis 2017-09-22 17:05:12 -07:00
parent 6dfffba33a
commit 9b4ac7e03f
11 changed files with 24 additions and 110 deletions

View File

@ -42,7 +42,6 @@
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIImageLoadingContent.h"
#include "nsIWebNavigation.h"
@ -1581,13 +1580,11 @@ ChromeContextMenuListener::HandleEvent(nsIDOMEvent* aMouseEvent)
// 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;
}
}

View File

@ -20,7 +20,6 @@
#include "nsIDocument.h"
#include "nsIDOMCustomEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIExternalProtocolHandler.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIObjectFrame.h"
@ -892,14 +891,14 @@ nsObjectLoadingContent::GetNestedParams(nsTArray<MozPluginParameter>& aParams)
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;
}

View File

@ -98,7 +98,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLObjectElement,
nsGenericHTMLFormElement,
nsIDOMHTMLObjectElement,
imgINotificationObserver,
nsIRequestObserver,
nsIStreamListener,
@ -234,12 +233,6 @@ HTMLObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
#endif // #ifdef XP_MACOSX
NS_IMETHODIMP
HTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm)
{
return nsGenericHTMLFormElement::GetForm(aForm);
}
nsresult
HTMLObjectElement::BindToTree(nsIDocument *aDocument,
nsIContent *aParent,
@ -438,40 +431,12 @@ HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission *aFormSubmission)
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)
{

View File

@ -10,7 +10,6 @@
#include "mozilla/Attributes.h"
#include "nsGenericHTMLElement.h"
#include "nsObjectLoadingContent.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIConstraintValidation.h"
namespace mozilla {
@ -20,7 +19,6 @@ class HTMLFormSubmission;
class HTMLObjectElement final : public nsGenericHTMLFormElement
, public nsObjectLoadingContent
, public nsIDOMHTMLObjectElement
, public nsIConstraintValidation
{
public:
@ -51,9 +49,6 @@ public:
// EventTarget
virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
// nsIDOMHTMLObjectElement
NS_DECL_NSIDOMHTMLOBJECTELEMENT
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,
bool aCompileEventHandlers) override;
@ -95,7 +90,10 @@ public:
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);
@ -172,7 +170,10 @@ public:
{
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);
@ -209,7 +210,10 @@ public:
{
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);

View File

@ -25,7 +25,6 @@ XPIDL_SOURCES += [
'nsIDOMHTMLLinkElement.idl',
'nsIDOMHTMLMediaElement.idl',
'nsIDOMHTMLMenuItemElement.idl',
'nsIDOMHTMLObjectElement.idl',
'nsIDOMHTMLOptionElement.idl',
'nsIDOMHTMLOptionsCollection.idl',
'nsIDOMHTMLScriptElement.idl',

View File

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

View File

@ -35,7 +35,6 @@ using mozilla::DefaultXDisplay;
#include "nsIPluginWidget.h"
#include "nsViewManager.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIAppShell.h"
#include "nsIObjectLoadingContent.h"
#include "nsObjectLoadingContent.h"

View File

@ -7,6 +7,7 @@
#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"
@ -30,7 +31,6 @@
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMHTMLSourceElement.h"
@ -532,8 +532,7 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
return OnWalkAttribute(aNode, "src");
}
nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNode);
if (nodeAsObject) {
if (content->IsHTMLElement(nsGkAtoms::object)) {
return OnWalkAttribute(aNode, "data");
}
@ -1066,8 +1065,7 @@ PersistNodeFixup::FixupNode(nsIDOMNode *aNodeIn,
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");

View File

@ -45,7 +45,6 @@
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMNode.h"
#include "nsIDocument.h"

View File

@ -42,7 +42,6 @@ static const char sPrintSettingsServiceContractID[] = "@mozilla.org/gfx/printset
#include "nsIWebBrowserPrint.h"
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLObjectElement.h"
// Print Preview
#include "imgIContainer.h" // image animation mode constants

View File

@ -62,7 +62,6 @@
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMHTMLMenuItemElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLOptionsCollection.h"
#include "nsIDOMHTMLScriptElement.h"
@ -339,7 +338,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM(HTMLLinkElement),
DEFINE_SHIM(HTMLMediaElement),
DEFINE_SHIM(HTMLMenuItemElement),
DEFINE_SHIM(HTMLObjectElement),
DEFINE_SHIM(HTMLOptionElement),
DEFINE_SHIM(HTMLOptionsCollection),
DEFINE_SHIM(HTMLScriptElement),