Title: [283815] trunk
Revision
283815
Author
[email protected]
Date
2021-10-08 11:40:13 -0700 (Fri, 08 Oct 2021)

Log Message

AX: AXMathRootRadicand should return an array of elements, not just the first
https://bugs.webkit.org/show_bug.cgi?id=230986
<rdar://83688829>

Reviewed by Chris Fleizach.

Source/WebCore:

Tests: accessibility/mac/mathml-elements.html
    accessibility/mac/mathml-root.html

Square root element radicand can be more than one element. For that
reason the return value of AXCoreObject::mathRadicand should be an
optional array of AX objects instead of a single object.

* accessibility/AccessibilityMathMLElement.cpp:
(WebCore::AccessibilityMathMLElement::mathRadicand):
(WebCore::AccessibilityMathMLElement::mathRadicandObject): Renamed mathRadicand.
* accessibility/AccessibilityMathMLElement.h:
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityMathRadicand]):
(-[WebAccessibilityObjectWrapper accessibilityMathRadicandObject]): Renamed accessibilityMathRadicand.
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
(WebCore::AXIsolatedObject::mathRadicand):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

Added AccessibilityUIElement::mathRootRadicand as a readonly property to
be used in LayoutTests.

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::mathRootRadicand const):

LayoutTests:

Instead of getting the root radicand as the first child of the root
element, use the readonly property mathRootRadicand.
Added a check for the length of the mathRootRadicand array.

* accessibility/mac/mathml-elements-expected.txt:
* accessibility/mac/mathml-elements.html:
* accessibility/mac/mathml-root-expected.txt:
* accessibility/mac/mathml-root.html:
Added the test case where the square root element has a radicand
consisting of more than one AX object.

* platform/mac-wk1/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283814 => 283815)


--- trunk/LayoutTests/ChangeLog	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/LayoutTests/ChangeLog	2021-10-08 18:40:13 UTC (rev 283815)
@@ -1,3 +1,24 @@
+2021-10-08  Andres Gonzalez  <[email protected]>
+
+        AX: AXMathRootRadicand should return an array of elements, not just the first
+        https://bugs.webkit.org/show_bug.cgi?id=230986
+        <rdar://83688829>
+
+        Reviewed by Chris Fleizach.
+
+        Instead of getting the root radicand as the first child of the root
+        element, use the readonly property mathRootRadicand.
+        Added a check for the length of the mathRootRadicand array.
+
+        * accessibility/mac/mathml-elements-expected.txt:
+        * accessibility/mac/mathml-elements.html:
+        * accessibility/mac/mathml-root-expected.txt:
+        * accessibility/mac/mathml-root.html:
+        Added the test case where the square root element has a radicand
+        consisting of more than one AX object.
+        
+        * platform/mac-wk1/TestExpectations:
+
 2021-10-08  Ayumi Kojima  <[email protected]>
 
         [ iOS 15 ] Rebaselining platform/ios/ios/fast/text/opticalFontWithWeight.html.

Modified: trunk/LayoutTests/accessibility/mac/mathml-elements-expected.txt (283814 => 283815)


--- trunk/LayoutTests/accessibility/mac/mathml-elements-expected.txt	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/LayoutTests/accessibility/mac/mathml-elements-expected.txt	2021-10-08 18:40:13 UTC (rev 283815)
@@ -54,11 +54,13 @@
 PASS fractionNumerator.isEqual(accessibilityController.accessibleElementById('fractionNumerator')) is true
 PASS sqrt.role is 'AXRole: AXGroup'
 PASS sqrt.subrole is 'AXSubrole: AXMathSquareRoot'
+PASS sqrt.mathRootRadicand.length is 1
 PASS sqrtRadicand.subrole is 'AXSubrole: AXMathIdentifier'
 PASS sqrtRadicand.childAtIndex(0).stringValue is 'AXValue: a'
 PASS sqrtRadicand.isEqual(accessibilityController.accessibleElementById('sqrtRadicand')) is true
 PASS root.role is 'AXRole: AXGroup'
 PASS root.subrole is 'AXSubrole: AXMathRoot'
+PASS root.mathRootRadicand.length is 1
 PASS rootIndex.isEqual(accessibilityController.accessibleElementById('rootIndex')) is true
 PASS rootRadicand.isEqual(accessibilityController.accessibleElementById('rootRadicand')) is true
 PASS fenced.role is 'AXRole: AXGroup'

