AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree
authorjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jun 2016 17:57:49 +0000 (17:57 +0000)
committerjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jun 2016 17:57:49 +0000 (17:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139582
<rdar://problem/26938849>

Reviewed by Chris Fleizach.

This is based on a patch by Frederic Wang <fwang@igalia.com>.

Source/WebCore:

WebCore assigns the generic MathElementRole AccessibilityRole to elements
which are expected to be included in the accessibility tree. This assignment
is based on the AccessibilityRenderObject's node being a MathMLElement. The
anonymous RenderMathMLOperators fail that test.

From the perspective of accessibility support, these operators function
like MathMLElements. Furthermore, both WebCore and the platforms rely
upon MathElementRole to identify accessible MathML objects. The simplest
fix is to have AccessibilityRenderObject::isMathElement() treat anonymous
MathML operators as if they were MathMLElements.

Now that these operators are being exposed, we need to handle them in
AccessibilityRenderObject::textUnderElement() which assumes that anonymous
objects either have nodes or have children with nodes. And crashes when
that fails to be the case. Making RenderMathMLOperator::textContent()
public and then using it to get the text under anonymous operators solves
this problem. We also assign StaticTextRole to these operators on the Mac
because the default platform mapping of MathElementRole is GroupRole, which
made sense when we had a child RenderText object holding the operator.

Lastly, AccessibilityRenderObject::isIgnoredElementWithinMathTree() no
longer needs to special-case anonymous operators because they now have
MathElementRole.

Tests: accessibility/math-fenced.html
       accessibility/math-foreign-content.html

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isAnonymousMathOperator):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textUnderElement):
(WebCore::AccessibilityRenderObject::stringValue):
(WebCore::AccessibilityRenderObject::isMathElement):
(WebCore::AccessibilityRenderObject::isAnonymousMathOperator):
(WebCore::AccessibilityRenderObject::isIgnoredElementWithinMathTree):
* accessibility/AccessibilityRenderObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper role]):
* rendering/mathml/RenderMathMLMath.h:
* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::textContent):

LayoutTests:

One of the things making it difficult to tell that the operators were not
exposed on the Mac is the fact that the operator text is present. But the
operator text is simply a StaticTextRole object corresponding to the
RenderText descendant of the operator. Furthermore, on the Mac, accessible
math operators have subroles which are missing from the StaticTextRole
object which is exposed. In order to make issues like this more obvious,
add an option to include the subrole to dumpAccessibilityTree() and use it
in the new math-fenced.html.

This change also fixes the mfenced in mac/mathml-elements.html that was
broken after r202420. We enable it again and update the expectations of
that test because the operators are now in the accessibility tree.

We also add a new test to verify the render tree of foreign content in
MathML formulas.

* accessibility/mac/mathml-elements-expected.txt: Updated.
* accessibility/mac/mathml-elements.html: Re-enable the mfenced test.
* accessibility/math-fenced.html: Added.
* accessibility/math-foreign-content.html: Added.
* platform/gtk/accessibility/math-fenced-expected.txt: Added.
* platform/gtk/accessibility/math-foreign-content-expected.txt: Added.
* platform/mac/accessibility/math-fenced-expected.txt: Added.
* platform/mac/accessibility/math-foreign-content-expected.txt: Added.
* resources/accessibility-helper.js: Add option to include subrole in tree.
(dumpAccessibilityTree):

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

17 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/mac/mathml-elements-expected.txt
LayoutTests/accessibility/mac/mathml-elements.html
LayoutTests/accessibility/math-fenced.html [new file with mode: 0644]
LayoutTests/accessibility/math-foreign-content.html [new file with mode: 0644]
LayoutTests/platform/gtk/accessibility/math-fenced-expected.txt [new file with mode: 0644]
LayoutTests/platform/gtk/accessibility/math-foreign-content-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/math-fenced-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/math-foreign-content-expected.txt [new file with mode: 0644]
LayoutTests/resources/accessibility-helper.js
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/rendering/mathml/RenderMathMLMath.h
Source/WebCore/rendering/mathml/RenderMathMLOperator.h

