Title: [129036] trunk
Revision
129036
Author
[email protected]
Date
2012-09-19 12:55:19 -0700 (Wed, 19 Sep 2012)

Log Message

AX: A few control types are returning the wrong answer for isReadOnly
https://bugs.webkit.org/show_bug.cgi?id=96735

Reviewed by Chris Fleizach.

Source/WebCore:

All input types should be read-only except ones that
are text fields. The previous logic was marking things like
checkboxes as not read-only.

Tests: platform/chromium/accessibility/readonly.html
       platform/mac/accessibility/form-control-value-settable.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isReadOnly):

Tools:

Exposing isReadOnly in an AccessibilityObject to DumpRenderTree.

* DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
(AccessibilityUIElement::AccessibilityUIElement):
(AccessibilityUIElement::isReadOnlyGetterCallback):
* DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h:
(AccessibilityUIElement):

LayoutTests:

Adds a new test to make sure that readonly is exposed correctly on
all elements.

* platform/chromium/accessibility/readonly-expected.txt: Added.
* platform/chromium/accessibility/readonly.html: Added.
* platform/mac/accessibility/form-control-value-settable-expected.txt: Added.
* platform/mac/accessibility/form-control-value-settable.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129035 => 129036)


--- trunk/LayoutTests/ChangeLog	2012-09-19 19:49:45 UTC (rev 129035)
+++ trunk/LayoutTests/ChangeLog	2012-09-19 19:55:19 UTC (rev 129036)
@@ -1,3 +1,18 @@
+2012-09-19  Dominic Mazzoni  <[email protected]>
+
+        AX: A few control types are returning the wrong answer for isReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=96735
+
+        Reviewed by Chris Fleizach.
+
+        Adds a new test to make sure that readonly is exposed correctly on
+        all elements.
+
+        * platform/chromium/accessibility/readonly-expected.txt: Added.
+        * platform/chromium/accessibility/readonly.html: Added.
+        * platform/mac/accessibility/form-control-value-settable-expected.txt: Added.
+        * platform/mac/accessibility/form-control-value-settable.html: Added.
+
 2012-09-19  Nate Chapin  <[email protected]>
 
         Chromium gardening.

Added: trunk/LayoutTests/platform/chromium/accessibility/readonly-expected.txt (0 => 129036)


--- trunk/LayoutTests/platform/chromium/accessibility/readonly-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/accessibility/readonly-expected.txt	2012-09-19 19:55:19 UTC (rev 129036)
@@ -0,0 +1,89 @@
+Link  Button                 
+Focusable
+Heading
+
+ARIA button
+ARIA toggle button
+ARIA link
+Button
+This tests which elements expose themselves as readonly. Readonly here refers to whether the item is not editable, not whether a control value can be changed vs if it's unavailable.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+link1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+button1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+text1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is false
+
+checkbox1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+number1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is false
+
+radio1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+slider1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+submit1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+combobox1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+listbox1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+textarea1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is false
+
+focusable1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+heading1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+aria-button1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+aria-togglebutton1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+aria-link1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is true
+
+contenteditable_root1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is false
+
+contenteditable_button1
+PASS document.activeElement == element is true
+PASS axElement.isReadOnly is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/chromium/accessibility/readonly.html (0 => 129036)


--- trunk/LayoutTests/platform/chromium/accessibility/readonly.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/accessibility/readonly.html	2012-09-19 19:55:19 UTC (rev 129036)
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""
+
+<div>
+  <a id="link1" href=""
+  <button id="button1">Button</button>
+  <input id="text1" type="text" value="Value">
+  <input id="checkbox1" type="checkbox" checked>
+  <input id="number1" type="number" value="123">
+  <input id="radio1" type="radio" checked>
+  <input id="slider1" type="range" min="1" max="10" value="5">
+  <input id="submit1" type="submit">
+  <select id="combobox1"><option>1<option selected>2</select>
+  <select multiple id="listbox1"><option>1<option selected>2</select>
+  <textarea id="textarea1">Textarea</textarea>
+  <div id="focusable1" tabindex="0">Focusable</div>
+  <h5 id="heading1" tabindex="0">Heading</h5>
+  <div id="aria-button1" tabindex="0" role="button">ARIA button</div>
+  <div id="aria-togglebutton1" tabindex="0" role="button" aria-pressed="false">ARIA toggle button</div>
+  <div id="aria-link1" tabindex="0" role="link">ARIA link</div>
+  <div id="contenteditable_root1" contentEditable>
+    <button id="contenteditable_button1">Button</button>
+  </div>
+
+</div>
+
+<div id="console"></div>
+<script>
+description("This tests which elements expose themselves as readonly. Readonly here refers to whether the item is not editable, not whether a control value can be changed vs if it's unavailable.");
+
+if (window.testRunner && window.accessibilityController) {
+    window.testRunner.dumpAsText();
+
+    function check(id, expected_readonly) {
+        debug(id);
+        window.element = document.getElementById(id);
+        element.focus();
+        shouldBe("document.activeElement == element", "true");
+        window.axElement = accessibilityController.focusedElement;
+
+        shouldBe("axElement.isReadOnly", "" + expected_readonly);
+        debug("");
+    }
+
+    check("link1", true);
+    check("button1", true);
+    check("text1", false);
+    check("checkbox1", true);
+    check("number1", false);
+    check("radio1", true);
+    check("slider1", true);
+    check("submit1", true);
+    check("combobox1", true);
+    check("listbox1", true);
+    check("textarea1", false);
+    check("focusable1", true);
+    check("heading1", true);
+    check("aria-button1", true);
+    check("aria-togglebutton1", true);
+    check("aria-link1", true);
+    check("contenteditable_root1", false);
+    check("contenteditable_button1", false);
+}
+
+</script>
+
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac/accessibility/form-control-value-settable-expected.txt (0 => 129036)


