[GTK] Layout test accessibility/aria-hidden-false-works-in-subtrees.html fails after...
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2019 08:25:36 +0000 (08:25 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2019 08:25:36 +0000 (08:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146718
<rdar://problem/21722487>

Reviewed by Joanmarie Diggs.

Source/WebCore:

Allow to get the text under element for nodes hidden in DOM but explicitly exposed to accessibility with
aria-hidden="false".

Fixes: accessibility/aria-hidden-false-works-in-subtrees.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::textUnderElement const):
* accessibility/atk/WebKitAccessible.cpp:
(roleIsTextType): Also consider ApplicationGroup role as text elements, so that <div>text</div> is equivalent to
<div role="roup">test</div>.

LayoutTests:

Update test to ATK behavior, rebaseline it and remove the expectations.

* accessibility/aria-hidden-false-works-in-subtrees.html:
* platform/gtk/TestExpectations:
* platform/gtk/accessibility/aria-hidden-false-works-in-subtrees-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/gtk/accessibility/aria-hidden-false-works-in-subtrees-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/atk/WebKitAccessible.cpp

index 81a74cc..6f03350 100644 (file)
@@ -1,3 +1,17 @@
+2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Layout test accessibility/aria-hidden-false-works-in-subtrees.html fails after r184890
+        https://bugs.webkit.org/show_bug.cgi?id=146718
+        <rdar://problem/21722487>
+
+        Reviewed by Joanmarie Diggs.
+
+        Update test to ATK behavior, rebaseline it and remove the expectations.
+
+        * accessibility/aria-hidden-false-works-in-subtrees.html:
+        * platform/gtk/TestExpectations:
+        * platform/gtk/accessibility/aria-hidden-false-works-in-subtrees-expected.txt:
+
 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         requestAnimationFrame should execute before the next frame
index d9637f8..c6c8f17 100644 (file)
@@ -2,6 +2,7 @@
 <html>
 <head>
 <script src="../resources/js-test-pre.js"></script>
+<script src="../resources/accessibility-helper.js"></script>
 </head>
 <body id="body">
 
@@ -84,7 +85,7 @@ text3
         }
         var indent = "";
         for (var k = 0; k < level; k++) { indent += "  "; }
-        debug(indent + element.role + "\n" + indent + element.description + "\n");
+        debug(indent + element.role + "\n" + indent + platformValueForW3CName(element, true) + "\n");
         var childrenCount = element.childrenCount;
         for (var k = 0; k < childrenCount; k++) {
             dumpAccessibilityChildren(element.childAtIndex(k), level+1);
@@ -98,16 +99,30 @@ text3
         dumpAccessibilityChildren(root, 0);
 
         // Text inside aria-hidden=false inherits from parent.
-        var object = accessibilityController.accessibleElementById("group3").childAtIndex(0);
-        shouldBe("object.role", "'AXRole: AXStaticText'");
+        var object;
+        if (accessibilityController.platformName == "atk") {
+            object = accessibilityController.accessibleElementById("group3");
+            shouldBe("object.role", "'AXRole: AXSection'");
+        } else {
+            object = accessibilityController.accessibleElementById("group3").childAtIndex(0);
+            shouldBe("object.role", "'AXRole: AXStaticText'");
+        }
         var stringValue = object.stringValue.replace(/\n/g, '');
         shouldBe("stringValue", "'AXValue: text3'");
 
         // Text inside nested aria-hidden=false inherits from parent.
-        object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0);
-        shouldBe("object.role", "'AXRole: AXStaticText'");
+        if (accessibilityController.platformName == "atk") {
+            object = accessibilityController.accessibleElementById("group4").childAtIndex(0);
+            shouldBe("object.role", "'AXRole: AXGroup'");
+        } else {
+            object = accessibilityController.accessibleElementById("group4").childAtIndex(0).childAtIndex(0);
+            shouldBe("object.role", "'AXRole: AXStaticText'");
+        }
         stringValue = object.stringValue.replace(/\n/g, '');
-        shouldBe("stringValue", "'AXValue:     text4  '");
+        if (accessibilityController.platformName == "atk")
+            shouldBe("stringValue", "'AXValue: text4'");
+        else
+            shouldBe("stringValue", "'AXValue:     text4  '");
 
         // When not all the parents have aria-hidden=false, element should not be visible.
         object = accessibilityController.accessibleElementById("group5").childAtIndex(0);
@@ -115,12 +130,18 @@ text3
 
         // Objects that don't have aria-hidden=false are not visible when the parents have that attribute.
         object = accessibilityController.accessibleElementById("group6").childAtIndex(0);
-        shouldBe("object.role", "'AXRole: AXGroup'");
+        if (accessibilityController.platformName == "atk")
+            shouldBe("object.role", "'AXRole: AXSection'");
+        else
+            shouldBe("object.role", "'AXRole: AXGroup'");
         shouldBe("object.childrenCount", "0");
 
         // When all objects have aria-hidden=false, then the elements are visible.
         object = accessibilityController.accessibleElementById("group7").childAtIndex(0);