index 8ea816f..9ddf73b 100644 (file)
@@ -1,3 +1,40 @@
+2016-06-27  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree
+        https://bugs.webkit.org/show_bug.cgi?id=139582
+        <rdar://problem/26938849>
+
+        Reviewed by Chris Fleizach.
+
+        This is based on a patch by Frederic Wang <fwang@igalia.com>.
+
+        One of the things making it difficult to tell that the operators were not
+        exposed on the Mac is the fact that the operator text is present. But the
+        operator text is simply a StaticTextRole object corresponding to the
+        RenderText descendant of the operator. Furthermore, on the Mac, accessible
+        math operators have subroles which are missing from the StaticTextRole
+        object which is exposed. In order to make issues like this more obvious,
+        add an option to include the subrole to dumpAccessibilityTree() and use it
+        in the new math-fenced.html.
+
+        This change also fixes the mfenced in mac/mathml-elements.html that was
+        broken after r202420. We enable it again and update the expectations of
+        that test because the operators are now in the accessibility tree.
+
+        We also add a new test to verify the render tree of foreign content in
+        MathML formulas.
+
+        * accessibility/mac/mathml-elements-expected.txt: Updated.
+        * accessibility/mac/mathml-elements.html: Re-enable the mfenced test.
+        * accessibility/math-fenced.html: Added.
+        * accessibility/math-foreign-content.html: Added.
+        * platform/gtk/accessibility/math-fenced-expected.txt: Added.
+        * platform/gtk/accessibility/math-foreign-content-expected.txt: Added.
+        * platform/mac/accessibility/math-fenced-expected.txt: Added.
+        * platform/mac/accessibility/math-foreign-content-expected.txt: Added.
+        * resources/accessibility-helper.js: Add option to include subrole in tree.
+        (dumpAccessibilityTree):
+
 2016-06-27  Ryan Haddad  <ryanhaddad@apple.com>
 
         Remove flaky expectation for imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/event_loadeddata.html
index 7212235..25b0419 100644 (file)
@@ -67,6 +67,13 @@ PASS fenced.role is 'AXRole: AXGroup'
 PASS fenced.subrole is 'AXSubrole: AXMathFenced'
 PASS fenced.stringAttributeValue('AXMathFencedOpen') is '{'
 PASS fenced.stringAttributeValue('AXMathFencedClose') is '}'
+PASS child.stringValue is 'AXValue: {'
+PASS child.childAtIndex(0).stringValue is 'AXValue: 2'
+PASS child.stringValue is 'AXValue: ,'
+PASS child.childAtIndex(0).stringValue is 'AXValue: a'
+PASS child.stringValue is 'AXValue: ,'
+PASS child.childAtIndex(0).stringValue is 'AXValue: e'
+PASS child.stringValue is 'AXValue: }'
 PASS sub.role is 'AXRole: AXGroup'
 PASS sub.subrole is 'AXSubrole: AXMathSubscriptSuperscript'
 PASS subBase.subrole is 'AXSubrole: AXMathIdentifier'