--- trunk/LayoutTests/platform/mac/accessibility/form-control-value-settable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/form-control-value-settable-expected.txt	2012-09-19 19:55:19 UTC (rev 129036)
@@ -0,0 +1,74 @@
+                
+                
+This tests whether AXValue is writable for various form controls.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+text1
+PASS document.activeElement == element1 is true
+text2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is true
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+number1
+PASS document.activeElement == element1 is true
+number2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is true
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+textarea1
+PASS document.activeElement == element1 is true
+textarea2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is true
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+slider1
+PASS document.activeElement == element1 is true
+slider2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is true
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+checkbox1
+PASS document.activeElement == element1 is true
+checkbox2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is false
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+radio1
+PASS document.activeElement == element1 is true
+radio2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is false
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+submit1
+PASS document.activeElement == element1 is true
+submit2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is false
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+combobox1
+PASS document.activeElement == element1 is true
+combobox2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is false
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+listbox1
+PASS document.activeElement == element1 is true
+listbox2
+PASS document.activeElement == element2 is true
+PASS axElement1.isAttributeSettable('AXValue') is false
+PASS axElement2.isAttributeSettable('AXValue') is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/form-control-value-settable.html (0 => 129036)


--- trunk/LayoutTests/platform/mac/accessibility/form-control-value-settable.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/form-control-value-settable.html	2012-09-19 19:55:19 UTC (rev 129036)
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""
+
+<div>
+  <input id="text1" type="text" value="Value">
+  <input id="checkbox1" type="checkbox" checked>
+  <input id="number1" type="number" value="123">
+  <input id="radio1" type="radio" checked>
+  <input id="slider1" type="range" min="1" max="10" value="5">
+  <input id="submit1" type="submit">
+  <select id="combobox1"><option>1<option selected>2</select>
+  <select multiple id="listbox1"><option>1<option selected>2</select>
+  <textarea id="textarea1">Textarea</textarea>
+</div>
+
+<div contentEditable>
+  <input id="text2" type="text" value="Value">
+  <input id="checkbox2" type="checkbox" checked>
+  <input id="number2" type="number" value="123">
+  <input id="radio2" type="radio" checked>
+  <input id="slider2" type="range" min="1" max="10" value="5">
+  <input id="submit2" type="submit">
+  <select id="combobox2"><option>1<option selected>2</select>
+  <select multiple id="listbox2"><option>1<option selected>2</select>
+  <textarea id="textarea2">Textarea</textarea>
+</div>
+
+<div id="console"></div>
+<script>
+description("This tests whether AXValue is writable for various form controls.");
+
+if (window.testRunner && window.accessibilityController) {
+    window.testRunner.dumpAsText();
+
+    function check(id1, id2, expected1) {
+        debug(id1);
+        window.element1 = document.getElementById(id1);
+        element1.focus();
+        shouldBe("document.activeElement == element1", "true");
+        window.axElement1 = accessibilityController.focusedElement;
+
+        debug(id2);
+        window.element2 = document.getElementById(id2);
+        element2.focus();
+        shouldBe("document.activeElement == element2", "true");
+        window.axElement2 = accessibilityController.focusedElement;
+
+        shouldBe("axElement1.isAttributeSettable('AXValue')", String(expected1));
+        // If contentEditable, AXValue is always writable.
+        shouldBe("axElement2.isAttributeSettable('AXValue')", "true");
+        debug("");
+    }
+
+    // All text-like form controls should have a writable AXValue.
+    check("text1", "text2", true);
+    check("number1", "number2", true);
+    check("textarea1", "textarea2", true);
+
+    // A slider can set AXValue.
+    check("slider1", "slider2", true);
+
+    // Other form controls, even toggleable ones, should have a read-only AXValue -
+    // unless they're inside contentEditable, then everything should have writable AXValue.
+    check("checkbox1", "checkbox2", false);
+    check("radio1", "radio2", false);
+    check("submit1", "submit2", false);
+    check("combobox1", "combobox2", false);
+    check("listbox1", "listbox2", false);
+}
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (129035 => 129036)


