2009-11-22 Chris Fleizach <cfleizach@apple.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2009 06:21:59 +0000 (06:21 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Nov 2009 06:21:59 +0000 (06:21 +0000)
        Reviewed by Oliver Hunt.

        ARIA: support aria-flowto
        https://bugs.webkit.org/show_bug.cgi?id=31762

        * platform/mac/accessibility/aria-flowto-expected.txt: Added.
        * platform/mac/accessibility/aria-flowto.html: Added.
2009-11-22  Chris Fleizach  <cfleizach@apple.com>

        Reviewed by Oliver Hunt.

        ARIA: support aria-flowto
        https://bugs.webkit.org/show_bug.cgi?id=31762

        Test: platform/mac/accessibility/aria-flowto.html

        * accessibility/AccessibilityObject.h:
        (WebCore::AccessibilityObject::ariaOwnsElements):
        (WebCore::AccessibilityObject::supportsARIAFlowTo):
        (WebCore::AccessibilityObject::ariaFlowToElements):
        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::linkedUIElements):
        (WebCore::AccessibilityRenderObject::supportsARIAFlowTo):
        (WebCore::AccessibilityRenderObject::ariaFlowToElements):
        * accessibility/AccessibilityRenderObject.h:
        * html/HTMLAttributeNames.in:
2009-11-22  Chris Fleizach  <cfleizach@apple.com>

        Reviewed by Oliver Hunt.

        ARIA: support aria-flowto
        https://bugs.webkit.org/show_bug.cgi?id=31762

        * DumpRenderTree/AccessibilityUIElement.cpp:
        (ariaFlowToElementAtIndexCallback):
        (AccessibilityUIElement::getJSClass):
        * DumpRenderTree/AccessibilityUIElement.h:
        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
        (AccessibilityUIElement::ariaFlowToElementAtIndex):
        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
        (AccessibilityUIElement::ariaFlowToElementAtIndex):
        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
        (AccessibilityUIElement::ariaFlowToElementAtIndex):

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/aria-flowto-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/aria-flowto.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/accessibility/AccessibilityObject.h
WebCore/accessibility/AccessibilityRenderObject.cpp
WebCore/accessibility/AccessibilityRenderObject.h
WebCore/html/HTMLAttributeNames.in
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
WebKitTools/DumpRenderTree/AccessibilityUIElement.h
WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

index b72866605b124473d12df535d4b38b93902b30d7..c91fb2bdc2387e568b2d759dd8a0e6d66c054cb7 100644 (file)
@@ -1,3 +1,13 @@
+2009-11-22  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        ARIA: support aria-flowto
+        https://bugs.webkit.org/show_bug.cgi?id=31762
+
+        * platform/mac/accessibility/aria-flowto-expected.txt: Added.
+        * platform/mac/accessibility/aria-flowto.html: Added.
+
 2009-11-22  Dirk Schulze  <krit@webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/platform/mac/accessibility/aria-flowto-expected.txt b/LayoutTests/platform/mac/accessibility/aria-flowto-expected.txt