index 5a11a2e..437da87 100644 (file)
@@ -108,9 +108,6 @@ if (window.testRunner && window.accessibilityController) {
    shouldBe("fenced.subrole", "'AXSubrole: AXMathFenced'");
    shouldBe("fenced.stringAttributeValue('AXMathFencedOpen')", "'{'");
    shouldBe("fenced.stringAttributeValue('AXMathFencedClose')", "'}'");
-   /*
-   FIXME: AccessibilityRenderObject should be updated to properly expose the text of mfenced operators.
-   See https://bugs.webkit.org/show_bug.cgi?id=139582.
    var fenceValues = new Array("{", "2", ",", "a", ",", "e", "}");
    for (var k = 0; k < fenceValues.length; k++) {
       var child = fenced.childAtIndex(k);
@@ -119,7 +116,6 @@ if (window.testRunner && window.accessibilityController) {
       else
           shouldBe("child.childAtIndex(0).stringValue", "'AXValue: " + fenceValues[k] + "'");
    }
-   */
 
    // Subscript
    var sub = accessibilityController.accessibleElementById("sub").childAtIndex(0);
diff --git a/LayoutTests/accessibility/math-fenced.html b/LayoutTests/accessibility/math-fenced.html
new file mode 100644 (file)
index 0000000..01cbf05
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="../resources/accessibility-helper.js"></script>
+</head>
+<body>
+<div id="content">
+  <math id="math">
+    <mfenced open="{" close="}" separators=",;">
+      <mi>2</mi>
+      <mi>a</mi>
+      <mi>e</mi>
+    </mfenced>
+  </math>
+</div>
+<p id="description"></p>
+<pre id="tree"></pre>
+<div id="console"></div>
+<script>
+    description("This verifies the expected roles and values are exposed for mfenced.");
+
+    if (window.accessibilityController) {
+        dumpAccessibilityTree(accessibilityController.accessibleElementById("math"), null, 0, false, false, true);
+        document.getElementById("content").style.visibility = "hidden";
+    }
+</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/accessibility/math-foreign-content.html b/LayoutTests/accessibility/math-foreign-content.html
new file mode 100644 (file)
index 0000000..e591d7a
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="../resources/accessibility-helper.js"></script>
+</head>
+<body>
+<div id="content">
+  <math id="math">
+    <semantics>
+      <csymbol>Content MathML</csymbol>
+      <annotation-xml encoding="image/svg+xml">
+        <svg height="30" width="75">
+          <text x="0" y="15" transform="rotate(30 20,40)">SVG</text>
+        </svg> 
+      </annotation-xml>
+    </semantics>
+    <mtext><span>HTML</span></mtext>
+  </math>
+</div>
+<p id="description"></p>
+<pre id="tree"></pre>
+<div id="console"></div>
+<script>
+    description("This verifies the expected roles and values are exposed for foreign content in MathML.");
+
+    if (window.accessibilityController) {
+        dumpAccessibilityTree(accessibilityController.accessibleElementById("math"), null, 0, false, false, true);
+        document.getElementById("content").style.visibility = "hidden";
+    }
+</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/gtk/accessibility/math-fenced-expected.txt b/LayoutTests/platform/gtk/accessibility/math-fenced-expected.txt
new file mode 100644 (file)
index 0000000..e85d7fb
--- /dev/null
@@ -0,0 +1,18 @@
+This verifies the expected roles and values are exposed for mfenced.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXMath 
+    AXRole: AXGroup 
+        AXRole: AXStatic AXValue: {
+        AXRole: AXStatic AXValue: 2
+        AXRole: AXStatic AXValue: ,
+        AXRole: AXStatic AXValue: a
+        AXRole: AXStatic AXValue: ;
+        AXRole: AXStatic AXValue: e
+        AXRole: AXStatic AXValue: }
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/gtk/accessibility/math-foreign-content-expected.txt b/LayoutTests/platform/gtk/accessibility/math-foreign-content-expected.txt
new file mode 100644 (file)
index 0000000..f75028a
--- /dev/null
@@ -0,0 +1,14 @@
+This verifies the expected roles and values are exposed for foreign content in MathML.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXMath 
+    AXRole: AXGroup 
+        AXRole: AXGroup 
+            AXRole: AXSection AXValue: SVG
+    AXRole: AXStatic AXValue: HTML
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/math-fenced-expected.txt b/LayoutTests/platform/mac/accessibility/math-fenced-expected.txt
new file mode 100644 (file)
index 0000000..b794395
--- /dev/null
@@ -0,0 +1,21 @@
+This verifies the expected roles and values are exposed for mfenced.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXGroup AXSubrole: AXDocumentMath AXValue: 
+    AXRole: AXGroup AXSubrole: AXMathFenced AXValue: 
+        AXRole: AXStaticText AXSubrole: AXMathFenceOperator AXValue: {
+        AXRole: AXGroup AXSubrole: AXMathIdentifier AXValue: 
+            AXRole: AXStaticText AXSubrole:  AXValue: 2
+        AXRole: AXStaticText AXSubrole: AXMathSeparatorOperator AXValue: ,
+        AXRole: AXGroup AXSubrole: AXMathIdentifier AXValue: 
+            AXRole: AXStaticText AXSubrole:  AXValue: a
+        AXRole: AXStaticText AXSubrole: AXMathSeparatorOperator AXValue: ;
+        AXRole: AXGroup AXSubrole: AXMathIdentifier AXValue: 
+            AXRole: AXStaticText AXSubrole:  AXValue: e
+        AXRole: AXStaticText AXSubrole: AXMathFenceOperator AXValue: }
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/math-foreign-content-expected.txt b/LayoutTests/platform/mac/accessibility/math-foreign-content-expected.txt
new file mode 100644 (file)
index 0000000..bba92e8
--- /dev/null
@@ -0,0 +1,16 @@
+This verifies the expected roles and values are exposed for foreign content in MathML.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXGroup AXSubrole: AXDocumentMath AXValue: 
+    AXRole: AXGroup AXSubrole: AXMathRow AXValue: 
+        AXRole: AXGroup AXSubrole: AXMathRow AXValue: 
+            AXRole: AXGroup AXSubrole:  AXValue: 
+                AXRole: AXStaticText AXSubrole:  AXValue: SVG
+    AXRole: AXGroup AXSubrole: AXMathText AXValue: 
+        AXRole: AXStaticText AXSubrole:  AXValue: HTML
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
index 79cd240..acfdf01 100644 (file)
@@ -1,10 +1,12 @@
-function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle) {
+function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle, includeSubrole) {
     var str = "";
     var i = 0;
 
     for (i = 0; i < indent; i++)
         str += "    ";
     str += accessibilityObject.role;
+    if (includeSubrole === true && accessibilityObject.subrole)
+        str += " " + accessibilityObject.subrole;
     str += " " + (getValueFromTitle === true ? accessibilityObject.title : accessibilityObject.stringValue);
     str += allAttributesIfNeeded && accessibilityObject.role == '' ? accessibilityObject.allAttributes() : '';
     str += "\n";
@@ -16,7 +18,7 @@ function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttr
 
     var count = accessibilityObject.childrenCount;
     for (i = 0; i < count; ++i) {
-        if (!dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle))
+        if (!dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle, includeSubrole))
             return false;
     }
 
