mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1798037 - Notify of bounds change if root doc element is given. r=morgan
DocAccessible::GetAccessible() won't return the document if a root element like body is passed. We need to check for that in NotifyOfPossibleBoundsChange and use the document accessible in that case. We can't modify GetAccessible() because that is not that method is used extensively and that is not the expected behavior. Differential Revision: https://phabricator.services.mozilla.com/D160677
This commit is contained in:
parent
7ad4163208
commit
bbb5780267
@ -369,7 +369,11 @@ void nsAccessibilityService::NotifyOfPossibleBoundsChange(
|
||||
StaticPrefs::accessibility_cache_enabled_AtStartup()) {
|
||||
DocAccessible* document = GetDocAccessible(aPresShell);
|
||||
if (document) {
|
||||
LocalAccessible* accessible = document->GetAccessible(aContent);
|
||||
// DocAccessible::GetAccessible() won't return the document if a root
|
||||
// element like body is passed.
|
||||
LocalAccessible* accessible = aContent == document->GetContent()
|
||||
? document
|
||||
: document->GetAccessible(aContent);
|
||||
if (accessible) {
|
||||
document->QueueCacheUpdate(accessible, CacheDomain::Bounds);
|
||||
}
|
||||
@ -386,7 +390,11 @@ void nsAccessibilityService::NotifyOfComputedStyleChange(
|
||||
|
||||
DocAccessible* document = GetDocAccessible(aPresShell);
|
||||
if (document) {
|
||||
LocalAccessible* accessible = document->GetAccessible(aContent);
|
||||
// DocAccessible::GetAccessible() won't return the document if a root
|
||||
// element like body is passed.
|
||||
LocalAccessible* accessible = aContent == document->GetContent()
|
||||
? document
|
||||
: document->GetAccessible(aContent);
|
||||
if (accessible) {
|
||||
accessible->MaybeQueueCacheUpdateForStyleChanges();
|
||||
}
|
||||
|
@ -140,3 +140,30 @@ addAccessibleTask(
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test document bounds change notifications.
|
||||
* Note: This uses iframes to change the doc container size in order
|
||||
* to have the doc accessible's bounds change.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<div id="div" style="width: 30px; height: 30px"></div>`,
|
||||
async function(browser, accDoc, foo) {
|
||||
const docWidth = () => {
|
||||
let width = {};
|
||||
accDoc.getBounds({}, {}, width, {});
|
||||
return width.value;
|
||||
};
|
||||
|
||||
await untilCacheIs(docWidth, 0, "Doc width is 0");
|
||||
await invokeSetStyleIframe(browser, DEFAULT_IFRAME_ID, "width", `300px`);
|
||||
await untilCacheIs(docWidth, 300, "Doc width is 300");
|
||||
},
|
||||
{
|
||||
chrome: false,
|
||||
topLevel: false,
|
||||
iframe: true,
|
||||
remoteIframe: isCacheEnabled /* works, but timing is tricky with no cache */,
|
||||
iframeAttrs: { style: "width: 0;" },
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user