AX: Update AXPlaceHolder algorithm
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2016 20:11:50 +0000 (20:11 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2016 20:11:50 +0000 (20:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163229

Reviewed by Chris Fleizach.

Source/WebCore:

From https://w3c.github.io/html-aam/
When the placeholder and aria-placeholder attributes are both present, we
should expose the value of the placeholder attribute. Updated the algorithm
for that.

Changes are covered in the modified test.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::placeholderValue):

LayoutTests:

* accessibility/placeholder-expected.txt:
* accessibility/placeholder.html:

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

LayoutTests/ChangeLog
LayoutTests/accessibility/placeholder-expected.txt
LayoutTests/accessibility/placeholder.html
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp

index bb33bc5..3c8a46c 100644 (file)
@@ -1,3 +1,13 @@
+2016-10-10  Nan Wang  <n_wang@apple.com>
+
+        AX: Update AXPlaceHolder algorithm
+        https://bugs.webkit.org/show_bug.cgi?id=163229
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/placeholder-expected.txt:
+        * accessibility/placeholder.html:
+
 2016-10-10  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [DOMJIT] Implement Node accessors in DOMJIT
index f15bcf1..c03a26f 100644 (file)
@@ -1,5 +1,6 @@
    Birthday:
 03-14-1879
+
 This test makes sure that the placeholder is returned as the correct attribute
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -8,6 +9,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 PASS fieldElement.stringAttributeValue('AXPlaceholderValue') is 'search'
 PASS pass.stringAttributeValue('AXPlaceholderValue') is 'Password'
 PASS search.stringAttributeValue('AXPlaceholderValue') is 'MM-DD-YYYY'
+PASS input.stringAttributeValue('AXPlaceholderValue') is 'Fill in the blank'
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 4a66dae..47aa157 100644 (file)
@@ -12,6 +12,8 @@
     <span id="label">Birthday:</span>
     <div id="search" role="searchbox" aria-labelledby="label" aria-placeholder="MM-DD-YYYY">03-14-1879</div>
     
+    <input type="text" id="input" placeholder="Fill in the blank" aria-placeholder="aria placeholder">
+    
     <p id="description"></p>
     <div id="console"></div>
      
             
             var search = accessibilityController.accessibleElementById("search");
             shouldBe("search.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
-
+            
+            // When the placeholder and aria-placeholder attributes are both present, use the placeholder
+            // attribute's value.
+            var input = accessibilityController.accessibleElementById("input");
+            shouldBe("input.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
         }
     </script>
 
index 5420fd3..de1d3ce 100644 (file)
@@ -1,3 +1,20 @@
+2016-10-10  Nan Wang  <n_wang@apple.com>
+
+        AX: Update AXPlaceHolder algorithm
+        https://bugs.webkit.org/show_bug.cgi?id=163229
+
+        Reviewed by Chris Fleizach.
+
+        From https://w3c.github.io/html-aam/
+        When the placeholder and aria-placeholder attributes are both present, we
+        should expose the value of the placeholder attribute. Updated the algorithm
+        for that.
+
+        Changes are covered in the modified test.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::placeholderValue):
+
 2016-10-10  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [DOMJIT] Implement Node accessors in DOMJIT
index 8ceef87..a033100 100644 (file)
@@ -2280,14 +2280,14 @@ bool AccessibilityObject::isValueAutofilled() const
 
 const AtomicString& AccessibilityObject::placeholderValue() const
 {
-    const AtomicString& ariaPlaceholder = getAttribute(aria_placeholderAttr);
-    if (!ariaPlaceholder.isEmpty())
-        return ariaPlaceholder;
-    
     const AtomicString& placeholder = getAttribute(placeholderAttr);
     if (!placeholder.isEmpty())
         return placeholder;
     
+    const AtomicString& ariaPlaceholder = getAttribute(aria_placeholderAttr);
+    if (!ariaPlaceholder.isEmpty())
+        return ariaPlaceholder;
+    
     return nullAtom;
 }