Title: [224093] releases/WebKitGTK/webkit-2.18
Revision
224093
Author
[email protected]
Date
2017-10-27 01:26:36 -0700 (Fri, 27 Oct 2017)

Log Message

Merge r223766 - AX: [ATK] Events missing and state incorrect for aria-activedescendant
https://bugs.webkit.org/show_bug.cgi?id=178523

Reviewed by Chris Fleizach.

Source/WebCore:

When the aria-activedescendant of an element changes, emit object:state-changed:focused.
When a focused element has a valid active descendant, do not expose the focused state on
the element, but rather on the active descendant. Also expose the focusable state on the
active descendant.

Tests: accessibility/gtk/aria-activedescendant-changed-notification.html
       accessibility/gtk/aria-activedescendant.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isActiveDescendantOfFocusedContainer const):
(WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(setAtkStateSetFromCoreObject):

LayoutTests:

* accessibility/gtk/aria-activedescendant-changed-notification-expected.txt: Added.
* accessibility/gtk/aria-activedescendant-changed-notification.html: Added.
* accessibility/gtk/aria-activedescendant-expected.txt: Added.
* accessibility/gtk/aria-activedescendant.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog (224092 => 224093)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-10-27 08:12:57 UTC (rev 224092)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/ChangeLog	2017-10-27 08:26:36 UTC (rev 224093)
@@ -1,3 +1,15 @@
+2017-10-20  Joanmarie Diggs  <[email protected]>
+
+        AX: [ATK] Events missing and state incorrect for aria-activedescendant
+        https://bugs.webkit.org/show_bug.cgi?id=178523
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/gtk/aria-activedescendant-changed-notification-expected.txt: Added.
+        * accessibility/gtk/aria-activedescendant-changed-notification.html: Added.
+        * accessibility/gtk/aria-activedescendant-expected.txt: Added.
+        * accessibility/gtk/aria-activedescendant.html: Added.
+
 2017-10-19  Antti Koivisto  <[email protected]>
 
         Overlapping text on all CSS fonts specs

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-changed-notification-expected.txt (0 => 224093)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-changed-notification-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-changed-notification-expected.txt	2017-10-27 08:26:36 UTC (rev 224093)
@@ -0,0 +1,15 @@
+This tests that changing the aria-activedescendant value results in a state-changed notification.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXFocusedUIElementChanged: AXRole: AXEmbedded
+AXFocusedUIElementChanged: AXRole: AXTextField
+AXFocusedUIElementChanged: AXRole: AXGroup
+AXFocusedUIElementChanged: AXRole: AXGroup
+AXFocusedUIElementChanged: AXRole: AXGroup
+AXFocusedUIElementChanged: AXRole: AXCheckBox
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-changed-notification.html (0 => 224093)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-changed-notification.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-changed-notification.html	2017-10-27 08:26:36 UTC (rev 224093)
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="content">
+  <div id="test1" tabindex="0" role="application">
+    <div id="child1" role="group">test</div>
+  </div>
+  <div id="test2" tabindex="0" role="searchbox">
+    <div id="child2" role="group">test</div>
+  </div>
+  <div id="test3" tabindex="0" role="group">
+    <div id="child3" role="checkbox">test</div>
+  </div>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+window.jsTestIsAsync = true;
+description("This tests that changing the aria-activedescendant value results in a state-changed notification.");
+
+if (window.testRunner && window.accessibilityController) {
+    accessibilityController.addNotificationListener(function(element, notification) {
+        if (notification != "AXFocusedUIElementChanged")
+            return;
+        debug(notification + ": " + element.role);
+    });
+
+    for (var i = 1; i <= 3; i++) {
+        var container = document.getElementById("test" + i);
+        container.focus();
+        container.setAttribute("aria-activedescendant", "child" + i);
+    }
+
+    document.getElementById("content").style.visibility = "hidden";
+
+    window.setTimeout(function() {
+        accessibilityController.removeNotificationListener();
+        finishJSTest();
+    }, 0);
+}
+</script>
+<script src=""
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-expected.txt (0 => 224093)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant-expected.txt	2017-10-27 08:26:36 UTC (rev 224093)
@@ -0,0 +1,33 @@
+This tests the exposure of aria-activedescendant
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+test1 descendant: ''
+parent AXRole: AXEmbedded, isFocusable: true, isFocused: true
+child1 AXRole: AXGroup, isFocusable: false, isFocused: false
+
+test2 descendant: 'child2'
+parent AXRole: AXEmbedded, isFocusable: true, isFocused: false
+child2 AXRole: AXGroup, isFocusable: true, isFocused: true
+
+test3 descendant: ''
+parent AXRole: AXTextField, isFocusable: true, isFocused: true
+child3 AXRole: AXGroup, isFocusable: false, isFocused: false
+
+test4 descendant: 'child4'
+parent AXRole: AXTextField, isFocusable: true, isFocused: false
+child4 AXRole: AXGroup, isFocusable: true, isFocused: true
+
+test5 descendant: ''
+parent AXRole: AXGroup, isFocusable: true, isFocused: true
+child5 AXRole: AXCheckBox, isFocusable: false, isFocused: false
+
+test6 descendant: 'child6'
+parent AXRole: AXCheckBox, isFocusable: true, isFocused: true
+child6 AXRole: AXCheckBox, isFocusable: true, isFocused: true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant.html (0 => 224093)


--- releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.18/LayoutTests/accessibility/gtk/aria-activedescendant.html	2017-10-27 08:26:36 UTC (rev 224093)
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+<div id="content">
+  <div id="test1" tabindex="0" aria-activedescendant="" role="application">
+    <div id="child1" role="group">test</div>
+  </div>
+  <div id="test2" tabindex="0" aria-activedescendant="child2" role="application">
+    <div id="child2" role="group">test</div>
+  </div>
+  <div id="test3" tabindex="0" aria-activedescendant="" role="searchbox">
+    <div id="child3" role="group">test</div>
+  </div>
+  <div id="test4" tabindex="0" aria-activedescendant="child4" role="searchbox">
+    <div id="child4" role="group">test</div>
+  </div>
+  <div id="test5" tabindex="0" aria-activedescendant="" role="group">
+    <div id="child5" role="checkbox">test</div>
+  </div>
+  <div id="test6" tabindex="0" aria-activedescendant="child6" role="group">
+    <div id="child6" role="checkbox">test</div>
+  </div>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    description("This tests the exposure of aria-activedescendant");
+    if (window.accessibilityController) {
+        for (var i = 1; i <= 6; i++) {
+            var container = document.getElementById("test" + i);
+            debug("\ntest" + i + " descendant: '" + container.getAttribute("aria-activedescendant") + "'");
+
+            container.focus();
+            var axContainer = accessibilityController.focusedElement;
+            debug("parent " + axContainer.role + ", " +
+	          "isFocusable: " + axContainer.isFocusable + ", " +
+                  "isFocused: " + axContainer.isFocused);
+
+            var axChild = accessibilityController.accessibleElementById("child" + i);
+            debug("child" + i + " " + axChild.role + ", " +
+                  "isFocusable: " + axChild.isFocusable + ", " +
+                  "isFocused: " + axChild.isFocused);
+        }
+
+        document.getElementById("content").style.visibility = "hidden";
+    }
+</script>
+<script src=""
+</body>
+</html>
+

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (224092 => 224093)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-27 08:12:57 UTC (rev 224092)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-27 08:26:36 UTC (rev 224093)
@@ -1,3 +1,29 @@
+2017-10-20  Joanmarie Diggs  <[email protected]>
+
+        AX: [ATK] Events missing and state incorrect for aria-activedescendant
+        https://bugs.webkit.org/show_bug.cgi?id=178523
+
+        Reviewed by Chris Fleizach.
+
+        When the aria-activedescendant of an element changes, emit object:state-changed:focused.
+        When a focused element has a valid active descendant, do not expose the focused state on
+        the element, but rather on the active descendant. Also expose the focusable state on the
+        active descendant.
+
+        Tests: accessibility/gtk/aria-activedescendant-changed-notification.html
+               accessibility/gtk/aria-activedescendant.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isActiveDescendantOfFocusedContainer const):
+        (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
+        * accessibility/atk/AXObjectCacheAtk.cpp:
+        (WebCore::AXObjectCache::postPlatformNotification):
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (setAtkStateSetFromCoreObject):
+
 2017-10-19  Antti Koivisto  <[email protected]>
 
         Overlapping text on all CSS fonts specs

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityObject.cpp (224092 => 224093)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityObject.cpp	2017-10-27 08:12:57 UTC (rev 224092)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityObject.cpp	2017-10-27 08:26:36 UTC (rev 224093)
@@ -3406,6 +3406,23 @@
     }
 }
 
