diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index b625a455b1e8..85874e23800c 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -1243,12 +1243,17 @@ void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument, nsIContent* aContent2, nsEventStates aStateMask) { - if (!aStateMask.HasState(NS_EVENT_STATE_CHECKED)) { - return; + if (aStateMask.HasState(NS_EVENT_STATE_CHECKED)) { + nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent1); + nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2); } - nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent1); - nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2); + if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) { + nsRefPtr event = + new AccStateChangeEvent(aContent1, nsIAccessibleStates::STATE_INVALID, + PR_FALSE, PR_TRUE); + FireDelayedAccessibleEvent(event); + } } void nsDocAccessible::DocumentStatesChanged(nsIDocument* aDocument, diff --git a/accessible/tests/mochitest/events/test_statechange.html b/accessible/tests/mochitest/events/test_statechange.html index fe8ca3126480..c03721283e48 100644 --- a/accessible/tests/mochitest/events/test_statechange.html +++ b/accessible/tests/mochitest/events/test_statechange.html @@ -26,10 +26,6 @@ { this.DOMNode = aDocNode; - this.eventSeq = [ - new invokerChecker(EVENT_STATE_CHANGE, getAccessible(this.DOMNode)) - ]; - this.invoke = function editabledoc_invoke() { // Note: this should fire an EVENT_STATE_CHANGE this.DOMNode.designMode = 'on'; @@ -58,6 +54,24 @@ }; } + function invalidInput(aNodeOrID) + { + this.DOMNode = getNode(aNodeOrID); + + this.invoke = function invalidInput_invoke() { + // Note: this should fire an EVENT_STATE_CHANGE + this.DOMNode.value = "I am too long"; + }; + + this.check = function invalidInput_check() { + testStates(aNodeOrID, STATE_INVALID); + }; + + this.getID = function invalidInput_getID() { + return prettyName(aNodeOrID) + " became invalid"; + }; + } + //////////////////////////////////////////////////////////////////////////// // Do tests @@ -67,12 +81,15 @@ function doTests() { - gQueue = new eventQueue(); + gQueue = new eventQueue(nsIAccessibleEvent.EVENT_STATE_CHANGE); // Test delayed editable state change var doc = document.getElementById("iframe").contentDocument; gQueue.push(new makeEditableDoc(doc)); + // invalid state change + gQueue.push(new invalidInput("maxlength")); + gQueue.invoke(); // Will call SimpleTest.finish(); } @@ -87,6 +104,11 @@ href="https://bugzilla.mozilla.org/show_bug.cgi?id=564471" title="Make state change events async"> Mozilla Bug 564471 +
+ + Mozilla Bug 555728

@@ -97,6 +119,9 @@
+ + +