Title: [203711] trunk
Revision
203711
Author
n_w...@apple.com
Date
2016-07-25 22:27:33 -0700 (Mon, 25 Jul 2016)

Log Message

AX: Expose autoFillButtonType to accessibility
https://bugs.webkit.org/show_bug.cgi?id=160179

Reviewed by Chris Fleizach.

Source/WebCore:

Added a new attribute on Mac to expose the auto-fill button type.

Changes are covered in modified test.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isValueAutofillAvailable):
(WebCore::AccessibilityObject::valueAutofillButtonType):
(WebCore::AccessibilityObject::isValueAutofilled):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::passwordFieldValue):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

* accessibility/auto-fill-types-expected.txt:
* accessibility/auto-fill-types.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203710 => 203711)


--- trunk/LayoutTests/ChangeLog	2016-07-26 03:04:23 UTC (rev 203710)
+++ trunk/LayoutTests/ChangeLog	2016-07-26 05:27:33 UTC (rev 203711)
@@ -1,3 +1,13 @@
+2016-07-25  Nan Wang  <n_w...@apple.com>
+
+        AX: Expose autoFillButtonType to accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=160179
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/auto-fill-types-expected.txt:
+        * accessibility/auto-fill-types.html:
+
 2016-07-25  Chris Dumez  <cdu...@apple.com>
 
         Touch properties should be on the prototype

Modified: trunk/LayoutTests/accessibility/auto-fill-types-expected.txt (203710 => 203711)


--- trunk/LayoutTests/accessibility/auto-fill-types-expected.txt	2016-07-26 03:04:23 UTC (rev 203710)
+++ trunk/LayoutTests/accessibility/auto-fill-types-expected.txt	2016-07-26 05:27:33 UTC (rev 203711)
@@ -5,10 +5,13 @@
 
 
 Initial auto-fill available: false
+Auto-fill type: none
 Contact button role: AXRole: AXButton
 Contact button label: AXDescription: contact info auto fill
+Auto-fill type: contacts
 Credentials button role: AXRole: AXButton
 Credentials button label: AXDescription: password auto fill
+Auto-fill type: credentials
 Post auto-fill available: true
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/accessibility/auto-fill-types.html (203710 => 203711)


--- trunk/LayoutTests/accessibility/auto-fill-types.html	2016-07-26 03:04:23 UTC (rev 203710)
+++ trunk/LayoutTests/accessibility/auto-fill-types.html	2016-07-26 05:27:33 UTC (rev 203711)
@@ -19,16 +19,19 @@
         var textField = document.getElementById("textfield");
         var axTextField = accessibilityController.accessibleElementById("textfield");
         debug("Initial auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
+        debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
 
         window.internals.setShowAutoFillButton(document.getElementById("textfield"), "AutoFillButtonTypeContacts");
         var contactsButton = axTextField.childAtIndex(1);
         debug("Contact button role: " + contactsButton.role);
         debug("Contact button label: " + contactsButton.description);
+        debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
 
         window.internals.setShowAutoFillButton(document.getElementById("textfield"), "AutoFillButtonTypeCredentials");
         var credentialsButton = axTextField.childAtIndex(1);
         debug("Credentials button role: " + credentialsButton.role);
         debug("Credentials button label: " + credentialsButton.description);
+        debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
 
         debug("Post auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
     }

Modified: trunk/Source/WebCore/ChangeLog (203710 => 203711)


--- trunk/Source/WebCore/ChangeLog	2016-07-26 03:04:23 UTC (rev 203710)
+++ trunk/Source/WebCore/ChangeLog	2016-07-26 05:27:33 UTC (rev 203711)
@@ -1,3 +1,23 @@
+2016-07-25  Nan Wang  <n_w...@apple.com>
+
+        AX: Expose autoFillButtonType to accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=160179
+
+        Reviewed by Chris Fleizach.
+
+        Added a new attribute on Mac to expose the auto-fill button type.
+
+        Changes are covered in modified test.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isValueAutofillAvailable):
+        (WebCore::AccessibilityObject::valueAutofillButtonType):
+        (WebCore::AccessibilityObject::isValueAutofilled):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::passwordFieldValue):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2016-07-25  Zalan Bujtas  <za...@apple.com>
 
         Cleanup RenderTable*::createAnonymous*

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (203710 => 203711)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-07-26 03:04:23 UTC (rev 203710)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-07-26 05:27:33 UTC (rev 203711)
@@ -2253,7 +2253,15 @@
     
     return downcast<HTMLInputElement>(*node).autoFillButtonType() != AutoFillButtonType::None;
 }
+
+AutoFillButtonType AccessibilityObject::valueAutofillButtonType() const
+{
+    if (!isValueAutofillAvailable())
+        return AutoFillButtonType::None;
     
+    return downcast<HTMLInputElement>(*this->node()).autoFillButtonType();
+}
+    
 bool AccessibilityObject::isValueAutofilled() const
 {
     if (!isNativeTextControl())

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (203710 => 203711)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2016-07-26 03:04:23 UTC (rev 203710)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2016-07-26 05:27:33 UTC (rev 203711)
@@ -31,6 +31,7 @@
 #define AccessibilityObject_h
 
 #include "FloatQuad.h"
+#include "HTMLTextFormControlElement.h"
 #include "LayoutRect.h"
 #include "Path.h"
 #include "Range.h"
@@ -904,6 +905,7 @@
     virtual String passwordFieldValue() const { return String(); }
     bool isValueAutofilled() const;
     bool isValueAutofillAvailable() const;
+    AutoFillButtonType valueAutofillButtonType() const;
     
     // Used by an ARIA tree to get all its rows.
     void ariaTreeRows(AccessibilityChildrenVector&);

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (203710 => 203711)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2016-07-26 03:04:23 UTC (rev 203710)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2016-07-26 05:27:33 UTC (rev 203711)
@@ -161,6 +161,10 @@
 #define NSAccessibilityValueAutofillAvailableAttribute @"AXValueAutofillAvailable"
 #endif
 
+#ifndef NSAccessibilityValueAutofillTypeAttribute
+#define NSAccessibilityValueAutofillTypeAttribute @"AXValueAutofillType"
+#endif
+
 #ifndef NSAccessibilityLanguageAttribute
 #define NSAccessibilityLanguageAttribute @"AXLanguage"
 #endif
@@ -3237,6 +3241,17 @@
     if ([attributeName isEqualToString:NSAccessibilityValueAutofillAvailableAttribute])
         return @(m_object->isValueAutofillAvailable());
     
+    if ([attributeName isEqualToString:NSAccessibilityValueAutofillTypeAttribute]) {
+        switch (m_object->valueAutofillButtonType()) {
+        case AutoFillButtonType::None:
+            return @"none";
+        case AutoFillButtonType::Credentials:
+            return @"credentials";
+        case AutoFillButtonType::Contacts:
+            return @"contacts";
+        }
+    }
+    
     if ([attributeName isEqualToString:NSAccessibilityValueAutofilledAttribute])
         return @(m_object->isValueAutofilled());
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to