Backed out changeset f7afd5cab91c (bug 1960416) for causing bustages at TreeWalker.cpp.
This commit is contained in:
@@ -1612,22 +1612,6 @@ bool aria::IsValidARIAHidden(nsIContent* aContent) {
|
|||||||
!ShouldIgnoreARIAHidden(aContent);
|
!ShouldIgnoreARIAHidden(aContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool aria::IsValidARIAHidden(DocAccessible* aDocAcc) {
|
|
||||||
nsCOMPtr<nsIContent> docContent = aDocAcc->GetContent();
|
|
||||||
// First, check if our Doc Accessible has aria-hidden set on its content
|
|
||||||
bool isValid = IsValidARIAHidden(docContent);
|
|
||||||
|
|
||||||
// If our Doc Accessible was created using an element other than the
|
|
||||||
// root element, we need to verify the validity of any aria-hidden on
|
|
||||||
// the root element as well.
|
|
||||||
auto* rootElement = aDocAcc->DocumentNode()->GetRootElement();
|
|
||||||
if (docContent != rootElement) {
|
|
||||||
isValid |= IsValidARIAHidden(rootElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
return isValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool aria::ShouldIgnoreARIAHidden(nsIContent* aContent) {
|
bool aria::ShouldIgnoreARIAHidden(nsIContent* aContent) {
|
||||||
if (!aContent) {
|
if (!aContent) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "ARIAStateMap.h"
|
#include "ARIAStateMap.h"
|
||||||
#include "mozilla/a11y/AccTypes.h"
|
#include "mozilla/a11y/AccTypes.h"
|
||||||
#include "mozilla/a11y/DocAccessible.h"
|
|
||||||
#include "mozilla/a11y/Role.h"
|
#include "mozilla/a11y/Role.h"
|
||||||
|
|
||||||
#include "nsAtom.h"
|
#include "nsAtom.h"
|
||||||
@@ -311,14 +310,6 @@ uint8_t AttrCharacteristicsFor(nsAtom* aAtom);
|
|||||||
*/
|
*/
|
||||||
bool IsValidARIAHidden(nsIContent* aContent);
|
bool IsValidARIAHidden(nsIContent* aContent);
|
||||||
|
|
||||||
/**
|
|
||||||
* This function calls into the function above. It verifies the validity
|
|
||||||
* of any `aria-hidden` specified on the given Doc Accessible's
|
|
||||||
* mContent, as well as on the root element of mContent's owner
|
|
||||||
* doc.
|
|
||||||
*/
|
|
||||||
bool IsValidARIAHidden(DocAccessible* aDocAcc);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the element should render its subtree
|
* Return true if the element should render its subtree
|
||||||
* regardless of the presence of aria-hidden.
|
* regardless of the presence of aria-hidden.
|
||||||
|
|||||||
@@ -323,8 +323,7 @@ LocalAccessible* TreeWalker::AccessibleFor(nsIContent* aNode, uint32_t aFlags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create an accessible if allowed.
|
// Create an accessible if allowed.
|
||||||
if (!(aFlags & eWalkCache) && mContext->IsAcceptableChild(aNode) &&
|
if (!(aFlags & eWalkCache) && mContext->IsAcceptableChild(aNode)) {
|
||||||
!aria::IsValidARIAHidden(mDoc)) {
|
|
||||||
mDoc->RelocateARIAOwnedIfNeeded(aNode);
|
mDoc->RelocateARIAOwnedIfNeeded(aNode);
|
||||||
return GetAccService()->CreateAccessible(aNode, mContext, aSkipSubtree);
|
return GetAccService()->CreateAccessible(aNode, mContext, aSkipSubtree);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,75 +7,8 @@
|
|||||||
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
|
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify loading an iframe document with aria-hidden specified on the root element
|
* Verify loading a root doc with aria-hidden renders the document.
|
||||||
* correctly hides the root element and its content. This test is meaninfully
|
* Non-root doc elements, like embedded iframes, should continue
|
||||||
* different than testIframeDocument which tests aria-hidden specified on the
|
|
||||||
* body element.
|
|
||||||
*/
|
|
||||||
addAccessibleTask(
|
|
||||||
`hello world`,
|
|
||||||
async function testIframeRootDocument(browser) {
|
|
||||||
info("Loading iframe document");
|
|
||||||
const HIDDEN_IFRAME_URI =
|
|
||||||
"data:text/html,<html id='new_html' aria-hidden='true'><body id='iframeBody'><u>hello world</u></body></html>";
|
|
||||||
const loaded = waitForEvent(EVENT_DOCUMENT_LOAD_COMPLETE, "iframeBody");
|
|
||||||
await SpecialPowers.spawn(
|
|
||||||
browser,
|
|
||||||
[DEFAULT_IFRAME_ID, HIDDEN_IFRAME_URI],
|
|
||||||
(_id, _uri) => {
|
|
||||||
content.document.getElementById(_id).src = _uri;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
await loaded;
|
|
||||||
|
|
||||||
const tree = {
|
|
||||||
INTERNAL_FRAME: [
|
|
||||||
{
|
|
||||||
DOCUMENT: [],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const root = getRootAccessible(document);
|
|
||||||
const iframeDoc = findAccessibleChildByID(root, DEFAULT_IFRAME_ID);
|
|
||||||
testAccessibleTree(iframeDoc, tree);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
chrome: false,
|
|
||||||
topLevel: false,
|
|
||||||
iframe: true,
|
|
||||||
remoteIframe: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify loading a tab document with aria-hidden specified on the root element
|
|
||||||
* correctly renders the root element and its content. This test is meaninfully
|
|
||||||
* different than testTabDocument which tests aria-hidden specified on the
|
|
||||||
* body element.
|
|
||||||
*/
|
|
||||||
addAccessibleTask(
|
|
||||||
`<html aria-hidden="true"><u>hello world`,
|
|
||||||
async function testTabRootDocument(_, accDoc) {
|
|
||||||
const tree = {
|
|
||||||
DOCUMENT: [
|
|
||||||
{
|
|
||||||
TEXT_LEAF: [],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
testAccessibleTree(accDoc, tree);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
chrome: true,
|
|
||||||
topLevel: true,
|
|
||||||
iframe: false,
|
|
||||||
remoteIframe: false,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify loading a tab doc with aria-hidden on the body renders the document.
|
|
||||||
* Body elements inside of embedded iframes, should continue
|
|
||||||
* to respect aria-hidden when present. This test ONLY tests
|
* to respect aria-hidden when present. This test ONLY tests
|
||||||
* tab documents, it should not run in iframes. There is a separate
|
* tab documents, it should not run in iframes. There is a separate
|
||||||
* test for iframes below.
|
* test for iframes below.
|
||||||
@@ -203,9 +136,9 @@ addAccessibleTask(
|
|||||||
{ chrome: false, topLevel: false, iframe: true, remoteIframe: true }
|
{ chrome: false, topLevel: false, iframe: true, remoteIframe: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
///////////////////////////////
|
// // ///////////////////////////////
|
||||||
//////////////////// SVG Tests
|
// // //////////////////// SVG Tests
|
||||||
//////////////////////////////
|
// // //////////////////////////////
|
||||||
|
|
||||||
const SVG_DOCUMENT_ID = "rootSVG";
|
const SVG_DOCUMENT_ID = "rootSVG";
|
||||||
const HIDDEN_SVG_URI =
|
const HIDDEN_SVG_URI =
|
||||||
@@ -247,34 +180,32 @@ addAccessibleTask(
|
|||||||
{ chrome: true, topLevel: true, iframe: false, remoteIframe: false }
|
{ chrome: true, topLevel: true, iframe: false, remoteIframe: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
///////////
|
||||||
* Verify loading an SVG document with aria-hidden=true
|
///// TODO: Bug 1960416
|
||||||
* in an iframe does not render the document subtree.
|
//////////
|
||||||
*/
|
// /**
|
||||||
addAccessibleTask(
|
// * Verify loading an SVG document with aria-hidden=true
|
||||||
`hello world`,
|
// * in an iframe does not render the document subtree.
|
||||||
async function testSVGIframeDocument(browser) {
|
// */
|
||||||
info("Loading SVG");
|
// addAccessibleTask(
|
||||||
const loaded = waitForEvent(EVENT_DOCUMENT_LOAD_COMPLETE, SVG_DOCUMENT_ID);
|
// `hello world`,
|
||||||
await SpecialPowers.spawn(
|
// async function testSVGIframeDocument(browser) {
|
||||||
browser,
|
// info("Loading SVG");
|
||||||
[DEFAULT_IFRAME_ID, HIDDEN_SVG_URI],
|
// const loaded = waitForEvent(EVENT_DOCUMENT_LOAD_COMPLETE, SVG_DOCUMENT_ID);
|
||||||
(_id, _uri) => {
|
// await SpecialPowers.spawn(browser, [DEFAULT_IFRAME_ID, HIDDEN_SVG_URI], (_id,_uri) => {
|
||||||
content.document.getElementById(_id).src = _uri;
|
// content.document.getElementById(_id).src = _uri;
|
||||||
}
|
// });
|
||||||
);
|
// await loaded;
|
||||||
await loaded;
|
|
||||||
|
|
||||||
const tree = {
|
// const tree = {
|
||||||
DOCUMENT: [],
|
// DOCUMENT: [],
|
||||||
};
|
// };
|
||||||
|
// const root = getRootAccessible(document);
|
||||||
const root = getRootAccessible(document);
|
// const svgRoot = findAccessibleChildByID(root, SVG_DOCUMENT_ID);
|
||||||
const svgRoot = findAccessibleChildByID(root, SVG_DOCUMENT_ID);
|
// testAccessibleTree(svgRoot, tree);
|
||||||
testAccessibleTree(svgRoot, tree);
|
// },
|
||||||
},
|
// { chrome: false, topLevel: false, iframe: true, remoteIframe: true }
|
||||||
{ chrome: false, topLevel: false, iframe: true, remoteIframe: true }
|
// );
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify adding aria-hidden to root svg elements has no effect.
|
* Verify adding aria-hidden to root svg elements has no effect.
|
||||||
|
|||||||
Reference in New Issue
Block a user