index 230afdf..89568c1 100644 (file)
@@ -1,3 +1,55 @@
+2016-06-27  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree
+        https://bugs.webkit.org/show_bug.cgi?id=139582
+        <rdar://problem/26938849>
+
+        Reviewed by Chris Fleizach.
+
+        This is based on a patch by Frederic Wang <fwang@igalia.com>.
+
+        WebCore assigns the generic MathElementRole AccessibilityRole to elements
+        which are expected to be included in the accessibility tree. This assignment
+        is based on the AccessibilityRenderObject's node being a MathMLElement. The
+        anonymous RenderMathMLOperators fail that test.
+
+        From the perspective of accessibility support, these operators function
+        like MathMLElements. Furthermore, both WebCore and the platforms rely
+        upon MathElementRole to identify accessible MathML objects. The simplest
+        fix is to have AccessibilityRenderObject::isMathElement() treat anonymous
+        MathML operators as if they were MathMLElements.
+
+        Now that these operators are being exposed, we need to handle them in
+        AccessibilityRenderObject::textUnderElement() which assumes that anonymous
+        objects either have nodes or have children with nodes. And crashes when
+        that fails to be the case. Making RenderMathMLOperator::textContent()
+        public and then using it to get the text under anonymous operators solves
+        this problem. We also assign StaticTextRole to these operators on the Mac
+        because the default platform mapping of MathElementRole is GroupRole, which
+        made sense when we had a child RenderText object holding the operator.
+
+        Lastly, AccessibilityRenderObject::isIgnoredElementWithinMathTree() no
+        longer needs to special-case anonymous operators because they now have
+        MathElementRole.
+
+        Tests: accessibility/math-fenced.html
+               accessibility/math-foreign-content.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isAnonymousMathOperator):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::textUnderElement):
+        (WebCore::AccessibilityRenderObject::stringValue):
+        (WebCore::AccessibilityRenderObject::isMathElement):
+        (WebCore::AccessibilityRenderObject::isAnonymousMathOperator):
+        (WebCore::AccessibilityRenderObject::isIgnoredElementWithinMathTree):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper role]):
+        * rendering/mathml/RenderMathMLMath.h:
+        * rendering/mathml/RenderMathMLOperator.h:
+        (WebCore::RenderMathMLOperator::textContent):
+
 2016-06-27  Adam Bergkvist  <adam.bergkvist@ericsson.com>
 
         WebRTC: Remove unused RTCOfferAnswerOptionsPrivate.h
