An element with role=textbox should have settable AXValue unless read-only
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2011 06:35:56 +0000 (06:35 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2011 06:35:56 +0000 (06:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=65664

Patch by Alice Boxhall <aboxhall@chromium.org> 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:

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

LayoutTests/ChangeLog
LayoutTests/accessibility/aria-readonly-expected.txt
LayoutTests/accessibility/aria-readonly.html
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp

index 56756cece9bd2106b7caa96ff099bea92397443e..829fc89c42eae557dc117e4ca9469a39c5a7d368 100644 (file)
@@ -1,3 +1,13 @@
+2011-08-03  Alice Boxhall  <aboxhall@chromium.org>
+
+        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  <haraken@google.com>
 
         Implement EventSender.scalePageBy()
index feadc063a02acb1cd809528162078df6b8e4951a..f4db404d5c8947015241abf5b73fa40d17677d1e 100644 (file)
@@ -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
index fa2175715fc8662a541f9e72910f3c8b0110dd6c..8b264ed20d8ea02f1db30c4cf169935a6a1cd6bd 100644 (file)
@@ -8,46 +8,61 @@ var successfullyParsed = false;
 <script src="../fast/js/resources/js-test-pre.js"></script>
 </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");
-
-          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");
-
-          textField = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(5);
-          succeeded = textField.isAttributeSettable("AXValue");
-          shouldBe("succeeded", "true");
+          document.getElementById("ariaReadOnlyAriaTextBox").focus();
+          var ariaReadOnlyAriaTextBox = accessibilityController.focusedElement;
+          var ariaReadOnlyAriaTextBoxIsWritable = ariaReadOnlyAriaTextBox.isAttributeSettable("AXValue");
+          shouldBe("ariaReadOnlyAriaTextBoxIsWritable", "false");
+
+          document.getElementById("ariaReadOnlyTextField").focus();
+          var ariaReadOnlyTextField = accessibilityController.focusedElement;
+          var ariaReadOnlyTextFieldIsWritable = ariaReadOnlyTextField.isAttributeSettable("AXValue");
+          shouldBe("ariaReadOnlyTextFieldIsWritable", "false");
+
+          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;
index bb16cfcb5b492682de36c5ecf52c06a4347a4c96..9c3821291050ec020a360183458db24fa3ebdbf3 100644 (file)
@@ -1,3 +1,14 @@
+2011-08-03  Alice Boxhall  <aboxhall@chromium.org>
+
+        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   <macpherson@chromium.org>
 
         Clean up value clamping in CSSStyleSelector.
index ca07bb69651870cf8161124274572d3a0f9330d0..9414d3ca9c0ad3e902080d2805e0eea2c872ec79 100644 (file)
@@ -96,7 +96,7 @@ AccessibilityRenderObject::AccessibilityRenderObject(RenderObject* renderer)
     , m_roleForMSAA(UnknownRole)
 {
     m_role = determineAccessibilityRole();
-    
+
 #ifndef NDEBUG
     m_renderer->setHasAXObject(true);
 #endif
@@ -653,7 +653,7 @@ bool AccessibilityRenderObject::isMultiSelectable() const
         return false;
     return m_renderer->node() && static_cast<HTMLSelectElement*>(m_renderer->node())->multiple();
 }
-    
+
 bool AccessibilityRenderObject::isReadOnly() const
 {
     ASSERT(m_renderer);
@@ -3287,9 +3287,15 @@ bool AccessibilityRenderObject::canSetValueAttribute() const
     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