Skip to content

Commit

Permalink
Backed out changeset b9710246d416 (bug 1625870) for mochitest failure…
Browse files Browse the repository at this point in the history
…s at test_figure.html. CLOSED TREE
  • Loading branch information
cristianbrindusan committed Apr 28, 2020
1 parent 46fc6e8 commit ae12f8e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 68 deletions.
2 changes: 1 addition & 1 deletion accessible/base/RoleMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ ROLE(ENTRY,
ROLE(CAPTION,
"caption",
ATK_ROLE_CAPTION,
NSAccessibilityGroupRole,
NSAccessibilityStaticTextRole,
USE_ROLE_STRING,
IA2_ROLE_CAPTION,
java::SessionAccessibility::CLASSNAME_VIEW,
Expand Down
1 change: 0 additions & 1 deletion accessible/html/HTMLFormControlAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,6 @@ ENameValueFlag HTMLFigureAccessible::NativeName(nsString& aName) const {
if (captionContent)
nsTextEquivUtils::AppendTextEquivFromContent(this, captionContent, &aName);

aName.CompressWhitespace();
return eNameOK;
}

Expand Down
17 changes: 5 additions & 12 deletions accessible/mac/mozAccessible.mm
Original file line number Diff line number Diff line change
Expand Up @@ -601,13 +601,6 @@ - (NSString*)accessibilityActionDescription:(NSString*)action {
return NSAccessibilityActionDescription(action);
}

- (BOOL)providesLabelNotTitle {
// These accessible types are the exception to the rule of label vs. title:
// They may be named explicitly, but they still provide a label not a title.
return mRole == roles::GROUPING || mRole == roles::RADIO_GROUP || mRole == roles::FIGURE ||
mRole == roles::GRAPHIC;
}

- (NSString*)accessibilityLabel {
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
Expand All @@ -620,7 +613,7 @@ - (NSString*)accessibilityLabel {
/* If our accessible is:
* 1. Named by invisible text, or
* 2. Has more than one labeling relation, or
* 3. Is a special role defined in providesLabelNotTitle
* 3. Is a grouping
* ... return its name as a label (AXDescription).
*/
if (accWrap) {
Expand All @@ -629,7 +622,7 @@ - (NSString*)accessibilityLabel {
return nil;
}

if (![self providesLabelNotTitle]) {
if (mRole != roles::GROUPING && mRole != roles::RADIO_GROUP) {
Relation rel = accWrap->RelationByType(RelationType::LABELLED_BY);
if (rel.Next() && !rel.Next()) {
return nil;
Expand All @@ -641,7 +634,7 @@ - (NSString*)accessibilityLabel {
return nil;
}

if (![self providesLabelNotTitle]) {
if (mRole != roles::GROUPING && mRole != roles::RADIO_GROUP) {
nsTArray<ProxyAccessible*> rels = proxy->RelationByType(RelationType::LABELLED_BY);
if (rels.Length() == 1) {
return nil;
Expand Down Expand Up @@ -1135,8 +1128,8 @@ - (NSString*)roleDescription {
- (NSString*)title {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;

// In some special cases we provide the name in the label (AXDescription).
if ([self providesLabelNotTitle]) {
// If this is a grouping we provide the name in the label (AXDescription).
if (mRole == roles::GROUPING || mRole == roles::RADIO_GROUP) {
return nil;
}

Expand Down
54 changes: 0 additions & 54 deletions accessible/tests/browser/mac/browser_roles_elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,57 +27,3 @@ addAccessibleTask(`<hr id="hr" />`, (browser, accDoc) => {
"Subrole for hr is AXContentSeparator"
);
});

addAccessibleTask(
`
<figure id="figure">
<img id="img" src="http://example.com/a11y/accessible/tests/mochitest/moz.png" alt="Logo">
<p>Non-image figure content</p>
<figcaption id="figcaption">Old Mozilla logo</figcaption>
</figure>`,
(browser, accDoc) => {
let figure = getNativeInterface(accDoc, "figure");
ok(!figure.getAttributeValue("AXTitle"), "Figure should not have a title");
is(
figure.getAttributeValue("AXDescription"),
"Old Mozilla logo",
"Correct figure label"
);
is(figure.getAttributeValue("AXRole"), "AXGroup", "Correct figure role");
is(
figure.getAttributeValue("AXRoleDescription"),
"figure",
"Correct figure role description"
);

let img = getNativeInterface(accDoc, "img");
ok(!img.getAttributeValue("AXTitle"), "img should not have a title");
is(img.getAttributeValue("AXDescription"), "Logo", "Correct img label");
is(img.getAttributeValue("AXRole"), "AXImage", "Correct img role");
is(
img.getAttributeValue("AXRoleDescription"),
"image",
"Correct img role description"
);

let figcaption = getNativeInterface(accDoc, "figcaption");
ok(
!figcaption.getAttributeValue("AXTitle"),
"figcaption should not have a title"
);
ok(
!figcaption.getAttributeValue("AXDescription"),
"figcaption should not have a label"
);
is(
figcaption.getAttributeValue("AXRole"),
"AXGroup",
"Correct figcaption role"
);
is(
figcaption.getAttributeValue("AXRoleDescription"),
"group",
"Correct figcaption role description"
);
}
);

0 comments on commit ae12f8e

Please sign in to comment.