Reviewed by Adele.
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2006 18:07:03 +0000 (18:07 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2006 18:07:03 +0000 (18:07 +0000)
        <rdar://problem/4770453> VO not honoring secure edit fields in web pages

        * bridge/mac/WebCoreAXObject.mm:
        (-[WebCoreAXObject isPasswordField]):
        New. Checks for input with inputType() of PASSWORD.

        (-[WebCoreAXObject subrole]):
        Returns NSAccessibilitySecureTextFieldSubrole if [self isPasswordField].

        (-[WebCoreAXObject roleDescription]):
        Pass [self subrole] instead of nil when calling NSAccessibilityRoleDescription.

        (-[WebCoreAXObject value]):
        Return nil if [self isPasswordField].

        (-[WebCoreAXObject accessibilityAttributeNames]):
        Return generic attributes if [self isPasswordField].

        (-[WebCoreAXObject accessibilityParameterizedAttributeNames]):
        Return empty array if [self isPasswordField].

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bridge/mac/WebCoreAXObject.mm

index 490386cd23f1c5827343ca0efffd5536247e382d..7d354e2f153b45d47ddd1f83dec84f665a04f1b3 100644 (file)
@@ -1,3 +1,28 @@
+2006-10-17  David Harrison  <harrison@apple.com>
+
+        Reviewed by Adele.
+
+        <rdar://problem/4770453> VO not honoring secure edit fields in web pages
+
+        * bridge/mac/WebCoreAXObject.mm:
+        (-[WebCoreAXObject isPasswordField]):
+        New. Checks for input with inputType() of PASSWORD.
+        
+        (-[WebCoreAXObject subrole]):
+        Returns NSAccessibilitySecureTextFieldSubrole if [self isPasswordField].
+        
+        (-[WebCoreAXObject roleDescription]):
+        Pass [self subrole] instead of nil when calling NSAccessibilityRoleDescription.
+        
+        (-[WebCoreAXObject value]):
+        Return nil if [self isPasswordField].
+        
+        (-[WebCoreAXObject accessibilityAttributeNames]):
+        Return generic attributes if [self isPasswordField].
+
+        (-[WebCoreAXObject accessibilityParameterizedAttributeNames]):
+        Return empty array if [self isPasswordField].
+
 2006-10-17  David Hyatt  <hyatt@apple.com>
 
         Fix "flash to white' problem on yahoo.com as it finishes loading.  Refine the FOUC suppression
index 1acc0afcb72f283dfe9f15a8465cfb4f50e2b71d..038184cf6352f15d43f4b7a1b6a1b8e8dd879688 100644 (file)
@@ -288,11 +288,21 @@ using namespace HTMLNames;
 {
     return m_areaElement || (!m_renderer->isImage() && m_renderer->element() && m_renderer->element()->isLink());
 } 
+
 -(BOOL)isTextControl
 {
     return m_renderer->isTextField() || m_renderer->isTextArea();
 }
 
+-(BOOL)isPasswordField
+{
+    if (!m_renderer->element() || !m_renderer->element()->hasTagName(inputTag))
+        return false;
+    
+    HTMLInputElement* input = static_cast<HTMLInputElement*>(m_renderer->element());
+    return input->inputType() == HTMLInputElement::PASSWORD;
+}
+
 -(BOOL)isAttachment
 {
     // widgets are the replaced elements that we represent to AX as attachments
@@ -413,6 +423,9 @@ static int headingLevel(RenderObject* renderer)
 
 -(NSString*)subrole
 {
+    if ([self isPasswordField])
+        return NSAccessibilitySecureTextFieldSubrole;
+
     if ([self isAttachment])
         return [[self attachmentView] accessibilityAttributeValue:NSAccessibilitySubroleAttribute];
 
@@ -434,31 +447,31 @@ static int headingLevel(RenderObject* renderer)
     
     NSString* role = [self role];
     if ([role isEqualToString:NSAccessibilityButtonRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityButtonRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityButtonRole, [self subrole]);
     
     if ([role isEqualToString:NSAccessibilityPopUpButtonRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityPopUpButtonRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityPopUpButtonRole, [self subrole]);
    
     if ([role isEqualToString:NSAccessibilityStaticTextRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityStaticTextRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityStaticTextRole, [self subrole]);
 
     if ([role isEqualToString:NSAccessibilityImageRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityImageRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityImageRole, [self subrole]);
     
     if ([role isEqualToString:NSAccessibilityGroupRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, [self subrole]);
     
     if ([role isEqualToString:NSAccessibilityCheckBoxRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityCheckBoxRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityCheckBoxRole, [self subrole]);
         
     if ([role isEqualToString:NSAccessibilityRadioButtonRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityRadioButtonRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityRadioButtonRole, [self subrole]);
         
     if ([role isEqualToString:NSAccessibilityTextFieldRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityTextFieldRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityTextFieldRole, [self subrole]);
 
     if ([role isEqualToString:NSAccessibilityTextAreaRole])
-        return NSAccessibilityRoleDescription(NSAccessibilityTextAreaRole, nil);
+        return NSAccessibilityRoleDescription(NSAccessibilityTextAreaRole, [self subrole]);
 
     if ([role isEqualToString:@"AXWebArea"])
         return UI_STRING("web area", "accessibility role description for web area");
@@ -530,7 +543,7 @@ static int headingLevel(RenderObject* renderer)
 
 -(id)value
 {
-    if (!m_renderer || m_areaElement)
+    if (!m_renderer || m_areaElement || [self isPasswordField])
         return nil;
 
     if (m_renderer->isText())
@@ -813,12 +826,12 @@ static IntRect boundingBoxRect(RenderObject* obj)
         [tempArray release];
     }
     
-    if (!m_renderer)
+    if (!m_renderer || [self isPasswordField])
         return attributes;
 
     if ([self isWebArea])
         return webAreaAttrs;
-
+    
     if ([self isTextControl])
         return textAttrs;
 
@@ -1126,6 +1139,9 @@ static IntRect boundingBoxRect(RenderObject* obj)
         [tempArray release];
     }
     
+    if ([self isPasswordField])
+        return [NSArray array];
+    
     if (!m_renderer)
         return paramAttrs;