Backed out 1 changesets (bug 1675292) for causing failures in browser_roles_elements. CLOSED TREE DONTBUILD

Backed out changeset f4cdad3fae02 (bug 1675292)
This commit is contained in:
smolnar 2020-11-10 09:12:15 +02:00
parent 6ac3c7496b
commit 17d3157e82
6 changed files with 13 additions and 163 deletions

View File

@ -72,25 +72,13 @@ void AccessibleWrap::GetNativeInterface(void** aOutInterface) {
Class AccessibleWrap::GetNativeType() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
if (IsXULTabpanels()) {
return [mozPaneAccessible class];
}
if (IsXULTabpanels()) return [mozPaneAccessible class];
if (IsTable()) {
return [mozTableAccessible class];
}
if (IsTable()) return [mozTableAccessible class];
if (IsTableRow()) {
return [mozTableRowAccessible class];
}
if (IsTableRow()) return [mozTableRowAccessible class];
if (IsTableCell()) {
return [mozTableCellAccessible class];
}
if (IsDoc()) {
return [MOXWebAreaAccessible class];
}
if (IsTableCell()) return [mozTableCellAccessible class];
return GetTypeFromRole(Role());
@ -244,6 +232,9 @@ Class a11y::GetTypeFromRole(roles::Role aRole) {
case roles::COMBOBOX:
return [mozPopupButtonAccessible class];
case roles::DOCUMENT:
return [MOXWebAreaAccessible class];
case roles::PUSHBUTTON:
return [mozButtonAccessible class];

View File

@ -14,12 +14,6 @@ using namespace mozilla::a11y;
@interface MOXWebAreaAccessible : mozAccessible {
MOXRootGroup* mRootGroup;
}
// overrides
- (NSString*)moxRole;
// overrides
- (NSString*)moxRoleDescription;
// overrides
- (NSURL*)moxURL;
@ -35,9 +29,6 @@ using namespace mozilla::a11y;
// override
- (NSArray*)moxUnignoredChildren;
// override
- (BOOL)moxBlockSelector:(SEL)selector;
// override
- (void)handleAccessibleEvent:(uint32_t)eventType;
@ -72,9 +63,6 @@ using namespace mozilla::a11y;
// override
- (NSString*)moxIdentifier;
// override
- (NSString*)moxSubrole;
// override
- (id)moxHitTest:(NSPoint)point;

View File

@ -27,10 +27,6 @@ using namespace mozilla::a11y;
}
- (NSString*)moxRoleDescription {
if ([[self moxSubrole] isEqualToString:@"AXLandmarkApplication"]) {
return utils::LocalizedString(u"application"_ns);
}
return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, nil);
}
@ -49,11 +45,6 @@ using namespace mozilla::a11y;
return @"root-group";
}
- (NSString*)moxSubrole {
// Steal the subrole internally mapped to the web area.
return [mParent moxSubrole];
}
- (id)moxHitTest:(NSPoint)point {
return [mParent moxHitTest:point];
}
@ -99,20 +90,6 @@ using namespace mozilla::a11y;
@implementation MOXWebAreaAccessible
- (NSString*)moxRole {
// The OS role is AXWebArea regardless of the gecko role
// (APPLICATION or DOCUMENT).
// If the web area has a role of APPLICATION, its root group will
// reflect that in a subrole/description.
return @"AXWebArea";
}
- (NSString*)moxRoleDescription {
// The role description is "HTML Content" regardless of the gecko role
// (APPLICATION or DOCUMENT)
return utils::LocalizedString(u"htmlContent"_ns);
}
- (NSURL*)moxURL {
if ([self isExpired]) {
return nil;
@ -217,23 +194,12 @@ using namespace mozilla::a11y;
return [super moxUnignoredChildren];
}
- (BOOL)moxBlockSelector:(SEL)selector {
if (selector == @selector(moxSubrole)) {
// Never expose a subrole for a web area.
return YES;
}
return [super moxBlockSelector:selector];
}
- (id)rootGroup {
NSArray* children = [super moxUnignoredChildren];
if (mRole != roles::APPLICATION && [children count] == 1 &&
if ([children count] == 1 &&
[[[children firstObject] moxUnignoredChildren] count] != 0) {
// We only need a root group if our document:
// (1) has multiple children, or
// (2) a one child that is a leaf, or
// (3) has a role of APPLICATION
// We only need a root group if our document has multiple children or one
// child that is a leaf.
return nil;
}

View File

@ -14,7 +14,6 @@
#include "AccessibleOrProxy.h"
#include "DocAccessibleParent.h"
#include "mozTableAccessible.h"
#include "MOXWebAreaAccessible.h"
#include "nsAppShell.h"
@ -55,8 +54,6 @@ void ProxyCreated(ProxyAccessible* aProxy, uint32_t) {
type = [mozTableRowAccessible class];
} else if (aProxy->IsTableCell()) {
type = [mozTableCellAccessible class];
} else if (aProxy->IsDoc()) {
type = [MOXWebAreaAccessible class];
} else {
type = GetTypeFromRole(aProxy->Role());
}

View File

@ -538,6 +538,9 @@ struct RoleDescrComparator {
};
- (NSString*)moxRoleDescription {
if (mRole == roles::DOCUMENT)
return utils::LocalizedString(u"htmlContent"_ns);
if (mRole == roles::FIGURE) return utils::LocalizedString(u"figure"_ns);
if (mRole == roles::HEADING) return utils::LocalizedString(u"heading"_ns);

View File

@ -58,104 +58,9 @@ addAccessibleTask(
"group",
"Root group is a document element"
);
// Adding an 'application' role to the body should
// create a root group with an application subrole.
let evt = waitForMacEvent("AXMozRoleChanged");
await SpecialPowers.spawn(browser, [], () => {
content.document.body.setAttribute("role", "application");
});
await evt;
is(
doc.getAttributeValue("AXRole"),
"AXWebArea",
"doc still has web area role"
);
is(
doc.getAttributeValue("AXRoleDescription"),
"HTML Content",
"doc has correct role description"
);
ok(
!doc.attributeNames.includes("AXSubrole"),
"sub role not available on web area"
);
rootGroup = doc.getAttributeValue("AXChildren")[0];
is(
rootGroup.getAttributeValue("AXIdentifier"),
"root-group",
"Is generated root group"
);
is(
rootGroup.getAttributeValue("AXRole"),
"AXGroup",
"root group has AXGroup role"
);
is(
rootGroup.getAttributeValue("AXSubrole"),
"AXLandmarkApplication",
"root group has application subrole"
);
is(
rootGroup.getAttributeValue("AXRoleDescription"),
"application",
"root group has application role description"
);
}
);
/**
* Test document with body[role=application] and a top-level group
*/
addAccessibleTask(
`<div role="grouping" id="group"><p>hello</p><p>world</p></div>`,
async (browser, accDoc) => {
let doc = accDoc.nativeInterface.QueryInterface(
Ci.nsIAccessibleMacInterface
);
is(
doc.getAttributeValue("AXRole"),
"AXWebArea",
"doc still has web area role"
);
is(
doc.getAttributeValue("AXRoleDescription"),
"HTML Content",
"doc has correct role description"
);
ok(
!doc.attributeNames.includes("AXSubrole"),
"sub role not available on web area"
);
let rootGroup = doc.getAttributeValue("AXChildren")[0];
is(
rootGroup.getAttributeValue("AXIdentifier"),
"root-group",
"Is generated root group"
);
is(
rootGroup.getAttributeValue("AXRole"),
"AXGroup",
"root group has AXGroup role"
);
is(
rootGroup.getAttributeValue("AXSubrole"),
"AXLandmarkApplication",
"root group has application subrole"
);
is(
rootGroup.getAttributeValue("AXRoleDescription"),
"application",
"root group has application role description"
);
},
{ contentDocBodyAttrs: { role: "application" } }
);
/**
* Test document with a single button
*/