AX: [ATK] Expose aria-busy via ATK_STATE_BUSY
authorjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Nov 2016 08:08:03 +0000 (08:08 +0000)
committerjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Nov 2016 08:08:03 +0000 (08:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164909

Reviewed by Chris Fleizach.

Source/WebCore:

Expose aria-busy via ATK_STATE_BUSY. Also rename ariaLiveRegionBusy()
to isBusy() because in ARIA 1.1 aria-busy is no longer limited to live
regions.

Test: accessibility/aria-busy.html

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isBusy):
(WebCore::AccessibilityObject::ariaLiveRegionBusy): Deleted.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isBusy):
(WebCore::AccessibilityRenderObject::ariaLiveRegionBusy): Deleted.
* accessibility/AccessibilityRenderObject.h:
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(setAtkStateSetFromCoreObject):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityARIAIsBusy]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

Tools:

Implement boolAttributeValue() for ATK so we can test AXElementBusy.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::boolAttributeValue):

LayoutTests:

* accessibility/aria-busy-expected.txt: Added.
* accessibility/aria-busy.html: Added.

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

13 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/aria-busy-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/aria-busy.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h
Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/inspector/InspectorDOMAgent.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

index d005d30..ec3c4cd 100644 (file)
@@ -1,3 +1,13 @@
+2016-11-19  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] Expose aria-busy via ATK_STATE_BUSY
+        https://bugs.webkit.org/show_bug.cgi?id=164909
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-busy-expected.txt: Added.
+        * accessibility/aria-busy.html: Added.
+
 2016-11-19  Ryosuke Niwa  <rniwa@webkit.org>
 
         REGRESSION(r200964): Tab focus navigation is broken on results.en.voyages-sncf.com
diff --git a/LayoutTests/accessibility/aria-busy-expected.txt b/LayoutTests/accessibility/aria-busy-expected.txt
new file mode 100644 (file)
index 0000000..7da9402
--- /dev/null
@@ -0,0 +1,11 @@
+This tests that the 'busy' state is exposed correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+listbox being populated is busy: true
+listbox already populated is busy: false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/aria-busy.html b/LayoutTests/accessibility/aria-busy.html
new file mode 100644 (file)
index 0000000..2ff73b0
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="../resources/accessibility-helper.js"></script>
+</head>
+<body>
+<div role="listbox" id="listbox1" aria-busy="true" aria-label="listbox being populated"></div>
+<div role="listbox" id="listbox2" aria-busy="false" aria-label="listbox already populated"></div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    description("This tests that the 'busy' state is exposed correctly.");
+    if (window.accessibilityController) {
+        var listbox = accessibilityController.accessibleElementById("listbox1");
+        debug(platformValueForW3CName(listbox) + " is busy: " + listbox.boolAttributeValue("AXElementBusy"))
+
+        listbox = accessibilityController.accessibleElementById("listbox2");
+        debug(platformValueForW3CName(listbox) + " is busy: " + listbox.boolAttributeValue("AXElementBusy"))
+    }
+</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index dc0c117..7ea2d74 100644 (file)
@@ -1,3 +1,32 @@
+2016-11-19  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] Expose aria-busy via ATK_STATE_BUSY
+        https://bugs.webkit.org/show_bug.cgi?id=164909
+
+        Reviewed by Chris Fleizach.
+
+        Expose aria-busy via ATK_STATE_BUSY. Also rename ariaLiveRegionBusy()
+        to isBusy() because in ARIA 1.1 aria-busy is no longer limited to live
+        regions.
+
+        Test: accessibility/aria-busy.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isBusy):
+        (WebCore::AccessibilityObject::ariaLiveRegionBusy): Deleted.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::isBusy):
+        (WebCore::AccessibilityRenderObject::ariaLiveRegionBusy): Deleted.
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (setAtkStateSetFromCoreObject):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityARIAIsBusy]):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
+
 2016-11-19  Ryosuke Niwa  <rniwa@webkit.org>
 
         REGRESSION(r200964): Tab focus navigation is broken on results.en.voyages-sncf.com
index daea0f5..4e8d8a1 100644 (file)
@@ -921,7 +921,7 @@ public:
     virtual const String ariaLiveRegionStatus() const { return String(); }
     virtual const AtomicString& ariaLiveRegionRelevant() const { return nullAtom; }
     virtual bool ariaLiveRegionAtomic() const { return false; }
-    virtual bool ariaLiveRegionBusy() const { return false; }
+    virtual bool isBusy() const { return false; }
     static const String defaultLiveRegionStatusForRole(AccessibilityRole);
     static bool liveRegionStatusIsEnabled(const AtomicString&);
     static bool contentEditableAttributeIsEnabled(Element*);
index 5ae068e..3e6b2c1 100644 (file)
@@ -3270,7 +3270,7 @@ bool AccessibilityRenderObject::ariaLiveRegionAtomic() const
     }
 }
 
