Title: [92352] trunk
Revision
92352
Author
[email protected]
Date
2011-08-03 23:35:56 -0700 (Wed, 03 Aug 2011)

Log Message

An element with role=textbox should have settable AXValue unless read-only
https://bugs.webkit.org/show_bug.cgi?id=65664

Patch by Alice Boxhall <[email protected]> on 2011-08-03
Reviewed by Chris Fleizach.

Source/WebCore:

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::canSetValueAttribute):
Return true for non-native text field with aria-readonly not set.

LayoutTests:

* accessibility/aria-readonly-expected.txt:
* accessibility/aria-readonly.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92351 => 92352)


--- trunk/LayoutTests/ChangeLog	2011-08-04 06:08:47 UTC (rev 92351)
+++ trunk/LayoutTests/ChangeLog	2011-08-04 06:35:56 UTC (rev 92352)
@@ -1,3 +1,13 @@
+2011-08-03  Alice Boxhall  <[email protected]>
+
+        An element with role=textbox should have settable AXValue unless read-only
+        https://bugs.webkit.org/show_bug.cgi?id=65664
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-readonly-expected.txt:
+        * accessibility/aria-readonly.html:
+
 2011-08-03  Kentaro Hara  <[email protected]>
 
         Implement EventSender.scalePageBy()

Modified: trunk/LayoutTests/accessibility/aria-readonly-expected.txt (92351 => 92352)


--- trunk/LayoutTests/accessibility/aria-readonly-expected.txt	2011-08-04 06:08:47 UTC (rev 92351)
+++ trunk/LayoutTests/accessibility/aria-readonly-expected.txt	2011-08-04 06:35:56 UTC (rev 92352)
@@ -1,15 +1,17 @@
      
-This tests that the aria-readonly attribute works. The first and third text fields should not be writable.
+This tests that the AXValue property is correctly reported for native and non-native text boxes.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS succeeded is false
-PASS succeeded is true
-PASS succeeded is false
-PASS succeeded is true
-PASS succeeded is false
-PASS succeeded is true
+PASS ariaTextBoxIsWritable is true
+PASS ariaReadOnlyAriaTextBoxIsWritable is false
+PASS ariaReadOnlyTextFieldIsWritable is false
+PASS ariaNonReadOnlyTextFieldIsWritable is true
+PASS htmlReadOnlyTextFieldIsWritable is false
+PASS textFieldIsWritable is true
+PASS htmlReadOnlyTextAreaIsWritable is false
+PASS textAreaIsWritable is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/aria-readonly.html (92351 => 92352)


--- trunk/LayoutTests/accessibility/aria-readonly.html	2011-08-04 06:08:47 UTC (rev 92351)
+++ trunk/LayoutTests/accessibility/aria-readonly.html	2011-08-04 06:35:56 UTC (rev 92352)
@@ -8,46 +8,61 @@
 <script src=""
 </head>
 <body id="body">
-<input type="text" aria-readonly="true" size=20>
-<input type="text" aria-readonly="false" size=20>
-<input type="text" readonly="readonly" size=20>
-<input type="text" size=20>
-<textarea rows="2" cols="20" readonly="readonly"></textarea>
-<textarea rows="2" cols="20"></textarea>
+<div role="textbox" aria-readonly="false" aria-multiline="false" id="ariaTextBox" tabindex="0"></div>
+<div role="textbox" aria-readonly="true" id="ariaReadOnlyAriaTextBox" tabindex="0"></div>
+<input type="text" aria-readonly="true" id="ariaReadOnlyTextField" size=20>
+<input type="text" aria-readonly="false" id="ariaNonReadOnlyTextField" size=20>
+<input type="text" readonly="readonly" id="htmlReadOnlyTextField" size=20>
+<input type="text" id="textField" size=20>
+<textarea rows="2" cols="20" readonly="readonly" id="htmlReadOnlyTextArea"></textarea>
+<textarea rows="2" cols="20" id="textArea"></textarea>
 <p id="description"></p>
 <div id="console"></div>
 
 <script>
 