index 1dbdd98..55a9150 100644 (file)
@@ -995,6 +995,7 @@ public:
     virtual String mathFencedOpenString() const { return String(); }
     virtual String mathFencedCloseString() const { return String(); }
     virtual int mathLineThickness() const { return 0; }
+    virtual bool isAnonymousMathOperator() const { return false; }
     
     // Multiscripts components.
     typedef Vector<std::pair<AccessibilityObject*, AccessibilityObject*>> AccessibilityMathMultiscriptPairs;
index 0f3f0e9..01e9ea7 100644 (file)
@@ -84,6 +84,7 @@
 #include "RenderListMarker.h"
 #include "RenderMathMLBlock.h"
 #include "RenderMathMLFraction.h"
+#include "RenderMathMLMath.h"
 #include "RenderMathMLOperator.h"
 #include "RenderMathMLRoot.h"
 #include "RenderMenuList.h"
@@ -635,6 +636,10 @@ String AccessibilityRenderObject::textUnderElement(AccessibilityTextUnderElement
     // so rangeOfContents does not work for them (nor does regular text selection).
     if (isRenderText && m_renderer->isAnonymous() && ancestorsOfType<RenderMathMLOperator>(*m_renderer).first())
         return downcast<RenderText>(*m_renderer).text();
+    if (isAnonymousMathOperator()) {
+        UChar operatorChar = downcast<RenderMathMLOperator>(*m_renderer).textContent();
+        return operatorChar ? String(&operatorChar, 1) : String();
+    }
     if (is<RenderMathMLOperator>(*m_renderer) && !m_renderer->isAnonymous())
         return downcast<RenderMathMLOperator>(*m_renderer).element().textContent();
 #endif
@@ -761,6 +766,9 @@ String AccessibilityRenderObject::stringValue() const
         
     if (is<RenderText>(*m_renderer))
         return textUnderElement();
+
+    if (isAnonymousMathOperator())
+        return textUnderElement();
     
     if (is<RenderMenuList>(cssBox)) {
         // RenderMenuList will go straight to the text() of its selected item.
@@ -3609,6 +3617,12 @@ bool AccessibilityRenderObject::isMathElement() const
     if (!m_renderer)
         return false;
     
+    // The mfenced element creates anonymous RenderMathMLOperators which should be treated
+    // as MathML elements and assigned the MathElementRole so that platform logic regarding
+    // inclusion and role mapping is not bypassed.
+    if (isAnonymousMathOperator())
+        return true;
+
     return is<MathMLElement>(node());
 }
 
@@ -3660,6 +3674,11 @@ bool AccessibilityRenderObject::isMathOperator() const
     return true;
 }
 