--- trunk/Source/WebCore/ChangeLog	2012-09-19 19:49:45 UTC (rev 129035)
+++ trunk/Source/WebCore/ChangeLog	2012-09-19 19:55:19 UTC (rev 129036)
@@ -1,3 +1,20 @@
+2012-09-19  Dominic Mazzoni  <[email protected]>
+
+        AX: A few control types are returning the wrong answer for isReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=96735
+
+        Reviewed by Chris Fleizach.
+
+        All input types should be read-only except ones that
+        are text fields. The previous logic was marking things like
+        checkboxes as not read-only.
+
+        Tests: platform/chromium/accessibility/readonly.html
+               platform/mac/accessibility/form-control-value-settable.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::isReadOnly):
+
 2012-09-19  Mark Pilgrim  <[email protected]>
 
         [Chromium] Remove unused PlatformSupport reference in V8GCController

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (129035 => 129036)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2012-09-19 19:49:45 UTC (rev 129035)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2012-09-19 19:55:19 UTC (rev 129036)
@@ -634,8 +634,11 @@
     if (node->hasTagName(textareaTag))
         return static_cast<HTMLTextAreaElement*>(node)->readOnly();
 
-    if (node->hasTagName(inputTag))
-        return static_cast<HTMLInputElement*>(node)->readOnly();
+    if (node->hasTagName(inputTag)) {
+        HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
+        if (input->isTextField())
+            return input->readOnly();
+    }
 
     return !node->rendererIsEditable();
 }

Modified: trunk/Tools/ChangeLog (129035 => 129036)


--- trunk/Tools/ChangeLog	2012-09-19 19:49:45 UTC (rev 129035)
+++ trunk/Tools/ChangeLog	2012-09-19 19:55:19 UTC (rev 129036)
@@ -1,3 +1,18 @@
+2012-09-19  Dominic Mazzoni  <[email protected]>
+
+        AX: A few control types are returning the wrong answer for isReadOnly
+        https://bugs.webkit.org/show_bug.cgi?id=96735
+
+        Reviewed by Chris Fleizach.
+
+        Exposing isReadOnly in an AccessibilityObject to DumpRenderTree.
+
+        * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
+        (AccessibilityUIElement::AccessibilityUIElement):
+        (AccessibilityUIElement::isReadOnlyGetterCallback):
+        * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h:
+        (AccessibilityUIElement):
+
 2012-09-19  Sudarsana Nagineni  <[email protected]>
 
         [WTR] Memory leaks in TestRunner::deliverWebIntent()

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp (129035 => 129036)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp	2012-09-19 19:49:45 UTC (rev 129035)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp	2012-09-19 19:55:19 UTC (rev 129036)
@@ -348,6 +348,7 @@
     bindProperty("isCollapsed", &AccessibilityUIElement::isCollapsedGetterCallback);
     bindProperty("hasPopup", &AccessibilityUIElement::hasPopupGetterCallback);
     bindProperty("isValid", &AccessibilityUIElement::isValidGetterCallback);
+    bindProperty("isReadOnly", &AccessibilityUIElement::isReadOnlyGetterCallback);
     bindProperty("orientation", &AccessibilityUIElement::orientationGetterCallback);
 
     //
@@ -584,6 +585,11 @@
     result->set(!accessibilityObject().isDetached());
 }
 
+void AccessibilityUIElement::isReadOnlyGetterCallback(CppVariant* result)
+{
+    result->set(accessibilityObject().isReadOnly());
+}
+
 void AccessibilityUIElement::orientationGetterCallback(CppVariant* result)
 {
     result->set(getOrientation(accessibilityObject()));

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h (129035 => 129036)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h	2012-09-19 19:49:45 UTC (rev 129035)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h	2012-09-19 19:55:19 UTC (rev 129036)
@@ -90,6 +90,7 @@
     void isCollapsedGetterCallback(CppVariant*);
     void hasPopupGetterCallback(CppVariant*);
     void isValidGetterCallback(CppVariant*);
+    void isReadOnlyGetterCallback(CppVariant*);
     void orientationGetterCallback(CppVariant*);
 
     // Bound methods.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to