Modified: trunk/LayoutTests/accessibility/mac/mathml-elements.html (283814 => 283815)


--- trunk/LayoutTests/accessibility/mac/mathml-elements.html	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/LayoutTests/accessibility/mac/mathml-elements.html	2021-10-08 18:40:13 UTC (rev 283815)
@@ -88,7 +88,8 @@
    var sqrt = accessibilityController.accessibleElementById("sqrt").childAtIndex(0);
    shouldBe("sqrt.role", "'AXRole: AXGroup'");
    shouldBe("sqrt.subrole", "'AXSubrole: AXMathSquareRoot'");
-   var sqrtRadicand = sqrt.uiElementAttributeValue("AXMathRootRadicand");
+   shouldBe("sqrt.mathRootRadicand.length", "1");
+   var sqrtRadicand = sqrt.mathRootRadicand[0];
    shouldBe("sqrtRadicand.subrole", "'AXSubrole: AXMathIdentifier'");
    shouldBe("sqrtRadicand.childAtIndex(0).stringValue", "'AXValue: a'");
    shouldBeTrue("sqrtRadicand.isEqual(accessibilityController.accessibleElementById('sqrtRadicand'))");
@@ -98,7 +99,8 @@
    shouldBe("root.role", "'AXRole: AXGroup'");
    shouldBe("root.subrole", "'AXSubrole: AXMathRoot'");
    var rootIndex = root.uiElementAttributeValue("AXMathRootIndex");
-   var rootRadicand = root.uiElementAttributeValue("AXMathRootRadicand");
+   shouldBe("root.mathRootRadicand.length", "1");
+   var rootRadicand = root.mathRootRadicand[0];
    shouldBeTrue("rootIndex.isEqual(accessibilityController.accessibleElementById('rootIndex'))");
    shouldBeTrue("rootRadicand.isEqual(accessibilityController.accessibleElementById('rootRadicand'))");
 

Modified: trunk/LayoutTests/accessibility/mac/mathml-root-expected.txt (283814 => 283815)


--- trunk/LayoutTests/accessibility/mac/mathml-root-expected.txt	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/LayoutTests/accessibility/mac/mathml-root-expected.txt	2021-10-08 18:40:13 UTC (rev 283815)
@@ -1,15 +1,24 @@
-8
-3
-This tests ensures that both root index and radicand work in this case.
+This tests ensures that root index and radicand work as expected for square root and generic root elements.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS sqrt.role is 'AXRole: AXGroup'
+PASS sqrt.subrole is 'AXSubrole: AXMathSquareRoot'
+PASS sqrt.mathRootRadicand.length is 2
+PASS sqrt.mathRootRadicand[0].childAtIndex(0).stringValue is 'AXValue: x'
+PASS sqrt.mathRootRadicand[1].childAtIndex(0).stringValue is 'AXValue: y'
 PASS root.role is 'AXRole: AXGroup'
 PASS root.subrole is 'AXSubrole: AXMathRoot'
-PASS rootRadicand.childAtIndex(0).stringValue is 'AXValue: 8'
 PASS rootIndex.childAtIndex(0).stringValue is 'AXValue: 3'
+PASS root.mathRootRadicand.length is 1
+PASS root.mathRootRadicand[0].childAtIndex(0).stringValue is 'AXValue: 8'
 PASS successfullyParsed is true
 
 TEST COMPLETE
+x
+y
 
+8
+3
+

Modified: trunk/LayoutTests/accessibility/mac/mathml-root.html (283814 => 283815)


--- trunk/LayoutTests/accessibility/mac/mathml-root.html	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/LayoutTests/accessibility/mac/mathml-root.html	2021-10-08 18:40:13 UTC (rev 283815)
@@ -1,29 +1,42 @@
 <!DOCTYPE HTML>
 <html>
+<head>
+<script src=""
+</head>
 <body>
-<script src=""
 
-<math id="root"><mroot><mn>8</mn> <mn>3</mn></mroot></math>
+<math id="sqrt">
+    <msqrt><mi>x</mi><mi>y</mi></msqrt>
+</math>
 
