diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index fcd413e5b6ad..4f0c6c2c1cdb 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2687,7 +2687,6 @@ nsGenericHTMLFormElement::CanBeDisabled() const // It's easier to test the types that _cannot_ be disabled return type != NS_FORM_LABEL && - type != NS_FORM_FIELDSET && type != NS_FORM_OBJECT && type != NS_FORM_OUTPUT; } diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp index 76e22814f4a9..64dbc6072fd4 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -42,6 +42,7 @@ #include "nsIForm.h" #include "nsIFormControl.h" #include "nsIConstraintValidation.h" +#include "nsEventDispatcher.h" class nsHTMLFieldSetElement : public nsGenericHTMLFormElement, @@ -69,6 +70,9 @@ public: // nsIDOMHTMLFieldSetElement NS_DECL_NSIDOMHTMLFIELDSETELEMENT + // nsIContent + virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor); + // nsIFormControl NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_FIELDSET; } NS_IMETHOD Reset(); @@ -134,11 +138,25 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFieldSetElement) NS_IMPL_ELEMENT_CLONE(nsHTMLFieldSetElement) +NS_IMPL_BOOL_ATTR(nsHTMLFieldSetElement, Disabled, disabled) NS_IMPL_STRING_ATTR(nsHTMLFieldSetElement, Name, name) // nsIConstraintValidation NS_IMPL_NSICONSTRAINTVALIDATION(nsHTMLFieldSetElement) +// nsIContent +nsresult +nsHTMLFieldSetElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) +{ + // Do not process any DOM events if the element is disabled. + aVisitor.mCanHandle = PR_FALSE; + if (HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) { + return NS_OK; + } + + return nsGenericHTMLFormElement::PreHandleEvent(aVisitor); +} + // nsIDOMHTMLFieldSetElement NS_IMETHODIMP diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index a883391d81b5..a78e8ef75313 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -229,6 +229,7 @@ _TEST_FILES = \ test_bug595447.html \ test_bug595449.html \ test_bug595457.html \ + test_bug557087-1.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/html/content/test/test_bug557087-1.html b/content/html/content/test/test_bug557087-1.html new file mode 100644 index 000000000000..1924d26516df --- /dev/null +++ b/content/html/content/test/test_bug557087-1.html @@ -0,0 +1,127 @@ + + + + + Test for Bug 557087 + + + + + + +Mozilla Bug 557087 +

