mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1726124: [Part 2] Only fire TABLE_STYLING_CHANGED events on tables, not table parts r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D154011
This commit is contained in:
parent
77f810cf5c
commit
8fe73fc09a
@ -1318,12 +1318,12 @@ bool DocAccessible::PruneOrInsertSubtree(nsIContent* aRoot) {
|
||||
|
||||
// If the accessible is a table, or table part, its layout table
|
||||
// status may have changed. We need to invalidate the associated
|
||||
// cache, which listens for the following event.
|
||||
// table cache, which listens for the following event.
|
||||
if (acc->IsTable() || acc->IsTableRow() || acc->IsTableCell()) {
|
||||
LocalAccessible* table = nsAccUtils::TableFor(acc);
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_TABLE_STYLING_CHANGED, acc);
|
||||
|
||||
if (table && table->IsTable()) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_TABLE_STYLING_CHANGED,
|
||||
table);
|
||||
QueueCacheUpdate(acc, CacheDomain::Table);
|
||||
}
|
||||
}
|
||||
|
@ -139,8 +139,7 @@ enum CachedBool { eCachedBoolMiss, eCachedTrue, eCachedFalse };
|
||||
// invalidate the mIsLayoutTable cache on our parent
|
||||
// table.
|
||||
if (eventType == nsIAccessibleEvent::EVENT_REORDER ||
|
||||
eventType == nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED ||
|
||||
eventType == nsIAccessibleEvent::EVENT_TABLE_STYLING_CHANGED) {
|
||||
eventType == nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED) {
|
||||
// Invalidate the cache on our parent table
|
||||
[self invalidateLayoutTableCache];
|
||||
}
|
||||
|
@ -297,9 +297,10 @@ addAccessibleTask(
|
||||
);
|
||||
|
||||
/*
|
||||
* After executing function 'change', verify that the element identified by the
|
||||
* id 'elem' recieves the event 'event'. After the event, check if the given
|
||||
* native accessible 'table' is a layout or data table by role using 'isLayout'.
|
||||
* After executing function 'change' which operates on 'elem', verify the specified
|
||||
* 'event' is fired on the test's table (assumed id="table"). After the event, check
|
||||
* if the given native accessible 'table' is a layout or data table by role
|
||||
* using 'isLayout'.
|
||||
*/
|
||||
async function testIsLayout(table, elem, event, change, isLayout) {
|
||||
info(
|
||||
@ -308,7 +309,7 @@ async function testIsLayout(table, elem, event, change, isLayout) {
|
||||
", expecting table change to " +
|
||||
(isLayout ? "AXGroup" : "AXTable")
|
||||
);
|
||||
const toWait = waitForEvent(event, elem);
|
||||
const toWait = waitForEvent(event, "table");
|
||||
await change();
|
||||
await toWait;
|
||||
is(
|
||||
@ -326,7 +327,7 @@ async function testIsLayout(table, elem, event, change, isLayout) {
|
||||
* appropriately. Attrs: summary, abbr, scope, headers
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<table id="sampleTable" summary="example summary">
|
||||
`<table id="table" summary="example summary">
|
||||
<tr role="presentation">
|
||||
<td id="cellOne">cell1</td>
|
||||
<td>cell2</td>
|
||||
@ -337,7 +338,7 @@ addAccessibleTask(
|
||||
</tr>
|
||||
</table>`,
|
||||
async (browser, accDoc) => {
|
||||
let table = getNativeInterface(accDoc, "sampleTable");
|
||||
let table = getNativeInterface(accDoc, "table");
|
||||
// summary attr should take precedence over role="presentation" to make this
|
||||
// a data table
|
||||
is(table.getAttributeValue("AXRole"), "AXTable", "Table is data table");
|
||||
@ -346,13 +347,11 @@ addAccessibleTask(
|
||||
// after summary is removed, we should have a layout table
|
||||
await testIsLayout(
|
||||
table,
|
||||
"sampleTable",
|
||||
"table",
|
||||
EVENT_OBJECT_ATTRIBUTE_CHANGED,
|
||||
async () => {
|
||||
await SpecialPowers.spawn(browser, [], () => {
|
||||
content.document
|
||||
.getElementById("sampleTable")
|
||||
.removeAttribute("summary");
|
||||
content.document.getElementById("table").removeAttribute("summary");
|
||||
});
|
||||
},
|
||||
true
|
||||
|
@ -14,7 +14,7 @@
|
||||
<script type="application/javascript">
|
||||
async function testGotStyleChange(elem, name, value) {
|
||||
let waitFor = waitForEvent(
|
||||
EVENT_TABLE_STYLING_CHANGED, elem
|
||||
EVENT_TABLE_STYLING_CHANGED, "table"
|
||||
);
|
||||
if (value) {
|
||||
document.getElementById(elem).style.setProperty(name, value);
|
||||
@ -45,7 +45,7 @@
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<table id="table">
|
||||
<tr id="rowOne" style="background-color: red;">
|
||||
<td id="cellOne">cell1</td>
|
||||
<td>cell2</td>
|
||||
|
Loading…
Reference in New Issue
Block a user