-<div id="console"></div>
+<math id="root">
+    <mroot><mn>8</mn> <mn>3</mn></mroot>
+</math>
+
 <script>
+    description("This tests ensures that root index and radicand work as expected for square root and generic root elements.")
 
-description("This tests ensures that both root index and radicand work in this case.")
+    if (window.testRunner && window.accessibilityController) {
+        // Square root.
+        var sqrt = accessibilityController.accessibleElementById("sqrt").childAtIndex(0);
+        shouldBe("sqrt.role", "'AXRole: AXGroup'");
+        shouldBe("sqrt.subrole", "'AXSubrole: AXMathSquareRoot'");
 
-if (window.testRunner && window.accessibilityController) {
+        shouldBe("sqrt.mathRootRadicand.length", "2");
+        shouldBe("sqrt.mathRootRadicand[0].childAtIndex(0).stringValue", "'AXValue: x'");
+        shouldBe("sqrt.mathRootRadicand[1].childAtIndex(0).stringValue", "'AXValue: y'");
 
-   // Generic root
-   var root = accessibilityController.accessibleElementById("root").childAtIndex(0);
-   shouldBe("root.role", "'AXRole: AXGroup'");
-   shouldBe("root.subrole", "'AXSubrole: AXMathRoot'");
-   var rootIndex = root.uiElementAttributeValue("AXMathRootIndex");
-   var rootRadicand = root.uiElementAttributeValue("AXMathRootRadicand");
-   shouldBe("rootRadicand.childAtIndex(0).stringValue", "'AXValue: 8'");
-   shouldBe("rootIndex.childAtIndex(0).stringValue", "'AXValue: 3'");
-}
+        // Generic root
+        var root = accessibilityController.accessibleElementById("root").childAtIndex(0);
+        shouldBe("root.role", "'AXRole: AXGroup'");
+        shouldBe("root.subrole", "'AXSubrole: AXMathRoot'");
 
+        var rootIndex = root.uiElementAttributeValue("AXMathRootIndex");
+        shouldBe("rootIndex.childAtIndex(0).stringValue", "'AXValue: 3'");
+
+        shouldBe("root.mathRootRadicand.length", "1");
+        shouldBe("root.mathRootRadicand[0].childAtIndex(0).stringValue", "'AXValue: 8'");
+    }
 </script>
-
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (283814 => 283815)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2021-10-08 18:40:13 UTC (rev 283815)
@@ -995,6 +995,8 @@
 accessibility/selected-state-changed-notifications.html [ Skip ]
 accessibility/element-line-rects-and-text.html [ Skip ]
 accessibility/mac/line-index-for-textmarker.html [ Skip ]
+accessibility/mac/mathml-elements.html [ Skip ]
+accessibility/mac/mathml-root.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 ]

Modified: trunk/Source/WebCore/ChangeLog (283814 => 283815)


--- trunk/Source/WebCore/ChangeLog	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/ChangeLog	2021-10-08 18:40:13 UTC (rev 283815)
@@ -1,3 +1,35 @@
+2021-10-08  Andres Gonzalez  <[email protected]>
+
+        AX: AXMathRootRadicand should return an array of elements, not just the first
+        https://bugs.webkit.org/show_bug.cgi?id=230986
+        <rdar://83688829>
+
+        Reviewed by Chris Fleizach.
+
+        Tests: accessibility/mac/mathml-elements.html
+            accessibility/mac/mathml-root.html
+
+        Square root element radicand can be more than one element. For that
+        reason the return value of AXCoreObject::mathRadicand should be an
+        optional array of AX objects instead of a single object.
+
+        * accessibility/AccessibilityMathMLElement.cpp:
+        (WebCore::AccessibilityMathMLElement::mathRadicand):
+        (WebCore::AccessibilityMathMLElement::mathRadicandObject): Renamed mathRadicand.
+        * accessibility/AccessibilityMathMLElement.h:
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityObjectInterface.h:
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityMathRadicand]):
+        (-[WebAccessibilityObjectWrapper accessibilityMathRadicandObject]): Renamed accessibilityMathRadicand.
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::initializeAttributeData):
+        (WebCore::AXIsolatedObject::mathRadicand):
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        * accessibility/isolatedtree/AXIsolatedTree.h:
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2021-10-08  Antti Koivisto  <[email protected]>
 
         Make WTF::IteratorRange reversible

