# HG changeset patch # User Joanmarie Diggs # Date 1517911980 -7200 # Node ID 1564fec091b4cccc4b2fd652132e8c9dcdbbdb91 # Parent 96333b8e8e2586295b11a05ec9eae868f47957c4 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. diff --git a/accessible/base/ARIAMap.cpp b/accessible/base/ARIAMap.cpp --- a/accessible/base/ARIAMap.cpp +++ b/accessible/base/ARIAMap.cpp @@ -573,17 +573,17 @@ static const nsRoleMapEntry sWAIRoleMaps eNoValue, eNoAction, eNoLiveAttr, eLandmark, kNoReqStates }, { // document &nsGkAtoms::document, - roles::DOCUMENT, + roles::NON_NATIVE_DOCUMENT, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kGenericAccType, kNoReqStates, eReadonlyUntilEditable }, @@ -614,17 +614,17 @@ static const nsRoleMapEntry sWAIRoleMaps eNoValue, eNoAction, eNoLiveAttr, eLandmark, kNoReqStates }, { // graphics-document &nsGkAtoms::graphicsDocument, - roles::DOCUMENT, + roles::NON_NATIVE_DOCUMENT, kUseMapRole, eNoValue, eNoAction, eNoLiveAttr, kGenericAccType, kNoReqStates, eReadonlyUntilEditable }, diff --git a/accessible/base/Role.h b/accessible/base/Role.h --- a/accessible/base/Role.h +++ b/accessible/base/Role.h @@ -106,17 +106,17 @@ enum Role { /** * Represents a main window for an application. It is used for * role="application". Also refer to APP_ROOT */ APPLICATION = 14, /** * 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, /** * Represents a pane within a frame or document window. Users can navigate * between panes and within the contents of the current pane, but cannot * navigate between items in different panes. Thus, panes represent a level * of grouping lower than frame windows or documents, but above individual @@ -638,23 +638,22 @@ enum Role { ENTRY = 102, /** * A caption describing another object. */ 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. */ HEADING = 105, /** * An object representing a page of document content. It is used in documents diff --git a/accessible/base/RoleMap.h b/accessible/base/RoleMap.h --- a/accessible/base/RoleMap.h +++ b/accessible/base/RoleMap.h @@ -124,17 +124,17 @@ ROLE(APPLICATION, ATK_ROLE_EMBEDDED, NSAccessibilityGroupRole, //Unused on OS X. the system will take care of this. ROLE_SYSTEM_APPLICATION, ROLE_SYSTEM_APPLICATION, eNoNameRule) ROLE(DOCUMENT, "document", - ATK_ROLE_DOCUMENT_FRAME, + ATK_ROLE_DOCUMENT_WEB, @"AXWebArea", ROLE_SYSTEM_DOCUMENT, ROLE_SYSTEM_DOCUMENT, eNoNameRule) /** * msaa comment: * We used to map to ROLE_SYSTEM_PANE, but JAWS would @@ -844,22 +844,22 @@ ROLE(ENTRY, ROLE(CAPTION, "caption", ATK_ROLE_CAPTION, NSAccessibilityStaticTextRole, USE_ROLE_STRING, 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, "heading", ATK_ROLE_HEADING, @"AXHeading", USE_ROLE_STRING, IA2_ROLE_HEADING, diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp --- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -2346,17 +2346,17 @@ DocAccessible::CacheChildrenInSubtree(Ac // Fire events for ARIA elements. if (!aRoot->HasARIARole()) { return; } // 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); } } void DocAccessible::UncacheChildrenInSubtree(Accessible* aRoot) { aRoot->mStateFlags |= eIsNotInDocument; diff --git a/accessible/interfaces/nsIAccessibleRole.idl b/accessible/interfaces/nsIAccessibleRole.idl --- a/accessible/interfaces/nsIAccessibleRole.idl +++ b/accessible/interfaces/nsIAccessibleRole.idl @@ -99,17 +99,17 @@ interface nsIAccessibleRole : nsISupport /** * Represents a main window for an application. It is used for * role="application". Also refer to ROLE_APP_ROOT */ const unsigned long ROLE_APPLICATION = 14; /** * 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; /** * Represents a pane within a frame or document window. Users can navigate * between panes and within the contents of the current pane, but cannot * navigate between items in different panes. Thus, panes represent a level * of grouping lower than frame windows or documents, but above individual @@ -632,23 +632,22 @@ interface nsIAccessibleRole : nsISupport const unsigned long ROLE_ENTRY = 102; /** * A caption describing another object. */ 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. */ const unsigned long ROLE_HEADING = 105; /** * An object representing a page of document content. It is used in documents diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -912,16 +912,19 @@ ConvertToNSArray(nsTArray