Bug 924896 - exposing the text input type in the accessible's attributes. r=surkov

---
 accessible/src/html/HTMLFormControlAccessible.cpp   | 15 +++++++++++++++
 accessible/src/html/HTMLFormControlAccessible.h     |  1 +
 accessible/tests/mochitest/attributes/test_obj.html | 16 ++++++++++++++++
 content/base/src/nsGkAtomList.h                     |  1 +
 4 files changed, 33 insertions(+)
This commit is contained in:
Yura Zenevich 2013-10-24 23:21:24 -04:00
parent 2744117b84
commit 45529b8d0b
4 changed files with 33 additions and 0 deletions

View File

@ -306,6 +306,21 @@ HTMLTextFieldAccessible::NativeRole()
return roles::ENTRY;
}
already_AddRefed<nsIPersistentProperties>
HTMLTextFieldAccessible::NativeAttributes()
{
nsCOMPtr<nsIPersistentProperties> attributes =
HyperTextAccessibleWrap::NativeAttributes();
// Expose type for text input elements as it gives some useful context,
// especially for mobile.
nsAutoString type;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type))
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType, type);
return attributes.forget();
}
ENameValueFlag
HTMLTextFieldAccessible::NativeName(nsString& aName)
{

View File

@ -131,6 +131,7 @@ public:
virtual void ApplyARIAState(uint64_t* aState) const;
virtual mozilla::a11y::role NativeRole();
virtual uint64_t NativeState();
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
// ActionAccessible
virtual uint8_t ActionCount();

View File

@ -97,6 +97,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
testAttrs("liveGroup", {"container-live-role" : "group"}, true);
testAttrs("liveGroupChild", {"container-live-role" : "group"}, true);
// text input type
testAbsentAttrs("button", { "text-input-type": "button"});
testAbsentAttrs("checkbox", { "text-input-type": "checkbox"});
testAbsentAttrs("radio", { "text-input-type": "radio"});
testAttrs("email", {"text-input-type" : "email"}, true);
testAttrs("search", {"text-input-type" : "search"}, true);
testAttrs("tel", {"text-input-type" : "tel"}, true);
testAttrs("url", {"text-input-type" : "url"}, true);
// html
testAttrs("radio", {"checkable" : "true"}, true);
testAttrs("checkbox", {"checkable" : "true"}, true);
@ -223,6 +232,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
excuse <div id="liveGroupChild">me</div>
</div>
<!-- text input type -->
<input id="button" type="button"/>
<input id="email" type="email"/>
<input id="search" type="search"/>
<input id="tel" type="tel"/>
<input id="url" type="url"/>
<!-- html -->
<input id="radio" type="radio"/>
<input id="checkbox" type="checkbox"/>

View File

@ -2181,6 +2181,7 @@ GK_ATOM(tableCellIndex, "table-cell-index")
GK_ATOM(tablist, "tablist")
GK_ATOM(textAlign, "text-align")
GK_ATOM(textIndent, "text-indent")
GK_ATOM(textInputType, "text-input-type")
GK_ATOM(textLineThroughColor, "text-line-through-color")
GK_ATOM(textLineThroughStyle, "text-line-through-style")
GK_ATOM(textPosition, "text-position")