Modified: trunk/Source/WebCore/accessibility/AccessibilityMathMLElement.cpp (283814 => 283815)


--- trunk/Source/WebCore/accessibility/AccessibilityMathMLElement.cpp	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/AccessibilityMathMLElement.cpp	2021-10-08 18:40:13 UTC (rev 283815)
@@ -236,18 +236,18 @@
     return false;
 }
 
-AXCoreObject* AccessibilityMathMLElement::mathRadicandObject()
+std::optional<AXCoreObject::AccessibilityChildrenVector> AccessibilityMathMLElement::mathRadicand() 
 {
     if (!isMathRoot())
-        return nullptr;
+        return std::nullopt;
 
-    // For MathSquareRoot, we actually return the first child of the base.
-    // See also https://webkit.org/b/146452
     const auto& children = this->children();
-    if (children.size() < 1)
-        return nullptr;
+    if (!children.size())
+        return std::nullopt;
 
-    return children[0].get();
+    if (isMathSquareRoot())
+        return children;
+    return { { children[0] } };
 }
 
 AXCoreObject* AccessibilityMathMLElement::mathRootIndexObject()

Modified: trunk/Source/WebCore/accessibility/AccessibilityMathMLElement.h (283814 => 283815)


--- trunk/Source/WebCore/accessibility/AccessibilityMathMLElement.h	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/AccessibilityMathMLElement.h	2021-10-08 18:40:13 UTC (rev 283815)
@@ -80,7 +80,7 @@
     AXCoreObject* mathBaseObject() override;
 
     // Root components.
-    AXCoreObject* mathRadicandObject() override;
+    std::optional<AccessibilityChildrenVector> mathRadicand() override;
     AXCoreObject* mathRootIndexObject() override;
 
     // Fraction components.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (283814 => 283815)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2021-10-08 18:40:13 UTC (rev 283815)
@@ -675,7 +675,7 @@
     bool isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType) const override { return false; }
 
     // Root components.
-    AXCoreObject* mathRadicandObject() override { return nullptr; }
+    std::optional<AccessibilityChildrenVector> mathRadicand() override { return std::nullopt; }
     AXCoreObject* mathRootIndexObject() override { return nullptr; }
 
     // Under over components.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (283814 => 283815)


--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h	2021-10-08 18:40:13 UTC (rev 283815)
@@ -1410,7 +1410,7 @@
     virtual bool isMathMultiscriptObject(AccessibilityMathMultiscriptObjectType) const = 0;
 
     // Root components.
-    virtual AXCoreObject* mathRadicandObject() = 0;
+    virtual std::optional<AccessibilityChildrenVector> mathRadicand() = 0;
     virtual AXCoreObject* mathRootIndexObject() = 0;
 
     // Under over components.

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (283814 => 283815)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2021-10-08 18:40:13 UTC (rev 283815)
@@ -2911,12 +2911,13 @@
     return self.axBackingObject->mathRootIndexObject() ? self.axBackingObject->mathRootIndexObject()->wrapper() : 0;
 }
 
-- (WebAccessibilityObjectWrapper *)accessibilityMathRadicandObject
+- (NSArray *)accessibilityMathRadicand
 {
     if (![self _prepareAccessibilityCall])
         return nil;
 
-    return self.axBackingObject->mathRadicandObject() ? self.axBackingObject->mathRadicandObject()->wrapper() : 0;
+    auto radicand = self.axBackingObject->mathRadicand();
+    return radicand ? convertToNSArray(*radicand) : nil;
 }
 
 - (WebAccessibilityObjectWrapper *)accessibilityMathNumeratorObject

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (283814 => 283815)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2021-10-08 18:40:13 UTC (rev 283815)
@@ -365,7 +365,7 @@
     setProperty(AXPropertyName::ClassList, combinedClassList);
 
     setProperty(AXPropertyName::ColorValue, object.colorValue());
