Bug 1416069 - Remove nsIDOMHTMLHtmlElement and nsIDOMHTMLBaseElement
MozReview-Commit-ID: 7qUw7cLeTpe
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -33,17 +33,16 @@
#include "Link.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/SVGTitleElement.h"
#include "nsIDOMEvent.h"
#include "nsIDOMFileList.h"
#include "nsIDOMMouseEvent.h"
#include "nsIFormControl.h"
#include "nsIDOMHTMLInputElement.h"
-#include "nsIDOMHTMLHtmlElement.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"
--- a/dom/html/HTMLSharedElement.cpp
+++ b/dom/html/HTMLSharedElement.cpp
@@ -26,72 +26,41 @@ namespace mozilla {
namespace dom {
extern nsAttrValue::EnumTable kListTypeTable[];
HTMLSharedElement::~HTMLSharedElement()
{
}
-NS_IMPL_ADDREF_INHERITED(HTMLSharedElement, nsGenericHTMLElement)
-NS_IMPL_RELEASE_INHERITED(HTMLSharedElement, nsGenericHTMLElement)
-
-// QueryInterface implementation for HTMLSharedElement
-NS_INTERFACE_MAP_BEGIN(HTMLSharedElement)
- NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseElement, base)
- NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLHtmlElement, html)
-NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
-
-
NS_IMPL_ELEMENT_CLONE(HTMLSharedElement)
-// nsIDOMHTMLQuoteElement
-// Empty
-
-// nsIDOMHTMLHeadElement
-// Empty
-
-// nsIDOMHTMLHtmlElement
-NS_IMPL_STRING_ATTR(HTMLSharedElement, Version, version)
-
-// nsIDOMHTMLBaseElement
-NS_IMPL_STRING_ATTR(HTMLSharedElement, Target, target)
-
-NS_IMETHODIMP
+void
HTMLSharedElement::GetHref(nsAString& aValue)
{
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::base),
"This should only get called for <base> elements");
nsAutoString href;
GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> uri;
nsIDocument* doc = OwnerDoc();
nsContentUtils::NewURIWithDocumentCharset(
getter_AddRefs(uri), href, doc, doc->GetFallbackBaseURI());
if (!uri) {
aValue = href;
- return NS_OK;
+ return;
}
nsAutoCString spec;
uri->GetSpec(spec);
CopyUTF8toUTF16(spec, aValue);
-
- return NS_OK;
}
-NS_IMETHODIMP
-HTMLSharedElement::SetHref(const nsAString& aValue)
-{
- return SetAttrHelper(nsGkAtoms::href, aValue);
-}
-
-
bool
HTMLSharedElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None &&
mNodeInfo->Equals(nsGkAtoms::dir)) {
--- a/dom/html/HTMLSharedElement.h
+++ b/dom/html/HTMLSharedElement.h
@@ -2,51 +2,38 @@
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_HTMLSharedElement_h
#define mozilla_dom_HTMLSharedElement_h
-#include "nsIDOMHTMLBaseElement.h"
-#include "nsIDOMHTMLHtmlElement.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "mozilla/Attributes.h"
#include "mozilla/Assertions.h"
namespace mozilla {
namespace dom {
-class HTMLSharedElement final : public nsGenericHTMLElement,
- public nsIDOMHTMLBaseElement,
- public nsIDOMHTMLHtmlElement
+class HTMLSharedElement final : public nsGenericHTMLElement
{
public:
explicit HTMLSharedElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
if (mNodeInfo->Equals(nsGkAtoms::head) ||
mNodeInfo->Equals(nsGkAtoms::html)) {
SetHasWeirdParserInsertionMode();
}
}
- // nsISupports
- NS_DECL_ISUPPORTS_INHERITED
-
- // nsIDOMHTMLBaseElement
- NS_DECL_NSIDOMHTMLBASEELEMENT
-
- // nsIDOMHTMLHtmlElement
- NS_DECL_NSIDOMHTMLHTMLELEMENT
-
// nsIContent
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult) override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@@ -110,17 +97,18 @@ public:
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::base));
GetHTMLAttr(nsGkAtoms::target, aValue);
}
void SetTarget(const nsAString& aValue, ErrorResult& aResult)
{
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::base));
SetHTMLAttr(nsGkAtoms::target, aValue, aResult);
}
- // The XPCOM GetHref is fine for us
+
+ void GetHref(nsAString& aValue);
void SetHref(const nsAString& aValue, ErrorResult& aResult)
{
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::base));
SetHTMLAttr(nsGkAtoms::href, aValue, aResult);
}
// HTMLDirectoryElement
bool Compact() const
--- a/dom/interfaces/html/moz.build
+++ b/dom/interfaces/html/moz.build
@@ -3,22 +3,20 @@
# 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/.
with Files("**"):
BUG_COMPONENT = ("Core", "DOM")
XPIDL_SOURCES += [
- 'nsIDOMHTMLBaseElement.idl',
'nsIDOMHTMLCollection.idl',
'nsIDOMHTMLDocument.idl',
'nsIDOMHTMLElement.idl',
'nsIDOMHTMLFormElement.idl',
- 'nsIDOMHTMLHtmlElement.idl',
'nsIDOMHTMLInputElement.idl',
'nsIDOMHTMLMediaElement.idl',
'nsIDOMMozBrowserFrame.idl',
'nsIDOMTimeRanges.idl',
'nsIDOMValidityState.idl',
'nsIMozBrowserFrame.idl',
]
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMHTMLBaseElement.idl
+++ /dev/null
@@ -1,24 +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 nsIDOMHTMLBaseElement interface is the interface to a [X]HTML
- * base 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/
- */
-
-[uuid(a348ac22-7880-4613-af4c-984ec2ef5adc)]
-interface nsIDOMHTMLBaseElement : nsISupports
-{
- attribute DOMString href;
- attribute DOMString target;
-};
deleted file mode 100644
--- a/dom/interfaces/html/nsIDOMHTMLHtmlElement.idl
+++ /dev/null
@@ -1,23 +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 nsIDOMHTMLHtmlElement interface is the interface to a [X]HTML
- * html 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/
- */
-
-[uuid(6a5d2ce7-2c45-43c1-bdab-9df7a06caed1)]
-interface nsIDOMHTMLHtmlElement : nsISupports
-{
- attribute DOMString version;
-};
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -20,17 +20,16 @@
#include "nsContentCID.h"
#include "nsCycleCollectionParticipant.h"
#include "nsFrameLoader.h"
#include "nsIComponentRegistrar.h"
#include "nsIContent.h"
#include "nsIDOMAttr.h"
#include "nsIDOMComment.h"
#include "nsIDOMDocument.h"
-#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMMozNamedAttrMap.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsIDOMNodeList.h"
@@ -894,45 +893,46 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
FixupURI(href);
FixupXMLStyleSheetLink(outNode, href);
}
}
}
return NS_OK;
}
- // BASE elements are replaced by a comment so relative links are not hosed.
- if (!IsFlagSet(IWBP::PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS)) {
- nsCOMPtr<nsIDOMHTMLBaseElement> nodeAsBase = do_QueryInterface(aNodeIn);
- if (nodeAsBase) {
- nsCOMPtr<nsIDOMDocument> ownerDocument;
- auto* base = static_cast<dom::HTMLSharedElement*>(nodeAsBase.get());
- base->GetOwnerDocument(getter_AddRefs(ownerDocument));
- if (ownerDocument) {
- nsAutoString href;
- base->GetHref(href); // Doesn't matter if this fails
- nsCOMPtr<nsIDOMComment> comment;
- nsAutoString commentText;
- commentText.AssignLiteral(" base ");
- if (!href.IsEmpty()) {
- commentText += NS_LITERAL_STRING("href=\"") + href
- + NS_LITERAL_STRING("\" ");
- }
- rv = ownerDocument->CreateComment(commentText,
- getter_AddRefs(comment));
- if (comment) {
- return CallQueryInterface(comment, aNodeOut);
- }
- }
- return NS_OK;
- }
+ nsCOMPtr<nsIContent> content = do_QueryInterface(aNodeIn);
+ if (!content) {
+ return NS_OK;
}
- nsCOMPtr<nsIContent> content = do_QueryInterface(aNodeIn);
- if (!content) {
+ // BASE elements are replaced by a comment so relative links are not hosed.
+ if (!IsFlagSet(IWBP::PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS) &&
+ content->IsHTMLElement(nsGkAtoms::base)) {
+ nsCOMPtr<nsIDOMDocument> ownerDocument;
+ // Base uses HTMLSharedElement, which would be awkward to implement
+ // FromContent on, since it represents multiple elements. Since we've
+ // already checked IsHTMLElement here, just cast as we were doing.
+ auto* base = static_cast<dom::HTMLSharedElement*>(content.get());
+ base->GetOwnerDocument(getter_AddRefs(ownerDocument));
+ if (ownerDocument) {
+ nsAutoString href;
+ base->GetHref(href); // Doesn't matter if this fails
+ nsCOMPtr<nsIDOMComment> comment;
+ nsAutoString commentText;
+ commentText.AssignLiteral(" base ");
+ if (!href.IsEmpty()) {
+ commentText += NS_LITERAL_STRING("href=\"") + href
+ + NS_LITERAL_STRING("\" ");
+ }
+ rv = ownerDocument->CreateComment(commentText,
+ getter_AddRefs(comment));
+ if (comment) {
+ return CallQueryInterface(comment, aNodeOut);
+ }
+ }
return NS_OK;
}
// Fix up href and file links in the elements
RefPtr<dom::HTMLAnchorElement> nodeAsAnchor = dom::HTMLAnchorElement::FromContent(content);
if (nodeAsAnchor) {
rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -40,22 +40,20 @@
#include "nsIDOMElement.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMFileList.h"
#include "nsIDOMFocusEvent.h"
#include "nsIDOMFormData.h"
#include "nsIDOMGeoPositionError.h"
#include "nsIDOMHistory.h"
-#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMMutationEvent.h"
#include "nsIDOMMozNamedAttrMap.h"
@@ -136,17 +134,16 @@
#include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/FileListBinding.h"
#include "mozilla/dom/FocusEventBinding.h"
#include "mozilla/dom/FormDataBinding.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/HistoryBinding.h"
#include "mozilla/dom/HTMLAnchorElementBinding.h"
#include "mozilla/dom/HTMLAreaElementBinding.h"
-#include "mozilla/dom/HTMLBaseElementBinding.h"
#include "mozilla/dom/HTMLButtonElementBinding.h"
#include "mozilla/dom/HTMLCollectionBinding.h"
#include "mozilla/dom/HTMLDocumentBinding.h"
#include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/HTMLFormElementBinding.h"
#include "mozilla/dom/HTMLFrameSetElementBinding.h"
#include "mozilla/dom/HTMLHtmlElementBinding.h"
#include "mozilla/dom/HTMLInputElementBinding.h"
@@ -288,22 +285,20 @@ const ComponentsInterfaceShimEntry kComp
DEFINE_SHIM(Event),
DEFINE_SHIM(EventTarget),
DEFINE_SHIM(FileList),
DEFINE_SHIM(FocusEvent),
DEFINE_SHIM(FormData),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIFrameLoader, FrameLoader),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
DEFINE_SHIM(History),
- DEFINE_SHIM(HTMLBaseElement),
DEFINE_SHIM(HTMLCollection),
DEFINE_SHIM(HTMLDocument),
DEFINE_SHIM(HTMLElement),
DEFINE_SHIM(HTMLFormElement),
- DEFINE_SHIM(HTMLHtmlElement),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM(HTMLMediaElement),
DEFINE_SHIM(KeyEvent),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
DEFINE_SHIM(MediaList),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIMenuBoxObject, MenuBoxObject),
DEFINE_SHIM(MouseEvent),
DEFINE_SHIM(MouseScrollEvent),