Backed out changeset f99c758cd03e (bug 1406525) for Windows build bustage

MozReview-Commit-ID: 1mr4kaJl8hR
This commit is contained in:
Phil Ringnalda 2017-10-06 22:40:54 -07:00
parent b91f02872e
commit 89e0db3395
10 changed files with 83 additions and 43 deletions

View File

@ -668,7 +668,7 @@ BrowserElementChild.prototype = {
let isHTMLLink = node =>
((ChromeUtils.getClassName(node) === "HTMLAnchorElement" && node.href) ||
(ChromeUtils.getClassName(node) === "HTMLAreaElement" && node.href) ||
ChromeUtils.getClassName(node) === "HTMLLinkElement");
node instanceof Ci.nsIDOMHTMLLinkElement);
// Open in a new tab if middle click or ctrl/cmd-click,
// and e.target is a link or inside a link.

View File

@ -77,6 +77,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLLinkElement,
nsGenericHTMLElement,
nsIDOMHTMLLinkElement,
nsIStyleSheetLinkingElement,
Link)
@ -89,6 +90,13 @@ HTMLLinkElement::Disabled()
return ss && ss->Disabled();
}
NS_IMETHODIMP
HTMLLinkElement::GetMozDisabled(bool* aDisabled)
{
*aDisabled = Disabled();
return NS_OK;
}
void
HTMLLinkElement::SetDisabled(bool aDisabled)
{
@ -97,6 +105,23 @@ HTMLLinkElement::SetDisabled(bool aDisabled)
}
}
NS_IMETHODIMP
HTMLLinkElement::SetMozDisabled(bool aDisabled)
{
SetDisabled(aDisabled);
return NS_OK;
}
NS_IMPL_STRING_ATTR(HTMLLinkElement, Charset, charset)
NS_IMPL_URI_ATTR(HTMLLinkElement, Href, href)
NS_IMPL_STRING_ATTR(HTMLLinkElement, Hreflang, hreflang)
NS_IMPL_STRING_ATTR(HTMLLinkElement, Media, media)
NS_IMPL_STRING_ATTR(HTMLLinkElement, Rel, rel)
NS_IMPL_STRING_ATTR(HTMLLinkElement, Rev, rev)
NS_IMPL_STRING_ATTR(HTMLLinkElement, Target, target)
NS_IMPL_STRING_ATTR(HTMLLinkElement, Type, type)
void
HTMLLinkElement::OnDNSPrefetchRequested()
{

View File

@ -10,6 +10,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/Link.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsStyleLinkElement.h"
namespace mozilla {
@ -18,6 +19,7 @@ class EventChainPreVisitor;
namespace dom {
class HTMLLinkElement final : public nsGenericHTMLElement,
public nsIDOMHTMLLinkElement,
public nsStyleLinkElement,
public Link
{
@ -31,6 +33,8 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLLinkElement,
nsGenericHTMLElement)
// nsIDOMHTMLLinkElement
NS_DECL_NSIDOMHTMLLINKELEMENT
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLinkElement, link);
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
@ -81,11 +85,7 @@ public:
// WebIDL
bool Disabled();
void SetDisabled(bool aDisabled);
void GetHref(nsAString& aValue)
{
GetURIAttr(nsGkAtoms::href, nullptr, aValue);
}
// XPCOM GetHref is fine.
void SetHref(const nsAString& aHref, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::href, aHref, aRv);
@ -101,28 +101,18 @@ public:
{
SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
}
// nsAString for WebBrowserPersistLocalDocument
void GetRel(nsAString& aValue)
{
GetHTMLAttr(nsGkAtoms::rel, aValue);
}
// XPCOM GetRel is fine.
void SetRel(const nsAString& aRel, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::rel, aRel, aRv);
}
nsDOMTokenList* RelList();
void GetMedia(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::media, aValue);
}
// XPCOM GetMedia is fine.
void SetMedia(const nsAString& aMedia, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::media, aMedia, aRv);
}
void GetHreflang(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::hreflang, aValue);
}
// XPCOM GetHreflang is fine.
void SetHreflang(const nsAString& aHreflang, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::hreflang, aHreflang, aRv);
@ -136,36 +126,22 @@ public:
{
return GetTokenList(nsGkAtoms::sizes);
}
void GetType(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::type, aValue);
}
// XPCOM GetType is fine.
void SetType(const nsAString& aType, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::type, aType, aRv);
}
// Requires nsresult return for nsStyleLinkElement override.
nsresult GetCharset(nsAString& aValue) override
{
GetHTMLAttr(nsGkAtoms::charset, aValue);
return NS_OK;
}
// XPCOM GetCharset is fine.
void SetCharset(const nsAString& aCharset, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::charset, aCharset, aRv);
}
void GetRev(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::rev, aValue);
}
// XPCOM GetRev is fine.
void SetRev(const nsAString& aRev, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::rev, aRev, aRv);
}
void GetTarget(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::target, aValue);
}
// XPCOM GetTarget is fine.
void SetTarget(const nsAString& aTarget, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::target, aTarget, aRv);