-    
+
     if (bool isMathElement = object.isMathElement()) {
         setProperty(AXPropertyName::IsMathElement, isMathElement);
         setProperty(AXPropertyName::IsAnonymousMathOperator, object.isAnonymousMathOperator());
@@ -374,8 +374,6 @@
         setProperty(AXPropertyName::IsMathSubscriptSuperscript, object.isMathSubscriptSuperscript());
         setProperty(AXPropertyName::IsMathRow, object.isMathRow());
         setProperty(AXPropertyName::IsMathUnderOver, object.isMathUnderOver());
-        setProperty(AXPropertyName::IsMathRoot, object.isMathRoot());
-        setProperty(AXPropertyName::IsMathSquareRoot, object.isMathSquareRoot());
         setProperty(AXPropertyName::IsMathText, object.isMathText());
         setProperty(AXPropertyName::IsMathNumber, object.isMathNumber());
         setProperty(AXPropertyName::IsMathOperator, object.isMathOperator());
@@ -390,8 +388,17 @@
         setProperty(AXPropertyName::MathFencedOpenString, object.mathFencedOpenString().isolatedCopy());
         setProperty(AXPropertyName::MathFencedCloseString, object.mathFencedCloseString().isolatedCopy());
         setProperty(AXPropertyName::MathLineThickness, object.mathLineThickness());
-        setObjectProperty(AXPropertyName::MathRadicandObject, object.mathRadicandObject());
-        setObjectProperty(AXPropertyName::MathRootIndexObject, object.mathRootIndexObject());
+
+        bool isMathRoot = object.isMathRoot();
+        setProperty(AXPropertyName::IsMathRoot, isMathRoot);
+        setProperty(AXPropertyName::IsMathSquareRoot, object.isMathSquareRoot());
+        if (isMathRoot) {
+            if (auto radicand = object.mathRadicand())
+                setObjectVectorProperty(AXPropertyName::MathRadicand, *radicand);
+
+            setObjectProperty(AXPropertyName::MathRootIndexObject, object.mathRootIndexObject());
+        }
+
         setObjectProperty(AXPropertyName::MathUnderObject, object.mathUnderObject());
         setObjectProperty(AXPropertyName::MathOverObject, object.mathOverObject());
         setObjectProperty(AXPropertyName::MathNumeratorObject, object.mathNumeratorObject());
@@ -645,6 +652,16 @@
     insertMathPairs(isolatedPairs, pairs);
 }
 
