Title: [273684] trunk
Revision
273684
Author
[email protected]
Date
2021-03-01 13:09:47 -0800 (Mon, 01 Mar 2021)

Log Message

WebAccessibilityObjectWrapper method to retrieve related error message elements should return not-ignored accessibility elements.
https://bugs.webkit.org/show_bug.cgi?id=222375

Reviewed by Chris Fleizach.

Source/WebCore:

Tests: accessibility/ios-simulator/aria-errormessage.html
       accessibility/mac/aria-errormessage.html

The iOS implementation of [WebAccessibilityObjectWrapper accessibilityErrorMessageElements]
was returning container elements that are not accessibility elements,
i.e., isAccessibilityElement return false. That caused that iOS clients could not get any info about the error messages.
With this patch, accessibilityErrorMessageElements drills down the
hierarchy of accessibility objects for the error message elements and
returns those descendants that are accessibility elements.

* accessibility/AccessibilityObjectInterface.h:
(WebCore::Accessibility::enumerateDescendants):
Hellper function to enumerate descendants of a given AX object.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityErrorMessageElements]):
Returns elements for which isAccessibilityElement == YES.

LayoutTests:

Replaced accessibility/aria-errormessage.html with mac and ios-simulator variants.

* accessibility/ios-simulator/aria-errormessage-expected.txt: Added.
* accessibility/ios-simulator/aria-errormessage.html: Copied from LayoutTests/accessibility/aria-errormessage.html.
* accessibility/mac/aria-errormessage-expected.txt: Renamed from LayoutTests/accessibility/aria-errormessage-expected.txt.
* accessibility/mac/aria-errormessage.html: Renamed from LayoutTests/accessibility/aria-errormessage.html.
* platform/glib/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (273683 => 273684)


--- trunk/LayoutTests/ChangeLog	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/LayoutTests/ChangeLog	2021-03-01 21:09:47 UTC (rev 273684)
@@ -1,3 +1,21 @@
+2021-03-01  Andres Gonzalez  <[email protected]>
+
+        WebAccessibilityObjectWrapper method to retrieve related error message elements should return not-ignored accessibility elements.
+        https://bugs.webkit.org/show_bug.cgi?id=222375
+
+        Reviewed by Chris Fleizach.
+
+        Replaced accessibility/aria-errormessage.html with mac and ios-simulator variants.
+
+        * accessibility/ios-simulator/aria-errormessage-expected.txt: Added.
+        * accessibility/ios-simulator/aria-errormessage.html: Copied from LayoutTests/accessibility/aria-errormessage.html.
+        * accessibility/mac/aria-errormessage-expected.txt: Renamed from LayoutTests/accessibility/aria-errormessage-expected.txt.
+        * accessibility/mac/aria-errormessage.html: Renamed from LayoutTests/accessibility/aria-errormessage.html.
+        * platform/glib/TestExpectations:
+        * platform/ios/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+        * platform/win/TestExpectations:
+
 2021-03-01  Sam Weinig  <[email protected]>
 
         Add experimental support for CSS Color 5 color-contrast()

Deleted: trunk/LayoutTests/accessibility/aria-errormessage-expected.txt (273683 => 273684)


--- trunk/LayoutTests/accessibility/aria-errormessage-expected.txt	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/LayoutTests/accessibility/aria-errormessage-expected.txt	2021-03-01 21:09:47 UTC (rev 273684)
@@ -1,13 +0,0 @@
-Please enter a start time for the meeting:
-This verifies the exposure of aria-errormessage.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS errorMessages.length is 2
-PASS errorMessages[0].domIdentifier is 'errorMessage1'
-PASS errorMessages[1].domIdentifier is 'errorMessage2'
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/accessibility/aria-errormessage.html (273683 => 273684)


--- trunk/LayoutTests/accessibility/aria-errormessage.html	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/LayoutTests/accessibility/aria-errormessage.html	2021-03-01 21:09:47 UTC (rev 273684)
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body>
-
-<label for="" enter a start time for the meeting: </label>
-<input aria-errormessage="errorMessage1 errorMessage2" id="startTime" type="text" value="" aria-invalid="false">
-<span id="errorMessage1" aria-live="off" style="visibility:hidden">Invalid time!</span>
-<span id="errorMessage2" aria-live="off" style="visibility:hidden">The meeting time must be between 9:00 AM and 5:00 PM.</span>
-<input type="submit" id="submitButton">
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-    description("This verifies the exposure of aria-errormessage.");
-
-    if (window.accessibilityController) {
-        axStartTime = accessibilityController.accessibleElementById("startTime");
-        errorMessages = axStartTime.errorMessageElements();
-        shouldBe("errorMessages.length", "2");
-        shouldBe("errorMessages[0].domIdentifier", "'errorMessage1'");
-        shouldBe("errorMessages[1].domIdentifier", "'errorMessage2'");
-    }
-</script>
-<script src=""
-</body>
-</html>

Added: trunk/LayoutTests/accessibility/ios-simulator/aria-errormessage-expected.txt (0 => 273684)


