From df81141dd1220413864bc8e2d7e4ef94de74f7e1 Mon Sep 17 00:00:00 2001 From: David Bolter Date: Wed, 13 Oct 2010 11:46:34 -0400 Subject: [PATCH] Bug 601205 - Expose intrinsic invalid state to accessibility API; r=marcoz,surkov a=davidb --- accessible/src/base/nsAccessible.cpp | 3 +++ .../tests/mochitest/states/test_inputs.html | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index abaceb19667..c418943312f 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -688,6 +688,9 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState) PRInt32 intrinsicState = mContent->IntrinsicState(); + if (intrinsicState & NS_EVENT_STATE_INVALID) + *aState |= nsIAccessibleStates::STATE_INVALID; + if (intrinsicState & NS_EVENT_STATE_REQUIRED) *aState |= nsIAccessibleStates::STATE_REQUIRED; diff --git a/accessible/tests/mochitest/states/test_inputs.html b/accessible/tests/mochitest/states/test_inputs.html index 92f91a723ef..9f653500ea7 100644 --- a/accessible/tests/mochitest/states/test_inputs.html +++ b/accessible/tests/mochitest/states/test_inputs.html @@ -46,6 +46,14 @@ testStates(invalid[i] + "2", 0, 0, STATE_INVALID); } + // invalid/valid state + var invalid = ["maxlength","pattern","email","url"]; + document.getElementById("maxlength").value = "i am too long"; + for (i in invalid) { + testStates(invalid[i], STATE_INVALID); + testStates(invalid[i] + "2", 0, 0, STATE_INVALID); + } + SimpleTest.finish(); } @@ -75,6 +83,11 @@ title="Expose intrinsic invalid state to accessibility API"> Mozilla Bug 601205 + + Mozilla Bug 601205 +

@@ -121,5 +134,15 @@
   
   
 
+  
+  
+  
+  
+  
+  
+  
+  
+  
+