new file mode 100644 (file)
index 0000000..770258d
--- /dev/null
@@ -0,0 +1,18 @@
+Item 1
+Item 2
+Item 3
+BUTTON
+RADIO BUTTON
+This tests that aria-flowto correctly identifies the right elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS item.ariaFlowToElementAtIndex(0).role is 'AXRole: AXButton'
+PASS item.ariaFlowToElementAtIndex(0).title is 'AXTitle: BUTTON'
+PASS item.ariaFlowToElementAtIndex(1).role is 'AXRole: AXRadioButton'
+PASS item.ariaFlowToElementAtIndex(1).title is 'AXTitle: RADIO BUTTON'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/aria-flowto.html b/LayoutTests/platform/mac/accessibility/aria-flowto.html
new file mode 100644 (file)
index 0000000..b525043
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div tabindex=0 id="item1" role="img" aria-flowto="extra extra2">Item 1</div>
+<div>Item 2</div>
+<div>Item 3</div>
+
+<div id="extra" role="button">BUTTON</div>
+<div id="extra2" role="radio">RADIO BUTTON</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that aria-flowto correctly identifies the right elements.");
+
+    if (window.accessibilityController) {
+
+          var item = document.getElementById("item1");
+          item.focus();
+          item = accessibilityController.focusedElement;
+          shouldBe("item.ariaFlowToElementAtIndex(0).role", "'AXRole: AXButton'");
+          shouldBe("item.ariaFlowToElementAtIndex(0).title", "'AXTitle: BUTTON'");
+          shouldBe("item.ariaFlowToElementAtIndex(1).role", "'AXRole: AXRadioButton'");
+          shouldBe("item.ariaFlowToElementAtIndex(1).title", "'AXTitle: RADIO BUTTON'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 33230d9c20d15cb44ab132ded16e12ec255ec446..9acaadfb51ffc060ab6e6bb4d2630d8c427decd4 100644 (file)
@@ -1,3 +1,23 @@
+2009-11-22  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        ARIA: support aria-flowto
+        https://bugs.webkit.org/show_bug.cgi?id=31762
+
+        Test: platform/mac/accessibility/aria-flowto.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::ariaOwnsElements):
+        (WebCore::AccessibilityObject::supportsARIAFlowTo):
+        (WebCore::AccessibilityObject::ariaFlowToElements):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::linkedUIElements):
+        (WebCore::AccessibilityRenderObject::supportsARIAFlowTo):
+        (WebCore::AccessibilityRenderObject::ariaFlowToElements):
+        * accessibility/AccessibilityRenderObject.h:
+        * html/HTMLAttributeNames.in:
+
 2009-11-22  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         Not reviewed. Build fix for WML enabled builds.
index 1613c1e57cd7b935479946d327f50a39fd3e5334..d456d37e27ef46ff5a6cefeec19a93dcf13e0230 100644 (file)
@@ -327,7 +327,9 @@ public:
     static bool isARIAControl(AccessibilityRole);
     static bool isARIAInput(AccessibilityRole);
     virtual bool supportsARIAOwns() const { return false; }
-    virtual void ariaOwnsElements(AccessibilityChildrenVector&) const { };
+    virtual void ariaOwnsElements(AccessibilityChildrenVector&) const { }
+    virtual bool supportsARIAFlowTo() const { return false; }
+    virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { }
     
     virtual AccessibilityObject* doAccessibilityHitTest(const IntPoint&) const { return 0; }
     virtual AccessibilityObject* focusedUIElement() const { return 0; }