-    description("This tests that the aria-readonly attribute works. The first and third text fields should not be writable.");
+    description("This tests that the AXValue property is correctly reported for native and non-native text boxes.");
 
     if (window.accessibilityController) {
+          document.getElementById("ariaTextBox").focus();
+          var ariaTextBox = accessibilityController.focusedElement;
+          var ariaTextBoxIsWritable = ariaTextBox.isAttributeSettable("AXValue");
+          shouldBe("ariaTextBoxIsWritable", "true");
 
-          var body = document.getElementById("body");
-          body.focus();
-          var textField = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
-          var succeeded = textField.isAttributeSettable("AXValue");
-          shouldBe("succeeded", "false");
+          document.getElementById("ariaReadOnlyAriaTextBox").focus();
+          var ariaReadOnlyAriaTextBox = accessibilityController.focusedElement;
+          var ariaReadOnlyAriaTextBoxIsWritable = ariaReadOnlyAriaTextBox.isAttributeSettable("AXValue");
+          shouldBe("ariaReadOnlyAriaTextBoxIsWritable", "false");
 
-          textField = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(1);
-          succeeded = textField.isAttributeSettable("AXValue");
-          shouldBe("succeeded", "true");
-          
-          textField = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(2);
-          succeeded = textField.isAttributeSettable("AXValue");
-          shouldBe("succeeded", "false");
-            
-          textField = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(3);
-          succeeded = textField.isAttributeSettable("AXValue");
-          shouldBe("succeeded", "true");
-          
-          textField = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(4);
-          succeeded = textField.isAttributeSettable("AXValue");
-          shouldBe("succeeded", "false");
+          document.getElementById("ariaReadOnlyTextField").focus();
+          var ariaReadOnlyTextField = accessibilityController.focusedElement;
+          var ariaReadOnlyTextFieldIsWritable = ariaReadOnlyTextField.isAttributeSettable("AXValue");
+          shouldBe("ariaReadOnlyTextFieldIsWritable", "false");
 
-          textField = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(5);
-          succeeded = textField.isAttributeSettable("AXValue");
-          shouldBe("succeeded", "true");
+          document.getElementById("ariaNonReadOnlyTextField").focus();
+          var ariaNonReadOnlyTextField = accessibilityController.focusedElement;
+          var ariaNonReadOnlyTextFieldIsWritable = ariaNonReadOnlyTextField.isAttributeSettable("AXValue");
+          shouldBe("ariaNonReadOnlyTextFieldIsWritable", "true");
+
+          document.getElementById("htmlReadOnlyTextField").focus();
+          var htmlReadOnlyTextField = accessibilityController.focusedElement;
+          var htmlReadOnlyTextFieldIsWritable = htmlReadOnlyTextField.isAttributeSettable("AXValue");
+          shouldBe("htmlReadOnlyTextFieldIsWritable", "false");
+
+          document.getElementById("textField").focus();
+          var textField = accessibilityController.focusedElement;
+          var textFieldIsWritable = textField.isAttributeSettable("AXValue");
+          shouldBe("textFieldIsWritable", "true");
+
+          document.getElementById("htmlReadOnlyTextArea").focus();
+          var htmlReadOnlyTextArea = accessibilityController.focusedElement;
+          var htmlReadOnlyTextAreaIsWritable = htmlReadOnlyTextArea.isAttributeSettable("AXValue");
+          shouldBe("htmlReadOnlyTextAreaIsWritable", "false");
+
+          document.getElementById("textArea").focus();
+          var textArea = accessibilityController.focusedElement;
+          var textAreaIsWritable = textArea.isAttributeSettable("AXValue");
+          shouldBe("textAreaIsWritable", "true");
     }
 
     successfullyParsed = true;

Modified: trunk/Source/WebCore/ChangeLog (92351 => 92352)


--- trunk/Source/WebCore/ChangeLog	2011-08-04 06:08:47 UTC (rev 92351)
+++ trunk/Source/WebCore/ChangeLog	2011-08-04 06:35:56 UTC (rev 92352)
@@ -1,3 +1,14 @@
+2011-08-03  Alice Boxhall  <[email protected]>
+
+        An element with role=textbox should have settable AXValue unless read-only
+        https://bugs.webkit.org/show_bug.cgi?id=65664
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::canSetValueAttribute):
+        Return true for non-native text field with aria-readonly not set.
+
 2011-08-03  Luke Macpherson   <[email protected]>
 
         Clean up value clamping in CSSStyleSelector.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (92351 => 92352)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-08-04 06:08:47 UTC (rev 92351)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-08-04 06:35:56 UTC (rev 92352)
@@ -96,7 +96,7 @@
     , m_roleForMSAA(UnknownRole)
 {
     m_role = determineAccessibilityRole();
-    
+
 #ifndef NDEBUG
     m_renderer->setHasAXObject(true);
 #endif
@@ -653,7 +653,7 @@
         return false;
     return m_renderer->node() && static_cast<HTMLSelectElement*>(m_renderer->node())->multiple();
 }
-    
+
 bool AccessibilityRenderObject::isReadOnly() const
 {
     ASSERT(m_renderer);
@@ -3287,9 +3287,15 @@
     if (equalIgnoringCase(getAttribute(aria_readonlyAttr), "true"))
         return false;
 
+    if (isProgressIndicator() || isSlider())
+        return true;
+
+    if (isTextControl() && !isNativeTextControl())
+        return true;
+
     // Any node could be contenteditable, so isReadOnly should be relied upon
     // for this information for all elements.
-    return isProgressIndicator() || isSlider() || !isReadOnly();
+    return !isReadOnly();
 }
 
 bool AccessibilityRenderObject::canSetTextRangeAttributes() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to