Bug 721001 - Instantiate the right class and set the proper subrole for password field. r=

This commit is contained in:
Hub Figuière 2012-04-12 11:02:25 -07:00
parent 894ca6a0ef
commit 6a9f5dc297
3 changed files with 10 additions and 3 deletions

View File

@ -232,7 +232,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
if (mRole == roles::DOCUMENT)
return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
return NSAccessibilityRoleDescription([self role], nil);
return NSAccessibilityRoleDescription([self role], [self subrole]);
}
if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute])

View File

@ -290,7 +290,9 @@ ToNSString(id aValue)
- (NSString*)subrole
{
// TODO: text accessibles have two different subroles in Cocoa: secure textfield (passwords) and search field
if(mRole == roles::PASSWORD_TEXT)
return NSAccessibilitySecureTextFieldSubrole;
return nil;
}
@ -347,7 +349,11 @@ ToNSString(id aValue)
{
if (!mGeckoTextAccessible)
return nil;
// A password text field returns an empty value
if (mRole == roles::PASSWORD_TEXT)
return @"";
nsAutoString text;
nsresult rv = mGeckoTextAccessible->
GetText(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text);

View File

@ -121,6 +121,7 @@ nsAccessibleWrap::GetNativeType ()
case roles::CAPTION:
case roles::ACCEL_LABEL:
case roles::TEXT_LEAF:
case roles::PASSWORD_TEXT:
// normal textfield (static or editable)
return [mozTextAccessible class];