+std::optional<AXCoreObject::AccessibilityChildrenVector> AXIsolatedObject::mathRadicand()
+{
+    if (m_propertyMap.contains(AXPropertyName::MathRadicand)) {
+        Vector<RefPtr<AXCoreObject>> radicand;
+        fillChildrenVectorForProperty(AXPropertyName::MathRadicand, radicand);
+        return { radicand };
+    }
+    return std::nullopt;
+}
+
 AXCoreObject* AXIsolatedObject::focusedUIElement() const
 {
     return tree()->focusedNode().get();

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (283814 => 283815)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2021-10-08 18:40:13 UTC (rev 283815)
@@ -312,7 +312,7 @@
     bool isMathTableCell() const override { return boolAttributeValue(AXPropertyName::IsMathTableCell); }
     bool isMathMultiscript() const override { return boolAttributeValue(AXPropertyName::IsMathMultiscript); }
     bool isMathToken() const override { return boolAttributeValue(AXPropertyName::IsMathToken); }
-    AXCoreObject* mathRadicandObject() override { return objectAttributeValue(AXPropertyName::MathRadicandObject); }
+    std::optional<AccessibilityChildrenVector> mathRadicand() override;
     AXCoreObject* mathRootIndexObject() override { return objectAttributeValue(AXPropertyName::MathRootIndexObject); }
     AXCoreObject* mathUnderObject() override { return objectAttributeValue(AXPropertyName::MathUnderObject); }
     AXCoreObject* mathOverObject() override { return objectAttributeValue(AXPropertyName::MathOverObject); }

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h (283814 => 283815)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2021-10-08 18:40:13 UTC (rev 283815)
@@ -241,7 +241,7 @@
     MathLineThickness,
     MathPrescripts,
     MathPostscripts,
-    MathRadicandObject,
+    MathRadicand,
     MathRootIndexObject,
     MathUnderObject,
     MathOverObject,

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (283814 => 283815)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2021-10-08 18:40:13 UTC (rev 283815)
@@ -2724,10 +2724,16 @@
 
     // MathML Attributes.
     if (backingObject->isMathElement()) {
-        if ([attributeName isEqualToString:NSAccessibilityMathRootIndexAttribute])
-            return (backingObject->mathRootIndexObject()) ? backingObject->mathRootIndexObject()->wrapper() : 0;
-        if ([attributeName isEqualToString:NSAccessibilityMathRootRadicandAttribute])
-            return (backingObject->mathRadicandObject()) ? backingObject->mathRadicandObject()->wrapper() : 0;
+        if ([attributeName isEqualToString:NSAccessibilityMathRootIndexAttribute]) {
+            auto* rootIndex = backingObject->mathRootIndexObject();
+            return rootIndex ? rootIndex->wrapper() : nil;
+        }
+
+        if ([attributeName isEqualToString:NSAccessibilityMathRootRadicandAttribute]) {
+            auto radicand = backingObject->mathRadicand();
+            return radicand ? convertToNSArray(*radicand) : nil;
+        }
+
         if ([attributeName isEqualToString:NSAccessibilityMathFractionNumeratorAttribute])
             return (backingObject->mathNumeratorObject()) ? backingObject->mathNumeratorObject()->wrapper() : 0;
         if ([attributeName isEqualToString:NSAccessibilityMathFractionDenominatorAttribute])

Modified: trunk/Tools/ChangeLog (283814 => 283815)


--- trunk/Tools/ChangeLog	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Tools/ChangeLog	2021-10-08 18:40:13 UTC (rev 283815)
@@ -1,3 +1,19 @@
+2021-10-08  Andres Gonzalez  <[email protected]>
+
+        AX: AXMathRootRadicand should return an array of elements, not just the first
+        https://bugs.webkit.org/show_bug.cgi?id=230986
+        <rdar://83688829>
+
+        Reviewed by Chris Fleizach.
+
+        Added AccessibilityUIElement::mathRootRadicand as a readonly property to
+        be used in LayoutTests.
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::mathRootRadicand const):
+
 2021-10-08  Antti Koivisto  <[email protected]>
 
         Make WTF::IteratorRange reversible

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (283814 => 283815)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp	2021-10-08 18:40:13 UTC (rev 283815)
@@ -110,6 +110,7 @@
 void AccessibilityUIElement::setValue(JSStringRef) { }
 JSValueRef AccessibilityUIElement::searchTextWithCriteria(JSContextRef, JSValueRef, JSStringRef, JSStringRef) { return nullptr; }
 bool AccessibilityUIElement::isOnScreen() const { return true; }
+JSValueRef AccessibilityUIElement::mathRootRadicand() const { return { }; }
 #endif
 
 #if !PLATFORM(COCOA) || !HAVE(ACCESSIBILITY)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (283814 => 283815)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2021-10-08 18:40:13 UTC (rev 283815)
@@ -357,6 +357,7 @@
     JSRetainPtr<JSStringRef> supportedActions() const;
     JSRetainPtr<JSStringRef> mathPostscriptsDescription() const;
     JSRetainPtr<JSStringRef> mathPrescriptsDescription() const;
+    JSValueRef mathRootRadicand() const;
 
     JSRetainPtr<JSStringRef> pathDescription() const;
     

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (283814 => 283815)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl	2021-10-08 18:40:13 UTC (rev 283815)
@@ -266,6 +266,7 @@
     readonly attribute DOMString supportedActions;
     readonly attribute DOMString mathPostscriptsDescription;
     readonly attribute DOMString mathPrescriptsDescription;
+    readonly attribute object mathRootRadicand;
 
     readonly attribute DOMString pathDescription;
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (283814 => 283815)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-10-08 18:32:10 UTC (rev 283814)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2021-10-08 18:40:13 UTC (rev 283815)
@@ -2303,7 +2303,16 @@
     
     return nullptr;
 }
-    
+
+JSValueRef AccessibilityUIElement::mathRootRadicand() const
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    return makeJSArray(makeVector<RefPtr<AccessibilityUIElement>>(attributeValue(m_element.get(), @"AXMathRootRadicand")));
+    END_AX_OBJC_EXCEPTIONS
+
+    return nullptr;
+}
+
 JSRetainPtr<JSStringRef> AccessibilityUIElement::pathDescription() const
 {
     BEGIN_AX_OBJC_EXCEPTIONS
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to