-bool AccessibilityRenderObject::ariaLiveRegionBusy() const
+bool AccessibilityRenderObject::isBusy() const
 {
     return elementAttributeValue(aria_busyAttr);    
 }
index 196eaa8..b1cdf56 100644 (file)
@@ -273,7 +273,7 @@ private:
     const String ariaLiveRegionStatus() const override;
     const AtomicString& ariaLiveRegionRelevant() const override;
     bool ariaLiveRegionAtomic() const override;
-    bool ariaLiveRegionBusy() const override;
+    bool isBusy() const override;
 
     bool inheritsPresentationalRole() const override;
 
index c373aea..44bb1de 100644 (file)
@@ -750,6 +750,9 @@ static void setAtkStateSetFromCoreObject(AccessibilityObject* coreObject, AtkSta
     if (isListBoxOption && coreObject->isSelectedOptionActive())
         atk_state_set_add_state(stateSet, ATK_STATE_ACTIVE);
 
+    if (coreObject->isBusy())
+        atk_state_set_add_state(stateSet, ATK_STATE_BUSY);
+
 #if ATK_CHECK_VERSION(2,11,2)
     if (coreObject->supportsChecked() && coreObject->canSetValueAttribute())
         atk_state_set_add_state(stateSet, ATK_STATE_CHECKABLE);
index 1ab2099..ce8caf5 100644 (file)
@@ -2655,7 +2655,7 @@ static void AXAttributedStringAppendText(NSMutableAttributedString* attrString,
     if (![self _prepareAccessibilityCall])
         return NO;
 
-    return m_object->ariaLiveRegionBusy();
+    return m_object->isBusy();
 }
 
 - (NSString *)accessibilityARIALiveRegionStatus
index 31f019c..5871668 100644 (file)
@@ -3329,7 +3329,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if ([attributeName isEqualToString:NSAccessibilityARIAAtomicAttribute])
         return [NSNumber numberWithBool:m_object->ariaLiveRegionAtomic()];
     if ([attributeName isEqualToString:NSAccessibilityElementBusyAttribute])
-        return [NSNumber numberWithBool:m_object->ariaLiveRegionBusy()];
+        return [NSNumber numberWithBool:m_object->isBusy()];
     
     // MathML Attributes.
     if (m_object->isMathElement()) {
index 00fc642..83a024b 100644 (file)
@@ -1627,7 +1627,7 @@ RefPtr<Inspector::Protocol::DOM::AccessibilityProperties> InspectorDOMAgent::bui
             // An AX object is "busy" if it or any ancestor has aria-busy="true" set.
             AccessibilityObject* current = axObject;
             while (!busy && current) {
-                busy = current->ariaLiveRegionBusy();
+                busy = current->isBusy();
                 current = current->parentObject();
             }
 
index b2aca2f..61890ac 100644 (file)
@@ -1,3 +1,15 @@
+2016-11-19  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: [ATK] Expose aria-busy via ATK_STATE_BUSY
+        https://bugs.webkit.org/show_bug.cgi?id=164909
+
+        Reviewed by Chris Fleizach.
+
+        Implement boolAttributeValue() for ATK so we can test AXElementBusy.
+
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::boolAttributeValue):
+
 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
 
         [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
index 29c31c3..7ecf65a 100644 (file)
@@ -1048,7 +1048,31 @@ RefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementAttributeValue(J
 
 bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
 {
-    // FIXME: implement
+    if (!ATK_IS_OBJECT(m_element.get()))
+        return false;
+
+    String attributeString = jsStringToWTFString(attribute);
+    if (attributeString == "AXElementBusy")
+        return checkElementState(m_element.get(), ATK_STATE_BUSY);
+    if (attributeString == "AXChecked")
+        return checkElementState(m_element.get(), ATK_STATE_CHECKED);
+    if (attributeString == "AXEnabled")
+        return checkElementState(m_element.get(), ATK_STATE_ENABLED);
+    if (attributeString == "AXExpanded")
+        return checkElementState(m_element.get(), ATK_STATE_EXPANDED);
+    if (attributeString == "AXFocused")
+        return checkElementState(m_element.get(), ATK_STATE_FOCUSED);
+    if (attributeString == "AXInvalid")
+        return checkElementState(m_element.get(), ATK_STATE_INVALID);
+    if (attributeString == "AXMultiSelectable")
+        return checkElementState(m_element.get(), ATK_STATE_MULTISELECTABLE);
+    if (attributeString == "AXRequired")
+        return checkElementState(m_element.get(), ATK_STATE_REQUIRED);
+    if (attributeString == "AXSelected")
+        return checkElementState(m_element.get(), ATK_STATE_SELECTED);
+    if (attributeString == "AXVisited")
+        return checkElementState(m_element.get(), ATK_STATE_VISITED);
+
     return false;
 }