Bug 712924 - Part 2: Return the proper role description for definition lists, with localization. r=surkov a=NPOTB

This commit is contained in:
Hub Figuière 2012-04-17 17:31:03 -07:00
Родитель fe51bbb269
Коммит 04fbf9baa7
3 изменённых файлов: 23 добавлений и 7 удалений

Просмотреть файл

@ -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 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
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 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
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