summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dom/html/HTMLLinkElement.cpp26
-rw-r--r--dom/html/HTMLLinkElement.h4
-rw-r--r--dom/html/HTMLStyleElement.cpp2
-rw-r--r--dom/html/HTMLStyleElement.h2
-rw-r--r--dom/webidl/HTMLLinkElement.webidl2
5 files changed, 24 insertions, 12 deletions
diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp
index b05b92d7aa..ed83836aac 100644
--- a/dom/html/HTMLLinkElement.cpp
+++ b/dom/html/HTMLLinkElement.cpp
@@ -93,8 +93,10 @@ NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLLinkElement)
bool
-HTMLLinkElement::Disabled()
+HTMLLinkElement::Disabled() const
{
+ return GetBoolAttr(nsGkAtoms::disabled);
+
StyleSheet* ss = GetSheet();
return ss && ss->Disabled();
}
@@ -107,8 +109,10 @@ HTMLLinkElement::GetMozDisabled(bool* aDisabled)
}
void
-HTMLLinkElement::SetDisabled(bool aDisabled)
+HTMLLinkElement::SetDisabled(bool aDisabled, ErrorResult& aRv)
{
+ return SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aRv);
+
if (StyleSheet* ss = GetSheet()) {
ss->SetDisabled(aDisabled);
}
@@ -117,8 +121,9 @@ HTMLLinkElement::SetDisabled(bool aDisabled)
NS_IMETHODIMP
HTMLLinkElement::SetMozDisabled(bool aDisabled)
{
- SetDisabled(aDisabled);
- return NS_OK;
+ ErrorResult rv;
+ SetDisabled(aDisabled, rv);
+ return rv.StealNSResult();
}
@@ -370,7 +375,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aName == nsGkAtoms::rel ||
aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
- aName == nsGkAtoms::type)) {
+ aName == nsGkAtoms::type ||
+ aName == nsGkAtoms::disabled)) {
bool dropSheet = false;
if (aName == nsGkAtoms::rel) {
nsAutoString value;
@@ -397,7 +403,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
dropSheet ||
(aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
- aName == nsGkAtoms::type));
+ aName == nsGkAtoms::type ||
+ aName == nsGkAtoms::disabled));
}
} else {
// Since removing href or rel makes us no longer link to a
@@ -407,7 +414,8 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aName == nsGkAtoms::rel ||
aName == nsGkAtoms::title ||
aName == nsGkAtoms::media ||
- aName == nsGkAtoms::type) {
+ aName == nsGkAtoms::type ||
+ aName == nsGkAtoms::disabled) {
UpdateStyleSheetInternal(nullptr, nullptr, true);
}
if (aName == nsGkAtoms::href ||
@@ -516,6 +524,10 @@ HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
return;
}
+ if (Disabled()) {
+ return;
+ }
+
nsAutoString title;
GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
title.CompressWhitespace();
diff --git a/dom/html/HTMLLinkElement.h b/dom/html/HTMLLinkElement.h
index acac955cb2..e024d42bbc 100644
--- a/dom/html/HTMLLinkElement.h
+++ b/dom/html/HTMLLinkElement.h
@@ -86,8 +86,8 @@ public:
virtual bool HasDeferredDNSPrefetchRequest() override;
// WebIDL
- bool Disabled();
- void SetDisabled(bool aDisabled);
+ bool Disabled() const;
+ void SetDisabled(bool aDisabled, ErrorResult& aRv);
// XPCOM GetHref is fine.
void SetHref(const nsAString& aHref, ErrorResult& aRv)
{
diff --git a/dom/html/HTMLStyleElement.cpp b/dom/html/HTMLStyleElement.cpp
index 743f4addb9..95cf025d10 100644
--- a/dom/html/HTMLStyleElement.cpp
+++ b/dom/html/HTMLStyleElement.cpp
@@ -66,7 +66,7 @@ HTMLStyleElement::GetMozDisabled(bool* aDisabled)
}
bool
-HTMLStyleElement::Disabled()
+HTMLStyleElement::Disabled() const
{
StyleSheet* ss = GetSheet();
return ss && ss->Disabled();
diff --git a/dom/html/HTMLStyleElement.h b/dom/html/HTMLStyleElement.h
index bd69a6aa1a..8b69c3f625 100644
--- a/dom/html/HTMLStyleElement.h
+++ b/dom/html/HTMLStyleElement.h
@@ -59,7 +59,7 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
- bool Disabled();
+ bool Disabled() const;
void SetDisabled(bool aDisabled);
void SetMedia(const nsAString& aMedia, ErrorResult& aError)
{
diff --git a/dom/webidl/HTMLLinkElement.webidl b/dom/webidl/HTMLLinkElement.webidl
index eb83deab1a..4fa40d04d0 100644
--- a/dom/webidl/HTMLLinkElement.webidl
+++ b/dom/webidl/HTMLLinkElement.webidl
@@ -14,7 +14,7 @@
// http://www.whatwg.org/specs/web-apps/current-work/#the-link-element
[HTMLConstructor]
interface HTMLLinkElement : HTMLElement {
- [Pure]
+ [CEReactions, SetterThrows, Pure]
attribute boolean disabled;
[CEReactions, SetterThrows, Pure]
attribute DOMString href;