Bug 529289 - Implemented "scrollbar" and aria-orientation mappings. r=MarcoZ,surkov

This commit is contained in:
David Bolter 2009-12-15 11:03:39 -05:00
Родитель 916933be9c
Коммит 586b454838
8 изменённых файлов: 88 добавлений и 3 удалений

Просмотреть файл

@ -408,6 +408,17 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
eARIASelectable,
eARIAReadonly
},
{
"scrollbar",
nsIAccessibleRole::ROLE_SCROLLBAR,
kUseMapRole,
eHasValueMinMax,
eNoAction,
eNoLiveAttr,
kNoReqStates,
eARIAOrientation,
eARIAReadonly
},
{
"separator",
nsIAccessibleRole::ROLE_SEPARATOR,
@ -628,6 +639,11 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
nsStateMapEntry(&nsAccessibilityAtoms::aria_multiselectable, kBoolType, 0,
nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE, 0),
// eARIAOrientation
nsStateMapEntry(&nsAccessibilityAtoms::aria_orientation, eUseFirstState,
"vertical", 0, nsIAccessibleStates::EXT_STATE_VERTICAL,
"horizontal", 0, nsIAccessibleStates::EXT_STATE_HORIZONTAL),
// eARIAPressed
nsStateMapEntry(&nsAccessibilityAtoms::aria_pressed, kMixedType,
nsIAccessibleStates::STATE_CHECKABLE,
@ -693,6 +709,7 @@ nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = {
{&nsAccessibilityAtoms::aria_multiline, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
{&nsAccessibilityAtoms::aria_multiselectable, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
{&nsAccessibilityAtoms::aria_owns, ATTR_BYPASSOBJ },
{&nsAccessibilityAtoms::aria_orientation, ATTR_VALTOKEN },
{&nsAccessibilityAtoms::aria_pressed, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
{&nsAccessibilityAtoms::aria_readonly, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
{&nsAccessibilityAtoms::aria_relevant, ATTR_BYPASSOBJ },
@ -749,6 +766,26 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName,
{
}
nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName,
EDefaultStateRule aDefaultStateRule,
const char *aValue1,
PRUint32 aState1, PRUint32 aExtraState1,
const char *aValue2,
PRUint32 aState2, PRUint32 aExtraState2,
const char *aValue3,
PRUint32 aState3, PRUint32 aExtraState3) :
attributeName(aAttrName), isToken(PR_TRUE), permanentState(0),
value1(aValue1), state1(aState1), extraState1(aExtraState1),
value2(aValue2), state2(aState2), extraState2(aExtraState2),
value3(aValue3), state3(aState3), extraState3(aExtraState3),
defaultState(0), defaultExtraState(0), definedIfAbsent(PR_TRUE)
{
if (aDefaultStateRule == eUseFirstState) {
defaultState = aState1;
defaultExtraState = aExtraState1;
}
}
PRBool
nsStateMapEntry::MapToStates(nsIContent *aContent,
PRUint32 *aState, PRUint32 *aExtraState,

Просмотреть файл

@ -157,6 +157,12 @@ enum eStateValueType
kMixedType
};
enum EDefaultStateRule
{
//eNoDefaultState,
eUseFirstState
};
/**
* ID for state map entry, used in nsRoleMapEntry.
*/
@ -174,6 +180,7 @@ enum eStateMapEntryID
eARIAInvalid,
eARIAMultiline,
eARIAMultiSelectable,
eARIAOrientation,
eARIAPressed,
eARIAReadonly,
eARIAReadonlyOrEditable,
@ -207,6 +214,17 @@ public:
const char *aValue3 = 0, PRUint32 aState3 = 0,
PRUint32 aExtraState3 = 0);
/**
* Used for ARIA attributes having enumerated values, and where a default
* attribute state should be assumed when not supplied by the author.
*/
nsStateMapEntry(nsIAtom **aAttrName,
EDefaultStateRule aDefaultStateRule,
const char *aValue1, PRUint32 aState1, PRUint32 aExtraState1,
const char *aValue2, PRUint32 aState2, PRUint32 aExtraState2,
const char *aValue3 = 0, PRUint32 aState3 = 0,
PRUint32 aExtraState3 = 0);
/**
* Maps ARIA state map pointed by state map entry ID to accessible states.
*

Просмотреть файл

@ -241,6 +241,7 @@ ACCESSIBILITY_ATOM(aria_level, "aria-level")
ACCESSIBILITY_ATOM(aria_live, "aria-live")
ACCESSIBILITY_ATOM(aria_multiline, "aria-multiline")
ACCESSIBILITY_ATOM(aria_multiselectable, "aria-multiselectable")
ACCESSIBILITY_ATOM(aria_orientation, "aria-orientation")
ACCESSIBILITY_ATOM(aria_owns, "aria-owns")
ACCESSIBILITY_ATOM(aria_posinset, "aria-posinset")
ACCESSIBILITY_ATOM(aria_pressed, "aria-pressed")

Просмотреть файл

@ -79,6 +79,7 @@ const EXT_STATE_MULTI_LINE = nsIAccessibleStates.EXT_STATE_MULTI_LINE;
const EXT_STATE_SINGLE_LINE = nsIAccessibleStates.EXT_STATE_SINGLE_LINE;
const EXT_STATE_SUPPORTS_AUTOCOMPLETION =
nsIAccessibleStates.EXT_STATE_SUPPORTS_AUTOCOMPLETION;
const EXT_STATE_VERTICAL = nsIAccessibleStates.EXT_STATE_VERTICAL;
////////////////////////////////////////////////////////////////////////////////
// OS detect

Просмотреть файл

@ -44,6 +44,7 @@ const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON;
const ROLE_RADIOBUTTON = nsIAccessibleRole.ROLE_RADIOBUTTON;
const ROLE_ROW = nsIAccessibleRole.ROLE_ROW;
const ROLE_ROWHEADER = nsIAccessibleRole.ROLE_ROWHEADER;
const ROLE_SCROLLBAR = nsIAccessibleRole.ROLE_SCROLLBAR;
const ROLE_SECTION = nsIAccessibleRole.ROLE_SECTION;
const ROLE_SEPARATOR = nsIAccessibleRole.ROLE_SEPARATOR;
const ROLE_SLIDER = nsIAccessibleRole.ROLE_SLIDER;

Просмотреть файл

@ -3,6 +3,7 @@
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=481114
https://bugzilla.mozilla.org/show_bug.cgi?id=469688
https://bugzilla.mozilla.org/show_bug.cgi?id=529289
-->
<head>
<title>Test weak ARIA roles</title>
@ -63,6 +64,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469688
for (a in abstract_roles)
testRole(abstract_roles[a], ROLE_SECTION);
// aria scrollbar
testRole("scrollbar", ROLE_SCROLLBAR);
SimpleTest.finish();
}
@ -74,6 +77,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469688
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=481114">Mozilla Bug 481114</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 469688</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 529289</a>
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -134,5 +139,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469688
<div role="section" id="section">section</div>
<div role="sectionhead" id="sectionhead">sectionhead</div>
<!-- aria scrollbar -->
<div role="scrollbar" id="scrollbar">scrollbar</div>
</body>
</html>

Просмотреть файл

@ -66,6 +66,7 @@
testValue("slider_vn", "5", 5, 0, 1000, 0);
testValue("slider_vnvt", "plain", 0, 0, 5, 0);
testValue("slider_vt", "hi", 0, 0, 3, 0);
testValue("scrollbar", "5", 5, 0, 1000, 0);
// Test value change events
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
@ -73,6 +74,7 @@
gQueue.push(new changeValue("slider_vn", "6", undefined));
gQueue.push(new changeValue("slider_vt", undefined, "hey!"));
gQueue.push(new changeValue("slider_vnvt", "3", "sweet"));
gQueue.push(new changeValue("scrollbar", "6", undefined));
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -89,6 +91,11 @@
title=" Fire delayed value changed event for aria-valuetext changes">
Mozilla Bug 478032
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289"
title="We dont expose new aria role 'scrollbar' and property aria-orientation">
Mozilla Bug 529289
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -98,12 +105,16 @@
<!-- ARIA sliders -->
<div id="slider_vn" role="slider" aria-valuenow="5"
aria-valuemin="0" aria-valuemax="1000">slider</div>
aria-valuemin="0" aria-valuemax="1000">slider</div>
<div id="slider_vt" role="slider" aria-valuetext="hi"
aria-valuemin="0" aria-valuemax="3">greeting slider</div>
aria-valuemin="0" aria-valuemax="3">greeting slider</div>
<div id="slider_vnvt" role="slider" aria-valuenow="0" aria-valuetext="plain"
aria-valuemin="0" aria-valuemax="5">sweetness slider</div>
aria-valuemin="0" aria-valuemax="5">sweetness slider</div>
<!-- ARIA scrollbar -->
<div id="scrollbar" role="scrollbar" aria-valuenow="5"
aria-valuemin="0" aria-valuemax="1000">slider</div>
</body>
</html>

Просмотреть файл

@ -93,6 +93,11 @@
testStates("aria_main_anchor", STATE_SELECTABLE);
testStates("aria_navigation_anchor", STATE_SELECTABLE);
// scrollbar
testStates("aria_scrollbar", 0, EXT_STATE_VERTICAL);
testStates("aria_hscrollbar", 0, EXT_STATE_HORIZONTAL);
testStates("aria_vscrollbar", 0, EXT_STATE_VERTICAL);
SimpleTest.finish();
}
@ -183,5 +188,9 @@
<a id="aria_main_anchor" role="main" name="main_anchor">main</a>
<a id="aria_navigation_anchor" role="navigation" name="nav_anchor">nav</a>
<!-- scrollbar -->
<div id="aria_scrollbar" role="scrollbar">scrollbar</a>
<div id="aria_hscrollbar" role="scrollbar" aria-orientation="horizontal">horizontal scrollbar</a>
<div id="aria_vscrollbar" role="scrollbar" aria-orientation="vertical">vertical scrollbar</a>
</body>
</html>