Title: [275066] trunk
Revision
275066
Author
[email protected]
Date
2021-03-25 16:35:20 -0700 (Thu, 25 Mar 2021)

Log Message

AX: Consider implementing @aria-details.
https://bugs.webkit.org/show_bug.cgi?id=165842
rdar://30725491

Reviewed by Chris Fleizach.

Source/WebCore:

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

- Added [WebAccessibilityObjectWrapper accessibilityDetailsElements] on iOS.
- Added helper function accessibleElementsForObjects to retrieve platform-
specific accessible elements given a collection of AXCoreObjects.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(accessibleElementsForObjects):
(-[WebAccessibilityObjectWrapper accessibilityDetailsElements]):
(-[WebAccessibilityObjectWrapper accessibilityErrorMessageElements]):

Tools:

Added AccessibilityUIElement::detailsElements.

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::detailsElements const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::detailsElements const):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::detailsElements const):

LayoutTests:

* accessibility/ios-simulator/aria-details-expected.txt: Added.
* accessibility/ios-simulator/aria-details.html: Added.
* accessibility/mac/aria-details-expected.txt: Added.
* accessibility/mac/aria-details.html: Added.
* platform/mac-wk1/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275065 => 275066)


--- trunk/LayoutTests/ChangeLog	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/LayoutTests/ChangeLog	2021-03-25 23:35:20 UTC (rev 275066)
@@ -1,3 +1,17 @@
+2021-03-25  Andres Gonzalez  <[email protected]>
+
+        AX: Consider implementing @aria-details.
+        https://bugs.webkit.org/show_bug.cgi?id=165842
+        rdar://30725491
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/aria-details-expected.txt: Added.
+        * accessibility/ios-simulator/aria-details.html: Added.
+        * accessibility/mac/aria-details-expected.txt: Added.
+        * accessibility/mac/aria-details.html: Added.
+        * platform/mac-wk1/TestExpectations:
+
 2021-03-25  Cameron McCormack  <[email protected]>
 
         Collapse newly adjacent anonymous table cells when a table cell is detached from between them.

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


--- trunk/LayoutTests/accessibility/ios-simulator/aria-details-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/aria-details-expected.txt	2021-03-25 23:35:20 UTC (rev 275066)
@@ -0,0 +1,23 @@
+
+Details example
+The Pythagorean Theorem is a relationship in Euclidean Geometry between the three sides of a right triangle, where the square of the hypotenuse is the sum of the squares of the two opposing sides.
+
+The following drawing illustrates an application of the Pythagorean Theorem when used to construct a skateboard ramp.
+
+In this example you will notice a skateboard ramp with a base and vertical board whose width is the width of the ramp. To compute how long the ramp must be, simply calculate the base length, square it, sum it with the square of the height of the ramp, and take the square root of the sum.
+
+See an Application of the Pythagorean Theorem.
+
+This verifies the exposure of aria-details.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS details.length is 5
+PASS details[0].description is 'AXLabel: Details example'
+PASS details[2].description is 'AXLabel: The following drawing illustrates an application of the Pythagorean Theorem when used to construct a skateboard ramp.'
+PASS details[4].description is 'AXLabel: Application of the Pythagorean Theorem'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/ios-simulator/aria-details.html (0 => 275066)