View File

@ -17,6 +17,7 @@ XPIDL_SOURCES += [
'nsIDOMHTMLHtmlElement.idl',
'nsIDOMHTMLImageElement.idl',
'nsIDOMHTMLInputElement.idl',
'nsIDOMHTMLLinkElement.idl',
'nsIDOMHTMLMediaElement.idl',
'nsIDOMHTMLMenuItemElement.idl',
'nsIDOMHTMLOptionElement.idl',

View File

@ -0,0 +1,32 @@
/* -*- 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 nsIDOMHTMLLinkElement interface is the interface to a [X]HTML
* link 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(ee50b7ab-0015-4fbe-89e0-e3feacd4ffde)]
interface nsIDOMHTMLLinkElement : nsISupports
{
[binaryname(MozDisabled)]
attribute boolean disabled;
attribute DOMString charset;
attribute DOMString href;
attribute DOMString hreflang;
attribute DOMString media;
attribute DOMString rel;
attribute DOMString rev;
attribute DOMString target;
attribute DOMString type;
};

View File

@ -9,7 +9,6 @@
#include "mozilla/dom/HTMLAnchorElement.h"
#include "mozilla/dom/HTMLAreaElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/dom/HTMLObjectElement.h"
#include "mozilla/dom/HTMLSharedElement.h"
#include "mozilla/dom/TabParent.h"
@ -28,6 +27,7 @@
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLScriptElement.h"
@ -534,11 +534,11 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
return OnWalkAttribute(aNode, "data");
}
if (auto nodeAsLink = dom::HTMLLinkElement::FromContent(content)) {
nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNode);
if (nodeAsLink) {
// Test if the link has a rel value indicating it to be a stylesheet
nsAutoString linkRel;
nodeAsLink->GetRel(linkRel);
if (!linkRel.IsEmpty()) {
if (NS_SUCCEEDED(nodeAsLink->GetRel(linkRel)) && !linkRel.IsEmpty()) {
nsReadingIterator<char16_t> start;
nsReadingIterator<char16_t> end;
nsReadingIterator<char16_t> current;
@ -1069,7 +1069,8 @@ PersistNodeFixup::FixupNode(nsIDOMNode *aNodeIn,
return rv;
}
if (content->IsHTMLElement(nsGkAtoms::link)) {
nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNodeIn);
if (nodeAsLink) {
rv = GetNodeToFixup(aNodeIn, aNodeOut);
if (NS_SUCCEEDED(rv) && *aNodeOut) {
// First see if the link represents linked content

View File

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

View File

@ -102,6 +102,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsILayoutHistoryState.h"
#include "nsFrameManager.h"
#include "mozilla/ReflowInput.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIContentViewerContainer.h"
#include "nsIContentViewer.h"

View File

@ -3053,7 +3053,7 @@ var NativeWindow = {
if (aElement.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
((ChromeUtils.getClassName(aElement) === "HTMLAnchorElement" && aElement.href) ||
(ChromeUtils.getClassName(aElement) === "HTMLAreaElement" && aElement.href) ||
ChromeUtils.getClassName(aElement) === "HTMLLinkElement" ||
aElement instanceof Ci.nsIDOMHTMLLinkElement ||
aElement.getAttributeNS(kXLinkNamespace, "type") == "simple")) {
try {
let url = this._getLinkURL(aElement);

View File

@ -54,6 +54,7 @@
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMHTMLMenuItemElement.h"
#include "nsIDOMHTMLOptionElement.h"
@ -161,6 +162,7 @@
#include "mozilla/dom/HTMLHtmlElementBinding.h"
#include "mozilla/dom/HTMLImageElementBinding.h"
#include "mozilla/dom/HTMLInputElementBinding.h"
#include "mozilla/dom/HTMLLinkElementBinding.h"
#include "mozilla/dom/HTMLMediaElementBinding.h"
#include "mozilla/dom/HTMLMenuItemElementBinding.h"
#include "mozilla/dom/HTMLObjectElementBinding.h"
@ -321,6 +323,7 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM(HTMLHtmlElement),
DEFINE_SHIM(HTMLImageElement),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM(HTMLLinkElement),
DEFINE_SHIM(HTMLMediaElement),
DEFINE_SHIM(HTMLMenuItemElement),
DEFINE_SHIM(HTMLOptionElement),