mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Bug 494346 - STATE_FOCUSABLE not exposed on focusable video sliders, r=davidb, r=MarcoZ
--HG-- rename : accessible/tests/mochitest/nsIAccessible_states.js => accessible/tests/mochitest/states.js
This commit is contained in:
parent
a7e50b266d
commit
8616b0f81e
@ -55,7 +55,7 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXULSliderAccessible,
|
||||
nsAccessibleWrap,
|
||||
nsIAccessibleValue)
|
||||
|
||||
// nsIAccessible
|
||||
// nsAccessible
|
||||
|
||||
nsresult
|
||||
nsXULSliderAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
@ -64,12 +64,68 @@ nsXULSliderAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULSliderAccessible::GetStateInternal(PRUint32 *aState,
|
||||
PRUint32 *aExtraState)
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> sliderContent(GetSliderNode());
|
||||
NS_ENSURE_STATE(sliderContent);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
|
||||
NS_ENSURE_STATE(shell);
|
||||
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(sliderContent);
|
||||
if (frame && frame->IsFocusable())
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
|
||||
if (gLastFocusedNode == mDOMNode)
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIAccessible
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULSliderAccessible::GetValue(nsAString& aValue)
|
||||
{
|
||||
return GetSliderAttr(nsAccessibilityAtoms::curpos, aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULSliderAccessible::GetNumActions(PRUint8 *aCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
|
||||
*aCount = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULSliderAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
{
|
||||
aName.Truncate();
|
||||
|
||||
NS_ENSURE_ARG(aIndex == 0);
|
||||
|
||||
aName.AssignLiteral("activate");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULSliderAccessible::DoAction(PRUint8 aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG(aIndex == 0);
|
||||
|
||||
nsCOMPtr<nsIContent> sliderContent(GetSliderNode());
|
||||
NS_ENSURE_STATE(sliderContent);
|
||||
|
||||
return DoCommand(sliderContent);
|
||||
}
|
||||
|
||||
// nsIAccessibleValue
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -132,6 +188,17 @@ nsXULSliderAccessible::SetCurrentValue(double aValue)
|
||||
return SetSliderAttr(nsAccessibilityAtoms::curpos, aValue);
|
||||
}
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHODIMP
|
||||
nsXULSliderAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
|
||||
|
||||
// Do not allow anonymous xul:slider be accessible.
|
||||
*aAllowsAnonChildren = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Utils
|
||||
|
||||
already_AddRefed<nsIContent>
|
||||
|
@ -53,12 +53,19 @@ public:
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetValue(nsAString& aValue);
|
||||
NS_IMETHOD GetNumActions(PRUint8 *aCount);
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
|
||||
NS_IMETHOD DoAction(PRUint8 aIndex);
|
||||
|
||||
// nsIAccessibleValue
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
protected:
|
||||
already_AddRefed<nsIContent> GetSliderNode();
|
||||
|
@ -61,10 +61,10 @@ _TEST_FILES =\
|
||||
name.xbl \
|
||||
namerules.xml \
|
||||
nsIAccessible_selects.js \
|
||||
nsIAccessible_states.js \
|
||||
nsIAccessibleEditableText.js \
|
||||
relations.js \
|
||||
role.js \
|
||||
states.js \
|
||||
table.js \
|
||||
value.js \
|
||||
test_accessnode_invalidation.html \
|
||||
|
@ -281,16 +281,23 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree)
|
||||
|
||||
for (var prop in aAccTree) {
|
||||
var msg = "Wrong value of property '" + prop + "'.";
|
||||
if (prop == "role")
|
||||
if (prop == "role") {
|
||||
is(roleToString(acc[prop]), roleToString(aAccTree[prop]), msg);
|
||||
else if (prop != "children")
|
||||
|
||||
} else if (prop == "states") {
|
||||
var statesObj = aAccTree[prop];
|
||||
testStates(acc, statesObj.states, statesObj.extraStates,
|
||||
statesObj.absentStates, statesObj.absentExtraStates);
|
||||
|
||||
} else if (prop != "children") {
|
||||
is(acc[prop], aAccTree[prop], msg);
|
||||
}
|
||||
}
|
||||
|
||||
if ("children" in aAccTree) {
|
||||
if ("children" in aAccTree && aAccTree["children"] instanceof Array) {
|
||||
var children = acc.children;
|
||||
is(children.length, aAccTree.children.length,
|
||||
"Different amount of expected children.");
|
||||
"Different amount of expected children of " + prettyName(acc) + ".");
|
||||
|
||||
if (aAccTree.children.length == children.length) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
|
@ -15,40 +15,42 @@ function testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState,
|
||||
{
|
||||
var [state, extraState] = getStates(aAccOrElmOrID);
|
||||
|
||||
var id = prettyName(aAccOrElmOrID);
|
||||
|
||||
is(state & aState, aState,
|
||||
"wrong state bits for " + aAccOrElmOrID + "!");
|
||||
"wrong state bits for " + id + "!");
|
||||
|
||||
if (aExtraState)
|
||||
is(extraState & aExtraState, aExtraState,
|
||||
"wrong extra state bits for " + aAccOrElmOrID + "!");
|
||||
"wrong extra state bits for " + id + "!");
|
||||
|
||||
if (aAbsentState)
|
||||
is(state & aAbsentState, 0,
|
||||
"state bits should not be present in ID " + aAccOrElmOrID + "!");
|
||||
"state bits should not be present in ID " + id + "!");
|
||||
|
||||
if (aAbsentExtraState)
|
||||
is(extraState & aAbsentExtraState, 0,
|
||||
"extraState bits should not be present in ID " + aAccOrElmOrID + "!");
|
||||
"extraState bits should not be present in ID " + id + "!");
|
||||
|
||||
if (state & STATE_READONLY)
|
||||
is(extraState & EXT_STATE_EDITABLE, 0,
|
||||
"Read-only " + aAccOrElmOrID + " cannot be editable!");
|
||||
"Read-only " + id + " cannot be editable!");
|
||||
|
||||
if (extraState & EXT_STATE_EDITABLE)
|
||||
is(state & STATE_READONLY, 0,
|
||||
"Editable " + aAccOrElmOrID + " cannot be readonly!");
|
||||
"Editable " + id + " cannot be readonly!");
|
||||
|
||||
if (state & STATE_COLLAPSED || state & STATE_EXPANDED)
|
||||
is(extraState & EXT_STATE_EXPANDABLE, EXT_STATE_EXPANDABLE,
|
||||
"Collapsed or expanded " + aAccOrElmOrID + " should be expandable!");
|
||||
"Collapsed or expanded " + id + " should be expandable!");
|
||||
|
||||
if (state & STATE_COLLAPSED)
|
||||
is(state & STATE_EXPANDED, 0,
|
||||
"Collapsed " + aAccOrElmOrID + " cannot be expanded!");
|
||||
"Collapsed " + id + " cannot be expanded!");
|
||||
|
||||
if (state & STATE_EXPANDED)
|
||||
is(state & STATE_COLLAPSED, 0,
|
||||
"Expanded " + aAccOrElmOrID + " cannot be collapsed!");
|
||||
"Expanded " + id + " cannot be collapsed!");
|
||||
|
||||
if (state & STATE_CHECKED || state & STATE_MIXED)
|
||||
is(state & STATE_CHECKABLE, STATE_CHECKABLE,
|
||||
@ -63,7 +65,7 @@ function testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState,
|
||||
if ((state & STATE_UNAVAILABLE)
|
||||
&& (getRole(aAccOrElmOrID) != ROLE_GROUPING))
|
||||
is(state & STATE_FOCUSABLE, STATE_FOCUSABLE,
|
||||
"Disabled " + aAccOrElmOrID + " must be focusable!");
|
||||
"Disabled " + id + " must be focusable!");
|
||||
}
|
||||
|
||||
/**
|
@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452388
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
|
@ -20,9 +20,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
src="chrome://mochikit/content/a11y/accessible/actions.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
// gA11yEventDumpID = "eventDump";
|
||||
|
||||
function focusChecker(aAcc)
|
||||
{
|
||||
this.type = EVENT_FOCUS;
|
||||
@ -31,6 +35,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
{
|
||||
return "focus handling";
|
||||
}
|
||||
this.check = function focusChecker_check(aEvent)
|
||||
{
|
||||
testStates(this.target, STATE_FOCUSED);
|
||||
}
|
||||
}
|
||||
|
||||
function nameChecker(aAcc, aName)
|
||||
@ -41,7 +49,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
{
|
||||
return "name change handling";
|
||||
},
|
||||
this.check = function focusChecker_check(aEvent)
|
||||
this.check = function nameChecker_check(aEvent)
|
||||
{
|
||||
is(aEvent.accessible.name, aName,
|
||||
"Wrong name of " + prettyName(aEvent.accessible) + " on focus");
|
||||
@ -58,7 +66,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
children: [
|
||||
{ // start/stop button
|
||||
role: ROLE_PUSHBUTTON,
|
||||
name: "Play"
|
||||
name: "Play",
|
||||
states: {
|
||||
states: STATE_FOCUSABLE
|
||||
}
|
||||
},
|
||||
{ // buffer bar
|
||||
role: ROLE_PROGRESSBAR
|
||||
@ -68,14 +79,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
},
|
||||
{ // slider of progress bar
|
||||
role: ROLE_SLIDER,
|
||||
name: "0:00 of 0:01 elapsed"
|
||||
name: "0:00 of 0:01 elapsed",
|
||||
states: {
|
||||
states: STATE_FOCUSABLE
|
||||
}
|
||||
},
|
||||
{ // duration label, role="presentation"
|
||||
role: ROLE_NOTHING
|
||||
},
|
||||
{ // mute button
|
||||
role: ROLE_PUSHBUTTON,
|
||||
name: "Mute"
|
||||
name: "Mute",
|
||||
states: {
|
||||
states: STATE_FOCUSABLE
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
@ -86,6 +103,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
|
||||
var audioElm = getAccessible("audio");
|
||||
var playBtn = audioElm.firstChild;
|
||||
var scrubber = playBtn.nextSibling.nextSibling.nextSibling;
|
||||
var muteBtn = audioElm.lastChild;
|
||||
|
||||
var actions = [
|
||||
@ -98,6 +116,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
new nameChecker(muteBtn, "Unmute"),
|
||||
]
|
||||
},
|
||||
{
|
||||
ID: scrubber,
|
||||
actionName: "activate",
|
||||
events: null,
|
||||
eventSeq: [
|
||||
new focusChecker(scrubber)
|
||||
]
|
||||
},
|
||||
{
|
||||
ID: playBtn,
|
||||
actionName: "press",
|
||||
@ -128,5 +154,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
||||
|
||||
<audio id="audio" src="chrome://mochikit/content/a11y/accessible/bug461281.ogg"
|
||||
controls="true"></audio>
|
||||
|
||||
<div id="eventDump"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -14,7 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
|
@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function testThis(aID, aAcc, aRole, aAnchors, aName, aValid, aStartIndex,
|
||||
|
@ -16,7 +16,7 @@
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js" />
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
@ -14,7 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441519
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
|
@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=467387
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
|
@ -13,7 +13,7 @@
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
|
@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=454997
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
|
@ -14,7 +14,7 @@
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
|
@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=442648
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/testTextboxes.js"></script>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js" />
|
||||
src="chrome://mochikit/content/a11y/accessible/states.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/testTextboxes.js" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user