--- trunk/LayoutTests/accessibility/ios-simulator/aria-errormessage-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/aria-errormessage-expected.txt	2021-03-01 21:09:47 UTC (rev 273684)
@@ -0,0 +1,13 @@
+Please enter a start time for the meeting:   Invalid meeting time! The meeting time must be between 9:00 AM and 5:00 PM.
+This verifies the exposure of aria-errormessage.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS errorMessages.length is 2
+PASS errorMessages[0].description is 'AXLabel: Invalid meeting time!'
+PASS errorMessages[1].description is 'AXLabel: The meeting time must be between 9:00 AM and 5:00 PM.'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/accessibility/ios-simulator/aria-errormessage.html (from rev 273683, trunk/LayoutTests/accessibility/aria-errormessage.html) (0 => 273684)


--- trunk/LayoutTests/accessibility/ios-simulator/aria-errormessage.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/aria-errormessage.html	2021-03-01 21:09:47 UTC (rev 273684)
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<label for="" enter a start time for the meeting: </label>
+<input aria-errormessage="errorMessage1 errorMessage2" id="startTime" type="text" value="" aria-invalid="false">
+<span id="errorMessage1" aria-live="off" style="visibility:hidden">Invalid meeting time!</span>
+<span id="errorMessage2" aria-live="off" style="visibility:hidden">The meeting time must be between 9:00 AM and 5:00 PM.</span>
+<input type="submit" id="submitButton">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This verifies the exposure of aria-errormessage.");
+
+    if (window.accessibilityController) {
+        document.getElementById("errorMessage1").style.visibility = "visible";
+        document.getElementById("errorMessage2").style.visibility = "visible";
+
+        axStartTime = accessibilityController.accessibleElementById("startTime");
+        errorMessages = axStartTime.errorMessageElements();
+        shouldBe("errorMessages.length", "2");
+        shouldBe("errorMessages[0].description", "'AXLabel: Invalid meeting time!'");
+        shouldBe("errorMessages[1].description", "'AXLabel: The meeting time must be between 9:00 AM and 5:00 PM.'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Copied: trunk/LayoutTests/accessibility/mac/aria-errormessage-expected.txt (from rev 273683, trunk/LayoutTests/accessibility/aria-errormessage-expected.txt) (0 => 273684)


--- trunk/LayoutTests/accessibility/mac/aria-errormessage-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/aria-errormessage-expected.txt	2021-03-01 21:09:47 UTC (rev 273684)
@@ -0,0 +1,13 @@
+Please enter a start time for the meeting:
+This verifies the exposure of aria-errormessage.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS errorMessages.length is 2
+PASS errorMessages[0].domIdentifier is 'errorMessage1'
+PASS errorMessages[1].domIdentifier is 'errorMessage2'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/accessibility/mac/aria-errormessage.html (from rev 273683, trunk/LayoutTests/accessibility/aria-errormessage.html) (0 => 273684)


--- trunk/LayoutTests/accessibility/mac/aria-errormessage.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/aria-errormessage.html	2021-03-01 21:09:47 UTC (rev 273684)
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<label for="" enter a start time for the meeting: </label>
+<input aria-errormessage="errorMessage1 errorMessage2" id="startTime" type="text" value="" aria-invalid="false">
+<span id="errorMessage1" aria-live="off" style="visibility:hidden">Invalid meeting time!</span>
+<span id="errorMessage2" aria-live="off" style="visibility:hidden">The meeting time must be between 9:00 AM and 5:00 PM.</span>
+<input type="submit" id="submitButton">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This verifies the exposure of aria-errormessage.");
+
+    if (window.accessibilityController) {
+        axStartTime = accessibilityController.accessibleElementById("startTime");
+        errorMessages = axStartTime.errorMessageElements();
+        shouldBe("errorMessages.length", "2");
+        shouldBe("errorMessages[0].domIdentifier", "'errorMessage1'");
+        shouldBe("errorMessages[1].domIdentifier", "'errorMessage2'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/glib/TestExpectations (273683 => 273684)


--- trunk/LayoutTests/platform/glib/TestExpectations	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/LayoutTests/platform/glib/TestExpectations	2021-03-01 21:09:47 UTC (rev 273684)
@@ -299,7 +299,6 @@
 webkit.org/b/221645 accessibility/aria-sort-changed-notification.html [ Skip ]
 
 # Not supported
-accessibility/aria-errormessage.html [ Skip ]
 accessibility/embedded-image-description.html [ Skip ]
 
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/LayoutTests/platform/ios/TestExpectations (273683 => 273684)


--- trunk/LayoutTests/platform/ios/TestExpectations	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2021-03-01 21:09:47 UTC (rev 273684)
@@ -2167,7 +2167,6 @@
 webkit.org/b/149297 accessibility/aria-current.html [ Pass ]
 accessibility/aria-current-state-changed-notification.html [ Pass ]
 accessibility/aria-sort-changed-notification.html [ Pass ]
-accessibility/aria-errormessage.html [ Pass ]
 
 # Enable "aria-table-attributes" test for iOS
 webkit.org/b/150366 accessibility/aria-table-attributes.html [ Pass ]

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (273683 => 273684)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-03-01 21:09:47 UTC (rev 273684)
@@ -972,7 +972,7 @@
 accessibility/aria-current.html [ Skip ]
 accessibility/aria-sort-changed-notification.html [ Skip ]
 accessibility/aria-sort.html [ Skip ]
-accessibility/aria-errormessage.html [ Skip ]
+accessibility/mac/aria-errormessage.html [ Skip ]
 
 # <rdar://problem/61066929> [ Stress GC ] flaky JSC::ExceptionScope::assertNoException crash under WebCore::ReadableStreamDefaultController
 webkit.org/b/211923 imported/w3c/web-platform-tests/fetch/api/basic/stream-safe-creation.any.html [ Pass Crash ]
@@ -1254,4 +1254,4 @@
 
 webkit.org/b/221559 [ BigSur ] svg/canvas/canvas-global-alpha-svg.html [ Pass ImageOnlyFailure ]
 
-webkit.org/b/222493 [ BigSur ] platform/mac-bigsur/media/media-source/media-source-webm-vp8-malformed-header.html [ Skip ]
\ No newline at end of file
+webkit.org/b/222493 [ BigSur ] platform/mac-bigsur/media/media-source/media-source-webm-vp8-malformed-header.html [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (273683 => 273684)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-03-01 21:09:47 UTC (rev 273684)
@@ -1424,7 +1424,6 @@
 webkit.org/b/140798 [ Release ] accessibility/aria-sort.html [ Failure ]
 webkit.org/b/140798 [ Debug ] accessibility/aria-sort.html [ Skip ] # Debug assertion
 accessibility/aria-sort-changed-notification.html [ Skip ]
-accessibility/aria-errormessage.html [ Skip ]
 webkit.org/b/140798 [ Release ] accessibility/aria-tables.html [ Failure ]
 webkit.org/b/140798 [ Debug ] accessibility/aria-tables.html [ Skip ] # Debug assertion
 webkit.org/b/140798 [ Release ] accessibility/aria-text-role.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (273683 => 273684)


--- trunk/Source/WebCore/ChangeLog	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/Source/WebCore/ChangeLog	2021-03-01 21:09:47 UTC (rev 273684)
@@ -1,3 +1,27 @@
+2021-03-01  Andres Gonzalez  <[email protected]>
+
+        WebAccessibilityObjectWrapper method to retrieve related error message elements should return not-ignored accessibility elements.
+        https://bugs.webkit.org/show_bug.cgi?id=222375
+
+        Reviewed by Chris Fleizach.
+
+        Tests: accessibility/ios-simulator/aria-errormessage.html
+               accessibility/mac/aria-errormessage.html
+
+        The iOS implementation of [WebAccessibilityObjectWrapper accessibilityErrorMessageElements]
+        was returning container elements that are not accessibility elements,
+        i.e., isAccessibilityElement return false. That caused that iOS clients could not get any info about the error messages.
+        With this patch, accessibilityErrorMessageElements drills down the
+        hierarchy of accessibility objects for the error message elements and
+        returns those descendants that are accessibility elements.
+
+        * accessibility/AccessibilityObjectInterface.h:
+        (WebCore::Accessibility::enumerateDescendants):
+        Hellper function to enumerate descendants of a given AX object.
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityErrorMessageElements]):
+        Returns elements for which isAccessibilityElement == YES.
+
 2021-03-01  Sam Weinig  <[email protected]>
 
         Add experimental support for CSS Color 5 color-contrast()

Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (273683 => 273684)


--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-03-01 21:09:47 UTC (rev 273684)
@@ -1568,6 +1568,16 @@
 
 void findMatchingObjects(AccessibilitySearchCriteria const&, AXCoreObject::AccessibilityChildrenVector&);
 
+template<typename T, typename F>
+void enumerateDescendants(T& object, bool includeSelf, const F& lambda)
+{
+    if (includeSelf)
+        lambda(object);
+
+    for (const auto& child : object.children())
+        enumerateDescendants(*child, true, lambda);
+}
+
 template<typename U> inline void performFunctionOnMainThread(U&& lambda)
 {
     if (isMainThread())

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (273683 => 273684)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-03-01 20:56:56 UTC (rev 273683)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-03-01 21:09:47 UTC (rev 273684)
@@ -1870,10 +1870,19 @@
     if (![self _prepareAccessibilityCall])
         return nil;
 
-    AXCoreObject::AccessibilityChildrenVector axObjects;
-    self.axBackingObject->ariaErrorMessageElements(axObjects);
+    AXCoreObject::AccessibilityChildrenVector errorElements;
+    self.axBackingObject->ariaErrorMessageElements(errorElements);
 
-    return convertToNSArray(axObjects);
+    AXCoreObject::AccessibilityChildrenVector accessibleElements;
+    for (const auto& element : errorElements) {
+        ASSERT(element);
+        Accessibility::enumerateDescendants<AXCoreObject>(*element, true, [&accessibleElements] (AXCoreObject& descendant) {
+            if (descendant.wrapper().isAccessibilityElement)
+                accessibleElements.append(&descendant);
+        });
+    }
+
+    return convertToNSArray(accessibleElements);
 }
 
 - (id)accessibilityLinkedElement
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to