Permalink
Browse files

Bug 712924 - Part 2: Return the proper role description for definitio…

…n lists, with localization. r=surkov a=NPOTB
  • Loading branch information...
1 parent a4fa7cc commit 312f42c4240cb2b4a7f5f7e960daba11a5b3f64a @hfiguiere hfiguiere committed Apr 18, 2012
@@ -109,6 +109,9 @@ GetObjectOrRepresentedView(id <mozAccessible> aObject)
// the role might be "textfield", while the subrole is "password textfield".
- (NSString*)subrole;
+// Return the role description, as there are a few exceptions.
+- (NSString*)roleDescription;
+
// returns the native window we're inside.
- (NSWindow*)window;
@@ -225,13 +225,8 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
return [NSNumber numberWithBool:[self isEnabled]];
if ([attribute isEqualToString:NSAccessibilityValueAttribute])
return [self value];
- if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
- if (mRole == roles::DOCUMENT)
- return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
-
- return NSAccessibilityRoleDescription([self role], [self subrole]);
- }
-
+ if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute])
+ return [self roleDescription];
if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute])
return [self customDescription];
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
@@ -510,6 +505,21 @@ - (NSString*)subrole
return nil;
}
+- (NSString*)roleDescription
+{
+ if (mRole == roles::DOCUMENT)
+ return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
+
+ NSString* subrole = [self subrole];
+
+ if ((mRole == roles::LISTITEM) && [subrole isEqualToString:@"AXTerm"])
+ return utils::LocalizedString(NS_LITERAL_STRING("term"));
+ if ((mRole == roles::PARAGRAPH) && [subrole isEqualToString:@"AXDefinition"])
+ return utils::LocalizedString(NS_LITERAL_STRING("definition"));
+
+ return NSAccessibilityRoleDescription([self role], subrole);
+}
+
- (NSString*)title
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
@@ -18,3 +18,6 @@ cycle = Cycle
htmlContent = HTML Content
# The Role Description for the Tab button.
tab = tab
+# The Role Description for definition list dl, dt and dd
+term = term
+definition = definition

0 comments on commit 312f42c

Please sign in to comment.