Bug 681674 - aria-autocomplete not supported on standard form text input controls. r=tbsaunde,MarcoZ
authorDavid Bolter <dbolter@mozilla.com>
Thu, 01 Sep 2011 11:37:24 -0400
changeset 76383 7a50f9697fb2676af48bbf7d09fb8f39a0c2b024
parent 76382 6faef8a5901ccfee72d05bb7345d154ef83589aa
child 76384 bcc474c726aa89f2278ffebb1e65e80bc9d71468
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewerstbsaunde, MarcoZ
bugs681674
milestone9.0a1
Bug 681674 - aria-autocomplete not supported on standard form text input controls. r=tbsaunde,MarcoZ
accessible/src/html/nsHTMLFormControlAccessible.cpp
accessible/src/html/nsHTMLFormControlAccessible.h
accessible/tests/mochitest/states/test_aria.html
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -441,16 +441,25 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible:
   nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mContent));
   if (inputElement) {
     return inputElement->GetValue(_retval);
   }
 
   return NS_ERROR_FAILURE;
 }
 
+void
+nsHTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState)
+{
+  nsHyperTextAccessibleWrap::ApplyARIAState(aState);
+
+  nsStateMapEntry::MapToStates(mContent, aState, eARIAAutoComplete);
+
+}
+
 PRUint64
 nsHTMLTextFieldAccessible::NativeState()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
 
   // can be focusable, focused, protected. readonly, unavailable, selected
   if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                             nsAccessibilityAtoms::password, eIgnoreCase)) {
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/nsHTMLFormControlAccessible.h
@@ -154,16 +154,17 @@ public:
   NS_IMETHOD GetValue(nsAString& _retval); 
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleEditableText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsAccessible
+  virtual void ApplyARIAState(PRUint64* aState);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual PRUint32 NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
--- a/accessible/tests/mochitest/states/test_aria.html
+++ b/accessible/tests/mochitest/states/test_aria.html
@@ -62,16 +62,19 @@
       // aria_autocomplete
       testStates("textbox_autocomplete_inline", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
       testStates("textbox_autocomplete_list", STATE_HASPOPUP, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
       testStates("textbox_autocomplete_both", STATE_HASPOPUP, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
       testStates("combobox_autocomplete_inline", STATE_HASPOPUP, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
       testStates("combobox_autocomplete_list", STATE_HASPOPUP, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
       testStates("combobox_autocomplete_both", STATE_HASPOPUP, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
 
+      testStates("htmltext_autocomplete_list", STATE_HASPOPUP, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
+      testStates("htmltextarea_autocomplete_list", STATE_HASPOPUP, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
+
       // aria-busy
       testStates("textbox_busy_false", 0, 0, STATE_BUSY);
       testStates("textbox_busy_true", STATE_BUSY);
       testStates("textbox_busy_error", STATE_INVALID);
 
       // aria-expanded
       testStates("combobox", STATE_COLLAPSED);
       testStates("combobox_expanded", STATE_EXPANDED);
@@ -147,28 +150,36 @@
      title="Propagate aria-disabled to descendants">
     Mozilla Bug 429285
   </a>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=499653"
      title="Unify ARIA state attributes mapping rules">
     Mozilla Bug 499653
   </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=681674"
+     title="aria-autocomplete not supported on standard form text input controls">
+    Mozilla Bug 681674
+  </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <div id="textbox_autocomplete_inline" role="textbox" aria-autocomplete="inline"></div>
   <div id="textbox_autocomplete_list" role="textbox" aria-autocomplete="list"></div>
   <div id="textbox_autocomplete_both" role="textbox" aria-autocomplete="both"></div>
   <div id="combobox_autocomplete_inline" role="combobox" aria-autocomplete="inline"></div>
   <div id="combobox_autocomplete_list" role="combobox" aria-autocomplete="list"></div>
   <div id="combobox_autocomplete_both" role="combobox" aria-autocomplete="both"></div>
 
+  <input id="htmltext_autocomplete_list" type="text" aria-autocomplete="list" />
+  <textarea id="htmltextarea_autocomplete_list" aria-autocomplete="list"></textarea>
+
   <div id="textbox_busy_false" role="textbox" aria-busy="false"></div>
   <div id="textbox_busy_true" role="textbox" aria-busy="true"></div>
   <div id="textbox_busy_error" role="textbox" aria-busy="error"></div>
 
   <div id="combobox" role="combobox">combobox</div>
   <div id="combobox_expanded" role="combobox"
        aria-expanded="true">combobox</div>