-        shouldBe("object.role", "'AXRole: AXGroup'");
+        if (accessibilityController.platformName == "atk")
+            shouldBe("object.role", "'AXRole: AXSection'");
+        else
+            shouldBe("object.role", "'AXRole: AXGroup'");
         shouldBe("object.childrenCount", "1");
         shouldBe("object.childAtIndex(0).role", "'AXRole: AXButton'");
     }
index 6f210a9..0097f4c 100644 (file)
@@ -898,8 +898,6 @@ Bug(GTK) editing/spelling/markers.html [ Skip ]
 # Requires ENABLE(MEDIA_CAPTURE)
 webkit.org/b/85958 fast/forms/file/file-input-capture.html [ Failure ]
 
-webkit.org/b/146718 accessibility/aria-hidden-false-works-in-subtrees.html [ Failure ]
-
 webkit.org/b/146720 media/accessiblity-describes-video.html [ Failure ]
 
 webkit.org/b/146724 fast/text/word-break-keep-all.html [ ImageOnlyFailure ]
index d16b9e0..c43a5ec 100644 (file)
@@ -1,18 +1,27 @@
-
 This tests that a sub-tree within a node marked with aria-hidden=false will be exposed in the AX tree.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
 AXRole: AXSection
-AXDescription: group0
+AXTitle: group0
 
   AXRole: AXGroup
-  AXDescription: group2
+  AXTitle: group2
 
     AXRole: AXButton
-    AXDescription: button1
-
+    AXTitle: button1
+
+PASS object.role is 'AXRole: AXSection'
+PASS stringValue is 'AXValue: text3'
+PASS object.role is 'AXRole: AXGroup'
+PASS stringValue is 'AXValue: text4'
+PASS !object || !object.isValid is true
+PASS object.role is 'AXRole: AXSection'
+PASS object.childrenCount is 0
+PASS object.role is 'AXRole: AXSection'
+PASS object.childrenCount is 1
+PASS object.childAtIndex(0).role is 'AXRole: AXButton'
 Non-rendered iframe content should not be visible when aria-hidden=true. The first child should be a group and NOT static text.
 iFrame child role: AXRole: AXWebArea
 PASS successfullyParsed is true
index a02ae9d..8181786 100644 (file)
@@ -1,3 +1,22 @@
+2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Layout test accessibility/aria-hidden-false-works-in-subtrees.html fails after r184890
+        https://bugs.webkit.org/show_bug.cgi?id=146718
+        <rdar://problem/21722487>
+
+        Reviewed by Joanmarie Diggs.
+
+        Allow to get the text under element for nodes hidden in DOM but explicitly exposed to accessibility with
+        aria-hidden="false".
+
+        Fixes: accessibility/aria-hidden-false-works-in-subtrees.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::textUnderElement const):
+        * accessibility/atk/WebKitAccessible.cpp:
+        (roleIsTextType): Also consider ApplicationGroup role as text elements, so that <div>text</div> is equivalent to
+        <div role="roup">test</div>.
+
 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         requestAnimationFrame should execute before the next frame
index 4e00496..f81d84e 100644 (file)
@@ -1746,10 +1746,14 @@ String AccessibilityNodeObject::textUnderElement(AccessibilityTextUnderElementMo
     if (is<Text>(node))
         return downcast<Text>(*node).wholeText();
 
+    bool isAriaVisible = AccessibilityObject::matchedParent(*this, true, [] (const AccessibilityObject& object) {
+        return equalLettersIgnoringASCIICase(object.getAttribute(aria_hiddenAttr), "false");
+    }) != nullptr;
+
     // The Accname specification states that if the current node is hidden, and not directly
     // referenced by aria-labelledby or aria-describedby, and is not a host language text
     // alternative, the empty string should be returned.
-    if (isHidden() && !is<HTMLLabelElement>(node) && (node && !ancestorsOfType<HTMLCanvasElement>(*node).first())) {
+    if (isDOMHidden() && !isAriaVisible && !is<HTMLLabelElement>(node) && (node && !ancestorsOfType<HTMLCanvasElement>(*node).first())) {
         AccessibilityObject::AccessibilityChildrenVector labelFor;
         AccessibilityObject::AccessibilityChildrenVector descriptionFor;
         ariaLabelledByReferencingElements(labelFor);
index cce5170..ad386e9 100644 (file)
@@ -1181,7 +1181,8 @@ static bool roleIsTextType(AccessibilityRole role)
         || role == AccessibilityRole::Pre
         || role == AccessibilityRole::GridCell
         || role == AccessibilityRole::TextGroup
-        || role == AccessibilityRole::ApplicationTextGroup;
+        || role == AccessibilityRole::ApplicationTextGroup
+        || role == AccessibilityRole::ApplicationGroup;
 }
 
 static guint16 interfaceMaskFromObject(AccessibilityObject* coreObject)