+bool AccessibilityObject::isActiveDescendantOfFocusedContainer() const
+{
+    AccessibilityChildrenVector containers;
+    ariaActiveDescendantReferencingElements(containers);
+    for (auto& container : containers) {
+        if (container->isFocused())
+            return true;
+    }
+
+    return false;
+}
+
+void AccessibilityObject::ariaActiveDescendantReferencingElements(AccessibilityChildrenVector& containers) const
+{
+    ariaElementsReferencedByAttribute(containers, aria_activedescendantAttr);
+}
+
 void AccessibilityObject::ariaControlsElements(AccessibilityChildrenVector& ariaControls) const
 {
     ariaElementsFromAttribute(ariaControls, aria_controlsAttr);

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityObject.h (224092 => 224093)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityObject.h	2017-10-27 08:12:57 UTC (rev 224092)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityObject.h	2017-10-27 08:26:36 UTC (rev 224093)
@@ -669,6 +669,8 @@
     static bool isARIAInput(AccessibilityRole);
 
     virtual bool supportsARIAOwns() const { return false; }
+    bool isActiveDescendantOfFocusedContainer() const;
+    void ariaActiveDescendantReferencingElements(AccessibilityChildrenVector&) const;
     void ariaControlsElements(AccessibilityChildrenVector&) const;
     void ariaControlsReferencingElements(AccessibilityChildrenVector&) const;
     void ariaDescribedByElements(AccessibilityChildrenVector&) const;

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (224092 => 224093)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2017-10-27 08:12:57 UTC (rev 224092)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2017-10-27 08:26:36 UTC (rev 224093)
@@ -2391,6 +2391,11 @@
 
 bool AccessibilityRenderObject::shouldNotifyActiveDescendant() const
 {
+#if PLATFORM(GTK)
+    // According to the Core AAM spec, ATK expects object:state-changed:focused notifications
+    // whenever the active descendant changes.
+    return true;
+#endif
     // We want to notify that the combo box has changed its active descendant,
     // but we do not want to change the focus, because focus should remain with the combo box.
     if (isComboBox())

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp (224092 => 224093)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp	2017-10-27 08:12:57 UTC (rev 224092)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp	2017-10-27 08:26:36 UTC (rev 224093)
@@ -280,6 +280,11 @@
         atk_object_notify_state_change(axObject, ATK_STATE_REQUIRED, coreObject->isRequired());
         break;
 
+    case AXActiveDescendantChanged:
+        if (AccessibilityObject* descendant = coreObject->activeDescendant())
+            platformHandleFocusedUIElementChanged(nullptr, descendant->node());
+        break;
+
     default:
         break;
     }

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (224092 => 224093)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2017-10-27 08:12:57 UTC (rev 224092)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp	2017-10-27 08:26:36 UTC (rev 224093)
@@ -962,8 +962,15 @@
     if (coreObject->canSetFocusAttribute())
         atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE);
 
-    if (coreObject->isFocused() || isTextWithCaret(coreObject))
+    // According to the Core AAM, if the element which is focused has a valid aria-activedescendant,
+    // we should not expose the focused state on the element which is actually focused, but instead
+    // on its active descendant.
+    if ((coreObject->isFocused() && !coreObject->activeDescendant()) || isTextWithCaret(coreObject))
         atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED);
+    else if (coreObject->isActiveDescendantOfFocusedContainer()) {
+        atk_state_set_add_state(stateSet, ATK_STATE_FOCUSABLE);
+        atk_state_set_add_state(stateSet, ATK_STATE_FOCUSED);
+    }
 
     if (coreObject->orientation() == AccessibilityOrientationHorizontal)
         atk_state_set_add_state(stateSet, ATK_STATE_HORIZONTAL);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to