Title: [97769] trunk
Revision
97769
Author
[email protected]
Date
2011-10-18 10:06:52 -0700 (Tue, 18 Oct 2011)

Log Message

AX: buttons of number type <input> controls are not fully accessible
https://bugs.webkit.org/show_bug.cgi?id=70241

Source/WebCore: 

Staged commit, part 6.

Reviewed by Darin Adler.

Test: platform/mac/accessibility/html5-input-number.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::addImageMapChildren):
(WebCore::AccessibilityRenderObject::addTextFieldChildren):
(WebCore::AccessibilityRenderObject::addChildren):
* accessibility/AccessibilityRenderObject.h:

LayoutTests: 

Reviewed by Darin Adler.

* platform/mac/accessibility/html5-input-number-expected.txt: Added.
* platform/mac/accessibility/html5-input-number.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97768 => 97769)


--- trunk/LayoutTests/ChangeLog	2011-10-18 17:04:32 UTC (rev 97768)
+++ trunk/LayoutTests/ChangeLog	2011-10-18 17:06:52 UTC (rev 97769)
@@ -1,3 +1,13 @@
+2011-10-18  Chris Fleizach  <[email protected]>
+
+        AX: buttons of number type <input> controls are not fully accessible
+        https://bugs.webkit.org/show_bug.cgi?id=70241
+
+        Reviewed by Darin Adler.
+
+        * platform/mac/accessibility/html5-input-number-expected.txt: Added.
+        * platform/mac/accessibility/html5-input-number.html: Added.
+
 2011-10-18  Gavin Barraclough  <[email protected]>
 
         Indexed arguments on the Arguments object should be enumerable.

Added: trunk/LayoutTests/platform/mac/accessibility/html5-input-number-expected.txt (0 => 97769)


--- trunk/LayoutTests/platform/mac/accessibility/html5-input-number-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/html5-input-number-expected.txt	2011-10-18 17:06:52 UTC (rev 97769)
@@ -0,0 +1,25 @@
+
+This tests that input type='number' exposes the accessibility of it's stepper correctly
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS textfield.childrenCount is 1
+PASS incrementor.role is 'AXRole: AXIncrementor'
+PASS incrementor.width > 0 is true
+PASS incrementor.height > 0 is true
+PASS incrementor.childrenCount is 2
+PASS incrementor.childAtIndex(0).role is 'AXRole: AXButton'
+PASS incrementor.childAtIndex(0).subrole is 'AXSubrole: AXIncrementArrow'
+PASS incrementor.childAtIndex(0).width > 0 is true
+PASS incrementor.childAtIndex(0).height > 0 is true
+PASS textfield.stringValue is 'AXValue: 1'
+PASS incrementor.childAtIndex(1).role is 'AXRole: AXButton'
+PASS incrementor.childAtIndex(1).subrole is 'AXSubrole: AXDecrementArrow'
+PASS incrementor.childAtIndex(1).width > 0 is true
+PASS incrementor.childAtIndex(1).height > 0 is true
+PASS textfield.stringValue is 'AXValue: 0'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/html5-input-number.html (0 => 97769)


--- trunk/LayoutTests/platform/mac/accessibility/html5-input-number.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/html5-input-number.html	2011-10-18 17:06:52 UTC (rev 97769)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<form>
+<input id="number" type="number"><br>
+</form>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that input type='number' exposes the accessibility of it's stepper correctly");
+
+    if (window.accessibilityController) {
+
+        document.getElementById("number").focus();
+        var textfield = accessibilityController.focusedElement;
+
+        // Verify that the click point is the same as the child.
+        shouldBe("textfield.childrenCount", "1");
+
+        var incrementor = textfield.childAtIndex(0);
+
+        shouldBe("incrementor.role", "'AXRole: AXIncrementor'");
+        shouldBeTrue("incrementor.width > 0");
+        shouldBeTrue("incrementor.height > 0");
+        shouldBe("incrementor.childrenCount", "2");
+
+        shouldBe("incrementor.childAtIndex(0).role", "'AXRole: AXButton'");
+        shouldBe("incrementor.childAtIndex(0).subrole", "'AXSubrole: AXIncrementArrow'");
+        shouldBeTrue("incrementor.childAtIndex(0).width > 0");
+        shouldBeTrue("incrementor.childAtIndex(0).height > 0");
+
+        // Increment.
+        incrementor.childAtIndex(0).press();
+        shouldBe("textfield.stringValue", "'AXValue: 1'");
+
+        shouldBe("incrementor.childAtIndex(1).role", "'AXRole: AXButton'");
+        shouldBe("incrementor.childAtIndex(1).subrole", "'AXSubrole: AXDecrementArrow'");
+        shouldBeTrue("incrementor.childAtIndex(1).width > 0");
+        shouldBeTrue("incrementor.childAtIndex(1).height > 0");
+
+        // Decrement.
+        incrementor.childAtIndex(1).press();
+        shouldBe("textfield.stringValue", "'AXValue: 0'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (97768 => 97769)


--- trunk/Source/WebCore/ChangeLog	2011-10-18 17:04:32 UTC (rev 97768)
+++ trunk/Source/WebCore/ChangeLog	2011-10-18 17:06:52 UTC (rev 97769)
@@ -1,3 +1,20 @@
+2011-10-18  Chris Fleizach  <[email protected]>
+
+        AX: buttons of number type <input> controls are not fully accessible
+        https://bugs.webkit.org/show_bug.cgi?id=70241
+
+        Staged commit, part 6.
+
+        Reviewed by Darin Adler.
+
+        Test: platform/mac/accessibility/html5-input-number.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::addImageMapChildren):
+        (WebCore::AccessibilityRenderObject::addTextFieldChildren):
+        (WebCore::AccessibilityRenderObject::addChildren):
+        * accessibility/AccessibilityRenderObject.h:
+
 2011-10-18  Nate Chapin  <[email protected]>
 
         Make DocumentThreadableLoader a CachedResourceClient.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (97768 => 97769)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-10-18 17:04:32 UTC (rev 97768)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-10-18 17:06:52 UTC (rev 97769)
@@ -3457,7 +3457,31 @@
     AccessibilityObject::clearChildren();
     m_childrenDirty = false;
 }