+bool AccessibilityRenderObject::isAnonymousMathOperator() const
+{
+    return is<RenderMathMLOperator>(m_renderer) && m_renderer->isAnonymous();
+}
+
 bool AccessibilityRenderObject::isMathFenceOperator() const
 {
     if (!is<RenderMathMLOperator>(m_renderer))
@@ -3751,17 +3770,9 @@ bool AccessibilityRenderObject::isIgnoredElementWithinMathTree() const
 {
     if (!m_renderer)
         return true;
-    
-    // We ignore anonymous renderers inside math blocks.
-    // However, we do not exclude anonymous RenderMathMLOperator nodes created by the mfenced element nor RenderText nodes created by math operators so that the text can be exposed by AccessibilityRenderObject::textUnderElement.
-    if (m_renderer->isAnonymous()) {
-        if (m_renderer->isRenderMathMLOperator())
-            return false;
-        for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
-            if (parent->isMathElement())
-                return !(m_renderer->isText() && ancestorsOfType<RenderMathMLOperator>(*m_renderer).first());
-        }
-    }
+
+    if (is<RenderText>(*m_renderer))
+        return false;
 
     // Only math elements that we explicitly recognize should be included
     // We don't want things like <mstyle> to appear in the tree.
@@ -3774,7 +3785,7 @@ bool AccessibilityRenderObject::isIgnoredElementWithinMathTree() const
         return true;
     }
 
-    return false;
+    return m_renderer->isAnonymous() && m_renderer->parent() && is<RenderMathMLBlock>(m_renderer->parent());
 }
 
 AccessibilityObject* AccessibilityRenderObject::mathRadicandObject()
index ab68ec9..4459c46 100644 (file)
@@ -327,6 +327,7 @@ private:
     String mathFencedOpenString() const override;
     String mathFencedCloseString() const override;
     int mathLineThickness() const override;
+    bool isAnonymousMathOperator() const override;
 
     // Multiscripts components.
     void mathPrescripts(AccessibilityMathMultiscriptPairs&) override;
index 2cdf4f2..4556275 100644 (file)
@@ -2237,6 +2237,12 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if (role == LabelRole && is<AccessibilityLabel>(*m_object) && downcast<AccessibilityLabel>(*m_object).containsOnlyStaticText())
         role = StaticTextRole;
 
+    // The mfenced element creates anonymous RenderMathMLOperators with no RenderText
+    // descendants. Because these anonymous renderers are the only accessible objects
+    // containing the operator, assign StaticTextRole.
+    if (m_object->isAnonymousMathOperator())
+        role = StaticTextRole;
+
     if (role == CanvasRole && m_object->canvasHasFallbackContent())
         role = GroupRole;
     NSString* string = roleValueToNSString(role);
index 6e17bfa..d94bc9c 100644 (file)
@@ -43,5 +43,7 @@ private:
     
 }
 
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLMath, isRenderMathMLMath())
+
 #endif // ENABLE(MATHML)
 #endif // RenderMathMLMath_h
index fe9eee3..dd3576b 100644 (file)
@@ -62,6 +62,7 @@ public:
     void updateTokenContent() final;
     void updateOperatorProperties();
     void updateFromElement() final;
+    UChar textContent() const { return m_textContent; }
 
 protected:
     virtual void setOperatorProperties();
@@ -69,7 +70,6 @@ protected:
     void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
     void setLeadingSpace(LayoutUnit leadingSpace) { m_leadingSpace = leadingSpace; }
     void setTrailingSpace(LayoutUnit trailingSpace) { m_trailingSpace = trailingSpace; }
-    UChar textContent() const { return m_textContent; }
 
 private:
     const char* renderName() const override { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }