зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1688730: Fire relevant object attr changed events when layout table status may have changed r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D102993
This commit is contained in:
Родитель
b98fffa595
Коммит
cdce5e2be5
|
@ -921,6 +921,18 @@ void DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
|||
return;
|
||||
}
|
||||
|
||||
// These attributes can change whether or not a table is a layout table.
|
||||
// We currently cache that information on Mac, so we fire a
|
||||
// EVENT_OBJECT_ATTRIBUTE_CHANGED, which Mac listens for, to invalidate.
|
||||
if (aAccessible->IsTable() || aAccessible->IsTableRow() ||
|
||||
aAccessible->IsTableCell()) {
|
||||
if (aAttribute == nsGkAtoms::summary || aAttribute == nsGkAtoms::headers ||
|
||||
aAttribute == nsGkAtoms::scope || aAttribute == nsGkAtoms::abbr) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
aAccessible);
|
||||
}
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_busy) {
|
||||
bool isOn = elm->AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true,
|
||||
eCaseMatters);
|
||||
|
|
|
@ -12,6 +12,7 @@ support-files =
|
|||
[test_aria_owns.html]
|
||||
[test_aria_statechange.html]
|
||||
[test_attrs.html]
|
||||
[test_attrchange.html]
|
||||
[test_bug1322593.html]
|
||||
[test_bug1322593-2.html]
|
||||
[test_caretmove.html]
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Accessible attr change event testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../promisified-events.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
async function testGotAttrChange(elem, name, value) {
|
||||
const waitFor = waitForEvent(EVENT_OBJECT_ATTRIBUTE_CHANGED, elem);
|
||||
if (value) {
|
||||
document.getElementById(elem).setAttribute(name, value);
|
||||
} else {
|
||||
document.getElementById(elem).removeAttribute(name);
|
||||
}
|
||||
await waitFor;
|
||||
}
|
||||
|
||||
async function doTests() {
|
||||
info("Removing summary attr");
|
||||
// after summary is removed, we should have a layout table
|
||||
await testGotAttrChange(
|
||||
"sampleTable",
|
||||
"summary",
|
||||
null
|
||||
);
|
||||
|
||||
info("Setting abbr attr");
|
||||
// after abbr is set we should have a data table again
|
||||
await testGotAttrChange(
|
||||
"cellOne",
|
||||
"abbr",
|
||||
"hello world"
|
||||
);
|
||||
|
||||
info("Removing abbr attr");
|
||||
// after abbr is removed we should have a layout table again
|
||||
await testGotAttrChange(
|
||||
"cellOne",
|
||||
"abbr",
|
||||
null
|
||||
);
|
||||
|
||||
info("Setting scope attr");
|
||||
// after scope is set we should have a data table again
|
||||
await testGotAttrChange(
|
||||
"cellOne",
|
||||
"scope",
|
||||
"col"
|
||||
);
|
||||
|
||||
info("Removing scope attr");
|
||||
// remove scope should give layout
|
||||
await testGotAttrChange(
|
||||
"cellOne",
|
||||
"scope",
|
||||
null
|
||||
);
|
||||
|
||||
info("Setting headers attr");
|
||||
// add headers attr should give data
|
||||
await testGotAttrChange(
|
||||
"cellThree",
|
||||
"headers",
|
||||
"cellOne"
|
||||
);
|
||||
|
||||
info("Removing headers attr");
|
||||
// remove headers attr should give layout
|
||||
await testGotAttrChange(
|
||||
"cellThree",
|
||||
"headers",
|
||||
null
|
||||
);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTests);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table id="sampleTable" summary="example summary">
|
||||
<tr role="presentation">
|
||||
<td id="cellOne">cell1</td>
|
||||
<td>cell2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="cellThree">cell3</td>
|
||||
<td>cell4</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -44,6 +44,8 @@ const EVENT_TEXT_SELECTION_CHANGED =
|
|||
nsIAccessibleEvent.EVENT_TEXT_SELECTION_CHANGED;
|
||||
const EVENT_LIVE_REGION_ADDED = nsIAccessibleEvent.EVENT_LIVE_REGION_ADDED;
|
||||
const EVENT_LIVE_REGION_REMOVED = nsIAccessibleEvent.EVENT_LIVE_REGION_REMOVED;
|
||||
const EVENT_OBJECT_ATTRIBUTE_CHANGED =
|
||||
nsIAccessibleEvent.EVENT_OBJECT_ATTRIBUTE_CHANGED;
|
||||
|
||||
const EventsLogger = {
|
||||
enabled: false,
|
||||
|
|
Загрузка…
Ссылка в новой задаче