AX: Mac: Expose the visible text of a password field to AX
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Jan 2014 20:56:44 +0000 (20:56 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Jan 2014 20:56:44 +0000 (20:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127353

Reviewed by Brent Fulgham.

Source/WebCore:

The Mac platform should now expose the rendered value of password fields through AX.

Test: accessibility/password-field-value.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textLength):
(WebCore::AccessibilityRenderObject::passwordFieldValue):

LayoutTests:

* accessibility/password-field-value-expected.txt: Added.
* accessibility/password-field-value.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/password-field-value-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/password-field-value.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp

index 4c77885..c143d3c 100644 (file)
@@ -1,3 +1,13 @@
+2014-01-21  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Mac: Expose the visible text of a password field to AX
+        https://bugs.webkit.org/show_bug.cgi?id=127353
+
+        Reviewed by Brent Fulgham.
+
+        * accessibility/password-field-value-expected.txt: Added.
+        * accessibility/password-field-value.html: Added.
+
 2014-01-21  Tamas Gergely  <tgergely.u-szeged@partner.samsung.com>
 
         ASSERT(time.isFinite()) in SVGSMILElement::createInstanceTimesFromSyncbase
diff --git a/LayoutTests/accessibility/password-field-value-expected.txt b/LayoutTests/accessibility/password-field-value-expected.txt
new file mode 100644 (file)
index 0000000..247ef64
--- /dev/null
@@ -0,0 +1,11 @@
+
+This tests that the AX exposed value of a password field is the rendered text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Password field: AXValue: ••••
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/password-field-value.html b/LayoutTests/accessibility/password-field-value.html
new file mode 100644 (file)
index 0000000..f3a7adc
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<input type="password" id="pass" value="test">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that the AX exposed value of a password field is the rendered text.");
+
+    if (window.accessibilityController) {
+        debug("Password field: " + accessibilityController.accessibleElementById("pass").stringValue);
+    }
+    successfullyParsed = true;
+
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
index 18cc317..edaaf87 100644 (file)
@@ -1,3 +1,18 @@
+2014-01-21  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Mac: Expose the visible text of a password field to AX
+        https://bugs.webkit.org/show_bug.cgi?id=127353
+
+        Reviewed by Brent Fulgham.
+
+        The Mac platform should now expose the rendered value of password fields through AX.
+
+        Test: accessibility/password-field-value.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::textLength):
+        (WebCore::AccessibilityRenderObject::passwordFieldValue):
+
 2014-01-21  Robert Sipka  <sipka@inf.u-szeged.hu>
 
         Support SSL error handling in case of synchronous job.
index 1994551..92aeb66 100644 (file)
@@ -1393,11 +1393,7 @@ int AccessibilityRenderObject::textLength() const
     ASSERT(isTextControl());
     
     if (isPasswordField())
-#if PLATFORM(GTK)
         return passwordFieldValue().length();
-#else
-        return -1; // need to return something distinct from 0
-#endif
 
     return text().length();
 }
@@ -3359,7 +3355,6 @@ AccessibilityRole AccessibilityRenderObject::roleValueForMSAA() const
 
 String AccessibilityRenderObject::passwordFieldValue() const
 {
-#if PLATFORM(GTK)
     ASSERT(isPasswordField());
 
     // Look for the RenderText object in the RenderObject tree for this input field.
@@ -3371,11 +3366,7 @@ String AccessibilityRenderObject::passwordFieldValue() const
         return String();
 
     // Return the text that is actually being rendered in the input field.
-    return static_cast<RenderText*>(renderer)->textWithoutConvertingBackslashToYenSymbol();
-#else
-    // It seems only GTK is interested in this at the moment.
-    return String();
-#endif
+    return toRenderText(renderer)->textWithoutConvertingBackslashToYenSymbol();
 }
 
 ScrollableArea* AccessibilityRenderObject::getScrollableAreaIfScrollable() const