From e210a8ca25f7af750178a839b14e459f4fa0f974 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Sat, 10 Mar 2012 11:57:19 +0100 Subject: [PATCH] Bug 729845 - Disabled attribute shouldn't apply to all HTML elements. r=bz --- .../html/content/src/nsGenericHTMLElement.h | 2 +- .../content/src/nsHTMLOptGroupElement.cpp | 4 +++ .../html/content/src/nsHTMLOptionElement.h | 4 +++ content/html/content/test/test_bug430351.html | 33 ++++++++++++++++--- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 6c7bb6d26b1..a4c47c3651f 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -530,7 +530,7 @@ public: * Returns the current disabled state of the element. */ virtual bool IsDisabled() const { - return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled); + return false; } bool IsHidden() const diff --git a/content/html/content/src/nsHTMLOptGroupElement.cpp b/content/html/content/src/nsHTMLOptGroupElement.cpp index 49507f47380..a97680dec5b 100644 --- a/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -85,6 +85,10 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; virtual nsXPCClassInfo* GetClassInfo(); + + virtual bool IsDisabled() const { + return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled); + } protected: /** diff --git a/content/html/content/src/nsHTMLOptionElement.h b/content/html/content/src/nsHTMLOptionElement.h index 67856a5a3a4..49021e08d9d 100644 --- a/content/html/content/src/nsHTMLOptionElement.h +++ b/content/html/content/src/nsHTMLOptionElement.h @@ -104,6 +104,10 @@ public: nsresult CopyInnerTo(nsGenericElement* aDest) const; virtual nsXPCClassInfo* GetClassInfo(); + + virtual bool IsDisabled() const { + return HasAttr(kNameSpaceID_None, nsGkAtoms::disabled); + } protected: /** * Get the select content element that contains this option, this diff --git a/content/html/content/test/test_bug430351.html b/content/html/content/test/test_bug430351.html index d1e7caff673..04587c9710c 100644 --- a/content/html/content/test/test_bug430351.html +++ b/content/html/content/test/test_bug430351.html @@ -61,6 +61,7 @@ var focusableElements = [ "
", "
", "
", + "
", "", "", @@ -165,7 +166,17 @@ var focusableElements = [ "", "", "", - "" + "", + + "", + "", + "", + "", + + "", + "", + "", + "" ]; var nonFocusableElements = [ @@ -182,7 +193,6 @@ var nonFocusableElements = [ "", "
", - "
", "
", "", @@ -243,7 +253,13 @@ var nonFocusableElements = [ "", "", - "" + "", + + "", + "", + + "", + "" ]; var focusableInContentEditable = [ @@ -268,6 +284,7 @@ var focusableInContentEditable = [ "
", "
", "
", + "
", "", "", @@ -365,7 +382,15 @@ var focusableInContentEditable = [ "", "", "", - "" + "", + + "", + "", + "", + + "", + "", + "" ]; var focusableInDesignMode = [