Bug 664142 - DEFAULT state exposed incorrectly for HTML, r=tbsaunde

This commit is contained in:
Alexander Surkov 2011-10-03 23:26:18 +09:00
Родитель 2e7eafacca
Коммит a1c8be78dc
4 изменённых файлов: 85 добавлений и 4 удалений

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

@ -278,8 +278,8 @@ nsHTMLButtonAccessible::NativeState()
{
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::submit, eIgnoreCase))
nsEventStates elmState = mContent->AsElement()->State();
if (elmState.HasState(NS_EVENT_STATE_DEFAULT))
state |= states::DEFAULT;
return state;
@ -382,8 +382,8 @@ nsHTML4ButtonAccessible::NativeState()
state |= states::FOCUSABLE;
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::submit, eIgnoreCase))
nsEventStates elmState = mContent->AsElement()->State();
if (elmState.HasState(NS_EVENT_STATE_DEFAULT))
state |= states::DEFAULT;
return state;

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

@ -13,6 +13,7 @@
const STATE_CHECKED = nsIAccessibleStates.STATE_CHECKED;
const STATE_CHECKABLE = nsIAccessibleStates.STATE_CHECKABLE;
const STATE_COLLAPSED = nsIAccessibleStates.STATE_COLLAPSED;
const STATE_DEFAULT = nsIAccessibleStates.STATE_DEFAULT;
const STATE_EXPANDED = nsIAccessibleStates.STATE_EXPANDED;
const STATE_EXTSELECTABLE = nsIAccessibleStates.STATE_EXTSELECTABLE;
const STATE_FOCUSABLE = nsIAccessibleStates.STATE_FOCUSABLE;

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

@ -49,6 +49,7 @@ _TEST_FILES =\
test_aria.html \
test_aria_imgmap.html \
test_aria_tabs.html \
test_buttons.html \
test_doc.html \
test_docarticle.html \
test_editablebody.html \

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

@ -0,0 +1,79 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML button accessible states</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript">
function doTest()
{
// Default state.
testStates("f1_image", STATE_DEFAULT);
testStates("f2_submit", STATE_DEFAULT);
testStates("f3_submitbutton", STATE_DEFAULT);
testStates("f4_button", 0, 0, STATE_DEFAULT);
testStates("f4_image1", STATE_DEFAULT);
testStates("f4_image2", 0, 0, STATE_DEFAULT);
testStates("f4_submit", 0, 0, STATE_DEFAULT);
testStates("f4_submitbutton", 0, 0, STATE_DEFAULT);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=664142"
title="DEFAULT state exposed incorrectly for HTML">
Mozilla Bug 664142
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<p>A form with an image button</p>
<form name="form1" method="get">
<input type="text" name="hi">
<input id="f1_image" type="image" value="image-button">
</form>
<p>A form with a submit button:</p>
<form name="form2" method="get">
<input type="text" name="hi">
<input id="f2_submit" type="submit">
</form>
<p>A form with a HTML4 submit button:</p>
<form name="form3" method="get">
<input type="text" name="hi">
<button id="f3_submitbutton" type="submit">submit</button>
</form>
<p>A form with normal button, two image buttons, submit button,
HTML4 submit button:</p>
<form name="form4" method="get">
<input type="text" name="hi">
<input id="f4_button" type="button" value="normal" name="normal-button">
<input id="f4_image1" type="image" value="image-button1" name="image-button1">
<input id="f4_image2" type="image" value="image-button2" name="image-button2">
<input id="f4_submit" type="submit" value="real-submit" name="real-submit">
<button id="f4_submitbutton" type="submit">submit</button>
</form>
</body>
</html>