+
+
+
+
+
+ + diff --git a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl index efc238ee89bf..a62ec13ca1a1 100644 --- a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl @@ -49,9 +49,10 @@ interface nsIDOMValidityState; -[scriptable, uuid(b38efb33-ec68-487a-bf9b-2920425fa408)] +[scriptable, uuid(58db2166-36fc-482c-a9f8-84ad262537b2)] interface nsIDOMHTMLFieldSetElement : nsIDOMHTMLElement { + attribute boolean disabled; readonly attribute nsIDOMHTMLFormElement form; attribute DOMString name; diff --git a/layout/reftests/bugs/84400-2-ref.html b/layout/reftests/bugs/84400-2-ref.html index 77416607250f..08dc50234766 100644 --- a/layout/reftests/bugs/84400-2-ref.html +++ b/layout/reftests/bugs/84400-2-ref.html @@ -30,13 +30,6 @@ FAIL -
- fieldset: -
bogus
FAIL -
bogus
FAIL -
bogus
FAIL -
-
legend:
FAIL
diff --git a/layout/reftests/bugs/84400-2.html b/layout/reftests/bugs/84400-2.html index fb1757edd7f9..03eb67092f02 100644 --- a/layout/reftests/bugs/84400-2.html +++ b/layout/reftests/bugs/84400-2.html @@ -33,13 +33,6 @@ FAIL
-
- fieldset: -
bogus
FAIL -
bogus
FAIL -
bogus
FAIL -
-
legend:
FAIL
diff --git a/layout/reftests/css-disabled/fieldset/fieldset-disabled.html b/layout/reftests/css-disabled/fieldset/fieldset-disabled.html new file mode 100644 index 000000000000..6cd4fbfead3f --- /dev/null +++ b/layout/reftests/css-disabled/fieldset/fieldset-disabled.html @@ -0,0 +1,7 @@ + + + + +
+ + diff --git a/layout/reftests/css-disabled/fieldset/fieldset-enabled.html b/layout/reftests/css-disabled/fieldset/fieldset-enabled.html new file mode 100644 index 000000000000..32915278e439 --- /dev/null +++ b/layout/reftests/css-disabled/fieldset/fieldset-enabled.html @@ -0,0 +1,7 @@ + + + + +
+ + diff --git a/layout/reftests/css-disabled/fieldset/fieldset-ref.html b/layout/reftests/css-disabled/fieldset/fieldset-ref.html new file mode 100644 index 000000000000..7f66bc698f9d --- /dev/null +++ b/layout/reftests/css-disabled/fieldset/fieldset-ref.html @@ -0,0 +1,7 @@ + + + + +
+ + diff --git a/layout/reftests/css-disabled/fieldset/reftest.list b/layout/reftests/css-disabled/fieldset/reftest.list new file mode 100644 index 000000000000..1573cd56e6ad --- /dev/null +++ b/layout/reftests/css-disabled/fieldset/reftest.list @@ -0,0 +1,2 @@ +== fieldset-enabled.html fieldset-ref.html +== fieldset-disabled.html fieldset-ref.html diff --git a/layout/reftests/css-disabled/fieldset/style.css b/layout/reftests/css-disabled/fieldset/style.css new file mode 100644 index 000000000000..1678a3a5e948 --- /dev/null +++ b/layout/reftests/css-disabled/fieldset/style.css @@ -0,0 +1,16 @@ +fieldset.disabled { + background-color: red; +} + +fieldset:disabled.disabled, +fieldset.ref { + background-color: green; +} + +fieldset.enabled { + background-color: green; +} + +fieldset:disabled.enabled { + background-color: red; +} diff --git a/layout/reftests/css-disabled/reftest.list b/layout/reftests/css-disabled/reftest.list new file mode 100644 index 000000000000..edc86789f7af --- /dev/null +++ b/layout/reftests/css-disabled/reftest.list @@ -0,0 +1 @@ +include fieldset/reftest.list diff --git a/layout/reftests/css-enabled/fieldset/fieldset-disabled.html b/layout/reftests/css-enabled/fieldset/fieldset-disabled.html new file mode 100644 index 000000000000..6cd4fbfead3f --- /dev/null +++ b/layout/reftests/css-enabled/fieldset/fieldset-disabled.html @@ -0,0 +1,7 @@ + + + + +
+ + diff --git a/layout/reftests/css-enabled/fieldset/fieldset-enabled.html b/layout/reftests/css-enabled/fieldset/fieldset-enabled.html new file mode 100644 index 000000000000..32915278e439 --- /dev/null +++ b/layout/reftests/css-enabled/fieldset/fieldset-enabled.html @@ -0,0 +1,7 @@ + + + + +
+ + diff --git a/layout/reftests/css-enabled/fieldset/fieldset-ref.html b/layout/reftests/css-enabled/fieldset/fieldset-ref.html new file mode 100644 index 000000000000..7f66bc698f9d --- /dev/null +++ b/layout/reftests/css-enabled/fieldset/fieldset-ref.html @@ -0,0 +1,7 @@ + + + + +
+ + diff --git a/layout/reftests/css-enabled/fieldset/reftest.list b/layout/reftests/css-enabled/fieldset/reftest.list new file mode 100644 index 000000000000..1573cd56e6ad --- /dev/null +++ b/layout/reftests/css-enabled/fieldset/reftest.list @@ -0,0 +1,2 @@ +== fieldset-enabled.html fieldset-ref.html +== fieldset-disabled.html fieldset-ref.html diff --git a/layout/reftests/css-enabled/fieldset/style.css b/layout/reftests/css-enabled/fieldset/style.css new file mode 100644 index 000000000000..7b804aa6f166 --- /dev/null +++ b/layout/reftests/css-enabled/fieldset/style.css @@ -0,0 +1,16 @@ +fieldset.enabled { + background-color: red; +} + +fieldset:enabled.enabled, +fieldset.ref { + background-color: green; +} + +fieldset.disabled { + background-color: green; +} + +fieldset:enabled.disabled { + background-color: red; +} diff --git a/layout/reftests/css-enabled/reftest.list b/layout/reftests/css-enabled/reftest.list new file mode 100644 index 000000000000..edc86789f7af --- /dev/null +++ b/layout/reftests/css-enabled/reftest.list @@ -0,0 +1 @@ +include fieldset/reftest.list diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list index 670bacbb1b02..78486a05ffe1 100644 --- a/layout/reftests/reftest.list +++ b/layout/reftests/reftest.list @@ -50,6 +50,12 @@ include css-charset/reftest.list # css default pseudo class tests include css-default/reftest.list +# css :disable tests +include css-disabled/reftest.list + +# css :enable tests +include css-enabled/reftest.list + # css @import tests include css-import/reftest.list