index e12a1324c8a8c4902afd8276da919917354fcf97..41f155f056db5ebc7872184f8c77f78f79d0a802 100644 (file)
@@ -1263,6 +1263,8 @@ void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildren
 // or an internal anchor connection
 void AccessibilityRenderObject::linkedUIElements(AccessibilityChildrenVector& linkedUIElements) const
 {
+    ariaFlowToElements(linkedUIElements);
+
     if (isAnchor()) {
         AccessibilityObject* linkedAXElement = internalLinkElement();
         if (linkedAXElement)
@@ -1283,6 +1285,27 @@ bool AccessibilityRenderObject::hasTextAlternative() const
     return false;   
 }
     
+bool AccessibilityRenderObject::supportsARIAFlowTo() const
+{
+    return !getAttribute(aria_flowtoAttr).string().isEmpty();
+}
+    
+void AccessibilityRenderObject::ariaFlowToElements(AccessibilityChildrenVector& flowTo) const
+{
+    Vector<Element*> elements;
+    elementsFromAttribute(elements, aria_flowtoAttr);
+    
+    AXObjectCache* cache = axObjectCache();
+    unsigned count = elements.size();
+    for (unsigned k = 0; k < count; ++k) {
+        Element* element = elements[k];
+        AccessibilityObject* flowToElement = cache->getOrCreate(element->renderer());
+        if (flowToElement)
+            flowTo.append(flowToElement);
+    }
+        
+}
+    
 bool AccessibilityRenderObject::exposesTitleUIElement() const
 {
     if (!isControl())
index ff28865489d2f7b2dd07a8875f6456223848b716..859aee15110777d050c6e359ffd0a6d0f776025f 100644 (file)
@@ -219,7 +219,9 @@ public:
     virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const;
     virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const;
     virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const;
-    
+    virtual bool supportsARIAFlowTo() const;
+    virtual void ariaFlowToElements(AccessibilityChildrenVector&) const;
+
     virtual VisiblePosition visiblePositionForPoint(const IntPoint&) const;
     virtual VisiblePosition visiblePositionForIndex(unsigned indexValue, bool lastIndexOK) const;    
     virtual int index(const VisiblePosition&) const;
index 569532cef714d0abd10c258fd4f49fdd14bb3ab4..77164a5f6c8a97ff2215727cfb5c8a18a0f54c0f 100644 (file)
@@ -18,6 +18,7 @@ aria-controls
 aria-describedby
 aria-disabled
 aria-expanded
+aria-flowto
 aria-hidden
 aria-label
 aria-labeledby
index cea4188052ec809e7282ab41e0ea27c30257bc80..3215fe72c4dce552039cef347812a93d9ae439bb 100644 (file)
@@ -1,3 +1,21 @@
+2009-11-22  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        ARIA: support aria-flowto
+        https://bugs.webkit.org/show_bug.cgi?id=31762
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (ariaFlowToElementAtIndexCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+        (AccessibilityUIElement::ariaFlowToElementAtIndex):
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::ariaFlowToElementAtIndex):
+        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+        (AccessibilityUIElement::ariaFlowToElementAtIndex):
+
 2009-11-22  Antonio Gomes  <tonikitoo@webkit.org>
 
         Reviewed by Kenneth Christiansen.
index 1556fe0888d0304f1ca0c56b52feb8493ca0ece4..89889b44081561f7d00bb90de6d13e19b0c4f939 100644 (file)
@@ -179,6 +179,15 @@ static JSValueRef ariaOwnsElementAtIndexCallback(JSContextRef context, JSObjectR
     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaOwnsElementAtIndex(indexNumber));
 }
 
+static JSValueRef ariaFlowToElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    int indexNumber = 0;
+    if (argumentCount == 1)
+        indexNumber = JSValueToNumber(context, arguments[0], exception);
+    
+    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaFlowToElementAtIndex(indexNumber));
+}
+
 static JSValueRef selectedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     int indexNumber = 0;
@@ -542,6 +551,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "showMenu", showMenuCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "disclosedRowAtIndex", disclosedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "ariaOwnsElementAtIndex", ariaOwnsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "ariaFlowToElementAtIndex", ariaFlowToElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "selectedRowAtIndex", selectedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
index 827baf54d457668c4a969ed4cdefa913916771fd..9a7cf13067f5ffcc4f7ac041266330eb90670428 100644 (file)
@@ -133,6 +133,7 @@ public:
 
     // ARIA specific
     AccessibilityUIElement ariaOwnsElementAtIndex(unsigned);
+    AccessibilityUIElement ariaFlowToElementAtIndex(unsigned);
 
     // Parameterized attributes
     int lineForIndex(int);
index 171fe0724fe1287865c432245130ed25c77bdb49..3923d152734aaa5072032a7f28148cb850129850 100644 (file)
@@ -466,6 +466,11 @@ AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned i
     return 0;
 }
 
+AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
+{
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index)
 {
     return 0;
index 29f164fc10620d57966c6bafa1a43b6dfa044d7a..7de9ced095ba53d8f51ed57bf0051c5e12eab0db 100644 (file)
@@ -248,6 +248,15 @@ AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned i
     return 0;
 }
 
+AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
+{
+    NSArray* objects = [m_element accessibilityAttributeValue:NSAccessibilityLinkedUIElementsAttribute];
+    if (index < [objects count])
+        return [objects objectAtIndex:index];
+    
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
 {
     NSArray* rows = [m_element accessibilityAttributeValue:NSAccessibilityDisclosedRowsAttribute];
index 7abe68d3ce75c4fabf776934b6a1bcbaf89e726a..675b87b4ecc8f35ba4d46631f9cf12f988b0c790 100644 (file)
@@ -415,6 +415,11 @@ AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned i
     return 0;
 }
 
+AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
+{
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index)
 {
     return 0;