+
+void AccessibilityRenderObject::addImageMapChildren()
+{
+    RenderBoxModelObject* cssBox = renderBoxModelObject();
+    if (!cssBox || !cssBox->isRenderImage())
+        return;
     
+    HTMLMapElement* map = toRenderImage(cssBox)->imageMap();
+    if (!map)
+        return;
+
+    for (Node* current = map->firstChild(); current; current = current->traverseNextNode(map)) {
+        
+        // add an <area> element for this child if it has a link
+        if (current->hasTagName(areaTag) && current->isLink()) {
+            AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
+            areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(current));
+            areaObject->setHTMLMapElement(map);
+            areaObject->setParent(this);
+            
+            m_children.append(areaObject);
+        }
+    }
+}
+
 void AccessibilityRenderObject::updateChildrenIfNecessary()
 {
     if (needsToUpdateChildren())
@@ -3465,7 +3489,24 @@
     
     AccessibilityObject::updateChildrenIfNecessary();
 }
+    
+void AccessibilityRenderObject::addTextFieldChildren()
+{
+    Node* node = this->node();
+    if (!node || !node->hasTagName(inputTag))
+        return;
+    
+    HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
+    HTMLElement* spinButtonElement = input->innerSpinButtonElement();
+    if (!spinButtonElement || !spinButtonElement->isSpinButtonElement())
+        return;
 
+    AccessibilitySpinButton* axSpinButton = static_cast<AccessibilitySpinButton*>(axObjectCache()->getOrCreate(SpinButtonRole));
+    axSpinButton->setSpinButtonElement(static_cast<SpinButtonElement*>(spinButtonElement));
+    axSpinButton->setParent(this);
+    m_children.append(axSpinButton);
+}
+
 void AccessibilityRenderObject::addChildren()
 {
     // If the need to add more children in addition to existing children arises, 
@@ -3507,25 +3548,8 @@
             m_children.append(axObjectCache()->getOrCreate(widget));
     }
     
-    // for a RenderImage, add the <area> elements as individual accessibility objects
-    RenderBoxModelObject* cssBox = renderBoxModelObject();
-    if (cssBox && cssBox->isRenderImage()) {
-        HTMLMapElement* map = toRenderImage(cssBox)->imageMap();
-        if (map) {
-            for (Node* current = map->firstChild(); current; current = current->traverseNextNode(map)) {
-
-                // add an <area> element for this child if it has a link
-                if (current->hasTagName(areaTag) && current->isLink()) {
-                    AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
-                    areaObject->setHTMLAreaElement(static_cast<HTMLAreaElement*>(current));
-                    areaObject->setHTMLMapElement(map);
-                    areaObject->setParent(this);
-
-                    m_children.append(areaObject);
-                }
-            }
-        }
-    }
+    addImageMapChildren();
+    addTextFieldChildren();
 }
         
 const AtomicString& AccessibilityRenderObject::ariaLiveRegionStatus() const

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (97768 => 97769)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2011-10-18 17:04:32 UTC (rev 97768)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2011-10-18 17:06:52 UTC (rev 97769)
@@ -299,6 +299,9 @@
     bool renderObjectIsObservable(RenderObject*) const;
     RenderObject* renderParentObject() const;
     bool isDescendantOfElementType(const QualifiedName& tagName) const;
+
+    void addTextFieldChildren();
+    void addImageMapChildren();
     
     void ariaSelectedRows(AccessibilityChildrenVector&);
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to