--- trunk/LayoutTests/accessibility/ios-simulator/aria-details.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/aria-details.html	2021-03-25 23:35:20 UTC (rev 275066)
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<img id="image1" src="" alt="Pythagorean Theorem" aria-details="details1 details2">
+<details open id="details1">
+    <summary>Details example</summary>
+    <p>
+    The Pythagorean Theorem is a relationship in Euclidean Geometry between the three sides of
+    a right triangle, where the square of the hypotenuse is the sum of the squares of the two
+    opposing sides.
+    </p>
+    <p>
+    The following drawing illustrates an application of the Pythagorean Theorem when used to
+    construct a skateboard ramp.
+    </p>
+    <p>
+    In this example you will notice a skateboard ramp with a base and vertical board whose width
+    is the width of the ramp. To compute how long the ramp must be, simply calculate the
+    base length, square it, sum it with the square of the height of the ramp, and take the
+    square root of the sum.
+    </p>
+</details>
+<p>See an <a href="" id="details2">Application of the Pythagorean Theorem</a>.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This verifies the exposure of aria-details.");
+
+    if (window.accessibilityController) {
+        image1 = accessibilityController.accessibleElementById("image1");
+        details = image1.detailsElements();
+        shouldBe("details.length", "5");
+        shouldBe("details[0].description", "'AXLabel: Details example'");
+        shouldBe("details[2].description", "'AXLabel: The following drawing illustrates an application of the Pythagorean Theorem when used to construct a skateboard ramp.'");
+        shouldBe("details[4].description", "'AXLabel: Application of the Pythagorean Theorem'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/accessibility/mac/aria-details-expected.txt (0 => 275066)


--- trunk/LayoutTests/accessibility/mac/aria-details-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/aria-details-expected.txt	2021-03-25 23:35:20 UTC (rev 275066)
@@ -0,0 +1,21 @@
+
+The Pythagorean Theorem is a relationship in Euclidean Geometry between the three sides of a right triangle, where the square of the hypotenuse is the sum of the squares of the two opposing sides.
+
+The following drawing illustrates an application of the Pythagorean Theorem when used to construct a skateboard ramp.
+
+In this example you will notice a skateboard ramp with a base and vertical board whose width is the width of the ramp. To compute how long the ramp must be, simply calculate the base length, square it, sum it with the square of the height of the ramp, and take the square root of the sum.
+
+See an Application of the Pythagorean Theorem.
+
+This verifies the exposure of aria-details.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS details.length is 2
+PASS details[0].domIdentifier is 'details1'
+PASS details[1].domIdentifier is 'details2'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/aria-details.html (0 => 275066)


--- trunk/LayoutTests/accessibility/mac/aria-details.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/aria-details.html	2021-03-25 23:35:20 UTC (rev 275066)
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<img id="image1" src="" alt="Pythagorean Theorem" aria-details="details1 details2">
+<details open id="details1">
+  <p>
+    The Pythagorean Theorem is a relationship in Euclidean Geometry between the three sides of
+    a right triangle, where the square of the hypotenuse is the sum of the squares of the two
+    opposing sides.
+  </p>
+  <p>
+    The following drawing illustrates an application of the Pythagorean Theorem when used to
+    construct a skateboard ramp.
+  </p>
+  <p>
+    In this example you will notice a skateboard ramp with a base and vertical board whose width
+    is the width of the ramp. To compute how long the ramp must be, simply calculate the
+    base length, square it, sum it with the square of the height of the ramp, and take the
+    square root of the sum.
+  </p>
+</details>
+<p>See an <a href="" id="details2">Application of the Pythagorean Theorem</a>.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This verifies the exposure of aria-details.");
+
+    if (window.accessibilityController) {
+        image1 = accessibilityController.accessibleElementById("image1");
+        details = image1.detailsElements();
+        shouldBe("details.length", "2");
+        shouldBe("details[0].domIdentifier", "'details1'");
+        shouldBe("details[1].domIdentifier", "'details2'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (275065 => 275066)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-03-25 23:35:20 UTC (rev 275066)
@@ -958,6 +958,7 @@
 accessibility/aria-current.html [ Skip ]
 accessibility/aria-sort-changed-notification.html [ Skip ]
 accessibility/aria-sort.html [ Skip ]
+accessibility/mac/aria-details.html [ Skip ]
 accessibility/mac/aria-errormessage.html [ Skip ]
 
 # <rdar://problem/61066929> [ Stress GC ] flaky JSC::ExceptionScope::assertNoException crash under WebCore::ReadableStreamDefaultController
@@ -1256,4 +1257,4 @@
 
 webkit.org/b/222563 http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html [ Pass Failure ]
 
-webkit.org/b/222686 imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-max-size-001.html [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/222686 imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-max-size-001.html [ Pass Failure ]

Modified: trunk/Source/WebCore/ChangeLog (275065 => 275066)


--- trunk/Source/WebCore/ChangeLog	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Source/WebCore/ChangeLog	2021-03-25 23:35:20 UTC (rev 275066)
@@ -1,3 +1,23 @@
+2021-03-25  Andres Gonzalez  <[email protected]>
+
+        AX: Consider implementing @aria-details.
+        https://bugs.webkit.org/show_bug.cgi?id=165842
+        rdar://30725491
+
+        Reviewed by Chris Fleizach.
+
+        Tests: accessibility/ios-simulator/aria-details.html
+               accessibility/mac/aria-details.html
+
+        - Added [WebAccessibilityObjectWrapper accessibilityDetailsElements] on iOS.
+        - Added helper function accessibleElementsForObjects to retrieve platform-
+        specific accessible elements given a collection of AXCoreObjects.
+        
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (accessibleElementsForObjects):
+        (-[WebAccessibilityObjectWrapper accessibilityDetailsElements]):
+        (-[WebAccessibilityObjectWrapper accessibilityErrorMessageElements]):
+
 2021-03-25  Cameron McCormack  <[email protected]>
 
         Collapse newly adjacent anonymous table cells when a table cell is detached from between them.

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (275065 => 275066)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-03-25 23:35:20 UTC (rev 275066)
@@ -1866,18 +1866,14 @@
     }).autorelease();
 }
 
-- (NSArray *)accessibilityErrorMessageElements
+static NSArray *accessibleElementsForObjects(const AXCoreObject::AccessibilityChildrenVector& objects)
 {
-    if (![self _prepareAccessibilityCall])
-        return nil;
+    AXCoreObject::AccessibilityChildrenVector accessibleElements;
+    for (const auto& object : objects) {
+        if (!object)
+            continue;
 
-    AXCoreObject::AccessibilityChildrenVector errorElements;
-    self.axBackingObject->ariaErrorMessageElements(errorElements);
-
-    AXCoreObject::AccessibilityChildrenVector accessibleElements;
-    for (const auto& element : errorElements) {
-        ASSERT(element);
-        Accessibility::enumerateDescendants<AXCoreObject>(*element, true, [&accessibleElements] (AXCoreObject& descendant) {
+        Accessibility::enumerateDescendants<AXCoreObject>(*object, true, [&accessibleElements] (AXCoreObject& descendant) {
             if (descendant.wrapper().isAccessibilityElement)
                 accessibleElements.append(&descendant);
         });
@@ -1886,6 +1882,26 @@
     return convertToNSArray(accessibleElements);
 }
 
+- (NSArray *)accessibilityDetailsElements
+{
+    if (![self _prepareAccessibilityCall])
+        return nil;
+
+    AXCoreObject::AccessibilityChildrenVector detailsElements;
+    self.axBackingObject->ariaDetailsElements(detailsElements);
+    return accessibleElementsForObjects(detailsElements);
+}
+
+- (NSArray *)accessibilityErrorMessageElements
+{
+    if (![self _prepareAccessibilityCall])
+        return nil;
+
+    AXCoreObject::AccessibilityChildrenVector errorElements;
+    self.axBackingObject->ariaErrorMessageElements(errorElements);
+    return accessibleElementsForObjects(errorElements);
+}
+
 - (id)accessibilityLinkedElement
 {
     if (![self _prepareAccessibilityCall])

Modified: trunk/Tools/ChangeLog (275065 => 275066)


--- trunk/Tools/ChangeLog	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Tools/ChangeLog	2021-03-25 23:35:20 UTC (rev 275066)
@@ -1,3 +1,22 @@
+2021-03-25  Andres Gonzalez  <[email protected]>
+
+        AX: Consider implementing @aria-details.
+        https://bugs.webkit.org/show_bug.cgi?id=165842
+        rdar://30725491
+
+        Reviewed by Chris Fleizach.
+
+        Added AccessibilityUIElement::detailsElements.
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+        (WTR::AccessibilityUIElement::detailsElements const):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::detailsElements const):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::detailsElements const):
+
 2021-03-25  John Wilander  <[email protected]>
 
         PCM: Rename attributeOn to attributionDestination and change the IDL data type of attributionSourceId to unsigned long

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (275065 => 275066)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-03-25 23:35:20 UTC (rev 275066)
@@ -127,6 +127,7 @@
 RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::misspellingTextMarkerRange(AccessibilityTextMarkerRange*, bool) { return nullptr; }
 void AccessibilityUIElement::dismiss() { }
+JSValueRef AccessibilityUIElement::detailsElements() const { return { }; }
 JSValueRef AccessibilityUIElement::errorMessageElements() const { return { }; }
 JSRetainPtr<JSStringRef> AccessibilityUIElement::embeddedImageDescription() const { return nullptr; }
 #endif

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (275065 => 275066)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-03-25 23:35:20 UTC (rev 275066)
@@ -225,6 +225,7 @@
     RefPtr<AccessibilityUIElement> disclosedRowAtIndex(unsigned);
     RefPtr<AccessibilityUIElement> rowAtIndex(unsigned);
 
+    JSValueRef detailsElements() const;
     JSValueRef errorMessageElements() const;
     // ARIA specific
     RefPtr<AccessibilityUIElement> ariaOwnsElementAtIndex(unsigned);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (275065 => 275066)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-03-25 23:35:20 UTC (rev 275066)
@@ -169,6 +169,7 @@
     object columnHeaders();
     object rowHeaders();
 
+    object detailsElements();
     object errorMessageElements();
     AccessibilityUIElement ariaOwnsElementAtIndex(unsigned long index);
     AccessibilityUIElement ariaOwnsReferencingElementAtIndex(unsigned long index);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (275065 => 275066)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2021-03-25 23:35:20 UTC (rev 275066)
@@ -50,6 +50,7 @@
 - (id)accessibilityElementForRow:(NSInteger)row andColumn:(NSInteger)column;
 - (NSURL *)accessibilityURL;
 - (NSArray *)accessibilityHeaderElements;
+- (NSArray *)accessibilityDetailsElements;
 - (NSArray *)accessibilityErrorMessageElements;
 - (NSString *)accessibilityPlaceholderValue;
 - (NSString *)stringForRange:(NSRange)range;
@@ -270,6 +271,14 @@
     return nullptr;
 }
 
+JSValueRef AccessibilityUIElement::detailsElements() const
+{
+    NSArray *elements = [m_element accessibilityDetailsElements];
+    if ([elements isKindOfClass:NSArray.class])
+        return makeJSArray(makeVector<RefPtr<AccessibilityUIElement>>(elements));
+    return { };
+}
+
 JSValueRef AccessibilityUIElement::errorMessageElements() const
 {
     NSArray *elements = [m_element accessibilityErrorMessageElements];

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (275065 => 275066)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-03-25 23:10:50 UTC (rev 275065)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-03-25 23:35:20 UTC (rev 275066)
@@ -445,6 +445,17 @@
     return elementForAttributeAtIndex(NSAccessibilityLinkedUIElementsAttribute, index);
 }
 
+JSValueRef AccessibilityUIElement::detailsElements() const
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    NSArray *elements = attributeValue(m_element.get(), @"AXDetailsElements");
+    if ([elements isKindOfClass:NSArray.class])
+        return makeJSArray(makeVector<RefPtr<AccessibilityUIElement>>(elements));
+    END_AX_OBJC_EXCEPTIONS
+
+    return { };
+}
+
 JSValueRef AccessibilityUIElement::errorMessageElements() const
 {
     BEGIN_AX_OBJC_EXCEPTIONS
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to