Bug 1433891 - ARIA documents should be easily distinguishable from native ones r=marcoz

Gecko has two document roles: roles::DOCUMENT_FRAME and roles::DOCUMENT.
However, the former was not being used at all; the latter was being used
for both ARIA documents and for the native document container. We can
therefore fix this issue by repurposing the unused internal role:

* Rename the role from roles::DOCUMENT_FRAME to roles::NON_NATIVE_DOCUMENT,
  and add clarification to the doc strings in Role.h
* Ensure load events are still emitted for ARIA documents (bug 759833)
* Update the ARIA-document mochitests to reflect the above changes
* Change the ATK role mapping for roles::DOCUMENT (the native container)
  from ATK_ROLE_DOCUMENT_FRAME TO ATK_ROLE_DOCUMENT_WEB.
* On IAccessible2, map roles::NON_NATIVE_DOCUMENT to ROLE_SYSTEM_DOCUMENT.
  This should cause there to be no change in behavior for that platform.
* On macOS map roles::NON_NATIVE_DOCUMENT to NSAccessibilityGroupRole
  with a subrole of AXDocument.

--HG--
extra : rebase_source : bb6bacfa08c0d22e4e52a25d309d15b2a913320d
This commit is contained in:
Joanmarie Diggs 2018-02-06 12:13:00 +02:00
parent c503e8a777
commit b33dfc1490
9 changed files with 26 additions and 24 deletions

View File

@ -578,7 +578,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] =
},
{ // document
&nsGkAtoms::document,
roles::DOCUMENT,
roles::NON_NATIVE_DOCUMENT,
kUseMapRole,
eNoValue,
eNoAction,
@ -619,7 +619,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] =
},
{ // graphics-document
&nsGkAtoms::graphicsDocument,
roles::DOCUMENT,
roles::NON_NATIVE_DOCUMENT,
kUseMapRole,
eNoValue,
eNoAction,

View File

@ -111,7 +111,7 @@ enum Role {
/**
* Represents a document window. A document window is always contained within
* an application window. It is used for role="document".
* an application window. For role="document", see NON_NATIVE_DOCUMENT.
*/
DOCUMENT = 15,
@ -643,13 +643,12 @@ enum Role {
CAPTION = 103,
/**
* A visual frame or container which contains a view of document content.
* Document frames may occur within another Document instance, in which case
* the second document may be said to be embedded in the containing instance.
* HTML frames are often DOCUMENT_FRAME. Either this object, or a
* singleton descendant, should implement the Document interface.
* An element containing content that assistive technology users may want to
* browse in a reading mode, rather than a focus/interactive/application mode.
* This role is used for role="document". For the container which holds the
* content of a web page, see DOCUMENT.
*/
DOCUMENT_FRAME = 104,
NON_NATIVE_DOCUMENT = 104,
/**
* Heading.

View File

@ -129,7 +129,7 @@ ROLE(APPLICATION,
ROLE(DOCUMENT,
"document",
ATK_ROLE_DOCUMENT_FRAME,
ATK_ROLE_DOCUMENT_WEB,
@"AXWebArea",
ROLE_SYSTEM_DOCUMENT,
ROLE_SYSTEM_DOCUMENT,
@ -849,12 +849,12 @@ ROLE(CAPTION,
IA2_ROLE_CAPTION,
eNameFromSubtreeIfReqRule)
ROLE(DOCUMENT_FRAME,
"document frame",
ROLE(NON_NATIVE_DOCUMENT,
"non-native document",
ATK_ROLE_DOCUMENT_FRAME,
NSAccessibilityScrollAreaRole,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_UNKNOWN,
ROLE_SYSTEM_DOCUMENT,
eNoNameRule)
ROLE(HEADING,

View File

@ -2351,7 +2351,7 @@ DocAccessible::CacheChildrenInSubtree(Accessible* aRoot,
// XXX: we should delay document load complete event if the ARIA document
// has aria-busy.
roles::Role role = aRoot->ARIARole();
if (!aRoot->IsDoc() && (role == roles::DIALOG || role == roles::DOCUMENT)) {
if (!aRoot->IsDoc() && (role == roles::DIALOG || role == roles::NON_NATIVE_DOCUMENT)) {
FireDelayedEvent(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE, aRoot);
}
}

View File

@ -104,7 +104,7 @@ interface nsIAccessibleRole : nsISupports
/**
* Represents a document window. A document window is always contained within
* an application window. It is used for role="document".
* an application window. For role="document", see NON_NATIVE_DOCUMENT.
*/
const unsigned long ROLE_DOCUMENT = 15;
@ -637,13 +637,12 @@ interface nsIAccessibleRole : nsISupports
const unsigned long ROLE_CAPTION = 103;
/**
* A visual frame or container which contains a view of document content.
* Document frames may occur within another Document instance, in which case
* the second document may be said to be embedded in the containing instance.
* HTML frames are often ROLE_DOCUMENT_FRAME. Either this object, or a
* singleton descendant, should implement the Document interface.
* An element containing content that assistive technology users may want to
* browse in a reading mode, rather than a focus/interactive/application mode.
* This role is used for role="document". For the container which holds the
* content of a web page, see ROLE_DOCUMENT.
*/
const unsigned long ROLE_DOCUMENT_FRAME = 104;
const unsigned long ROLE_NON_NATIVE_DOCUMENT = 104;
/**
* Heading.

View File

@ -917,6 +917,9 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
case roles::ARTICLE:
return @"AXDocumentArticle";
case roles::NON_NATIVE_DOCUMENT:
return @"AXDocument";
// macOS added an AXSubrole value to distinguish generic AXGroup objects
// from those which are AXGroups as a result of an explicit ARIA role,
// such as the non-landmark, non-listitem text containers in DPub ARIA.

View File

@ -85,6 +85,7 @@ const ROLE_MENUBAR = nsIAccessibleRole.ROLE_MENUBAR;
const ROLE_MENUITEM = nsIAccessibleRole.ROLE_MENUITEM;
const ROLE_MENUPOPUP = nsIAccessibleRole.ROLE_MENUPOPUP;
const ROLE_NAVIGATION = nsIAccessibleRole.ROLE_NAVIGATION;
const ROLE_NON_NATIVE_DOCUMENT = nsIAccessibleRole.ROLE_NON_NATIVE_DOCUMENT;
const ROLE_NOTHING = nsIAccessibleRole.ROLE_NOTHING;
const ROLE_NOTE = nsIAccessibleRole.ROLE_NOTE;
const ROLE_OPTION = nsIAccessibleRole.ROLE_OPTION;

View File

@ -27,7 +27,7 @@
testRole("aria_combobox", ROLE_EDITCOMBOBOX);
testRole("aria_dialog", ROLE_DIALOG);
testRole("aria_directory", ROLE_LIST);
testRole("aria_document", ROLE_DOCUMENT);
testRole("aria_document", ROLE_NON_NATIVE_DOCUMENT);
testRole("aria_form", ROLE_FORM);
testRole("aria_feed", ROLE_GROUPING);
testRole("aria_figure", ROLE_FIGURE);

View File

@ -17,7 +17,7 @@
function doTest() {
// Graphics ARIA role map.
testRole("graphics-document", ROLE_DOCUMENT);
testRole("graphics-document", ROLE_NON_NATIVE_DOCUMENT);
testRole("graphics-object", ROLE_GROUPING);
testRole("graphics-symbol", ROLE_GRAPHIC);
SimpleTest.finish();