Title: [176447] trunk
Revision
176447
Author
cfleiz...@apple.com
Date
2014-11-21 07:55:01 -0800 (Fri, 21 Nov 2014)

Log Message

AX: MathML expressions are misread by VoiceOver
https://bugs.webkit.org/show_bug.cgi?id=138948

Reviewed by Mario Sanchez Prada.

Source/WebCore:

The logic for deciding what's the radicand and an index was too tied to children placement.
We should instead pull directly from the source.

Test: platform/mac/accessibility/mathml-root.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::mathRadicandObject):
(WebCore::AccessibilityRenderObject::mathRootIndexObject):
* rendering/mathml/RenderMathMLRoot.h:

LayoutTests:

* platform/mac/accessibility/mathml-root-expected.txt: Added.
* platform/mac/accessibility/mathml-root.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176446 => 176447)


--- trunk/LayoutTests/ChangeLog	2014-11-21 15:26:06 UTC (rev 176446)
+++ trunk/LayoutTests/ChangeLog	2014-11-21 15:55:01 UTC (rev 176447)
@@ -1,3 +1,13 @@
+2014-11-21  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: MathML expressions are misread by VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=138948
+
+        Reviewed by Mario Sanchez Prada.
+
+        * platform/mac/accessibility/mathml-root-expected.txt: Added.
+        * platform/mac/accessibility/mathml-root.html: Added.
+
 2014-11-20  Daniel Bates  <daba...@apple.com>
 
         [iOS] Skip some tests that fail with stderr

Added: trunk/LayoutTests/platform/mac/accessibility/mathml-root-expected.txt (0 => 176447)


--- trunk/LayoutTests/platform/mac/accessibility/mathml-root-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/mathml-root-expected.txt	2014-11-21 15:55:01 UTC (rev 176447)
@@ -0,0 +1,15 @@
+8
+3
+This tests ensures that both root index and radicand work in this case.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+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 successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/mathml-root.html (0 => 176447)


--- trunk/LayoutTests/platform/mac/accessibility/mathml-root.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/mathml-root.html	2014-11-21 15:55:01 UTC (rev 176447)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""
+
+<math id="root"><mroot><mn>8</mn> <mn>3</mn></mroot></math>
+
+<div id="console"></div>
+<script>
+
+description("This tests ensures that both root index and radicand work in this case.")
+
+if (window.testRunner && window.accessibilityController) {
+
+   // 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'");
+}
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (176446 => 176447)


--- trunk/Source/WebCore/ChangeLog	2014-11-21 15:26:06 UTC (rev 176446)
+++ trunk/Source/WebCore/ChangeLog	2014-11-21 15:55:01 UTC (rev 176447)
@@ -1,3 +1,20 @@
+2014-11-21  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: MathML expressions are misread by VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=138948
+
+        Reviewed by Mario Sanchez Prada.
+
+        The logic for deciding what's the radicand and an index was too tied to children placement.
+        We should instead pull directly from the source.
+
+        Test: platform/mac/accessibility/mathml-root.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::mathRadicandObject):
+        (WebCore::AccessibilityRenderObject::mathRootIndexObject):
+        * rendering/mathml/RenderMathMLRoot.h:
+
 2014-11-20  Benjamin Poulain  <bpoul...@apple.com>
 
         Remove the remaining vestiges of minimal-ui

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (176446 => 176447)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2014-11-21 15:26:06 UTC (rev 176446)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2014-11-21 15:55:01 UTC (rev 176447)
@@ -82,6 +82,7 @@
 #include "RenderMathMLBlock.h"
 #include "RenderMathMLFraction.h"
 #include "RenderMathMLOperator.h"
+#include "RenderMathMLRoot.h"
 #include "RenderMenuList.h"
 #include "RenderSVGRoot.h"
 #include "RenderSVGShape.h"
@@ -3623,27 +3624,26 @@
 {
     if (!isMathRoot())
         return nullptr;
-    
-    const auto& children = this->children();
-    if (children.size() < 1)
-        return 0;
-    
-    // The radicand is the value being rooted and must be listed first.
-    return children[0].get();
+    RenderMathMLRoot* root = &downcast<RenderMathMLRoot>(*m_renderer);
+    AccessibilityObject* rootRadicandWrapper = axObjectCache()->getOrCreate(root->baseWrapper());
+    if (!rootRadicandWrapper)
+        return nullptr;
+    AccessibilityObject* rootRadicand = rootRadicandWrapper->children().first().get();
+    ASSERT(rootRadicand && children().contains(rootRadicand));
+    return rootRadicand;
 }
 
 AccessibilityObject* AccessibilityRenderObject::mathRootIndexObject()
 {
     if (!isMathRoot())
         return nullptr;
-    
-    const auto& children = this->children();
-    if (children.size() != 2)
+    RenderMathMLRoot* root = &downcast<RenderMathMLRoot>(*m_renderer);
+    AccessibilityObject* rootIndexWrapper = axObjectCache()->getOrCreate(root->indexWrapper());
+    if (!rootIndexWrapper)
         return nullptr;
-
-    // The index in a root is the value which determines if it's a square, cube, etc, root
-    // and must be listed second.
-    return children[1].get();
+    AccessibilityObject* rootIndex = rootIndexWrapper->children().first().get();
+    ASSERT(rootIndex && children().contains(rootIndex));
+    return rootIndex;
 }
 
 AccessibilityObject* AccessibilityRenderObject::mathNumeratorObject()

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h (176446 => 176447)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h	2014-11-21 15:26:06 UTC (rev 176446)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h	2014-11-21 15:55:01 UTC (rev 176447)
@@ -49,6 +49,9 @@
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     virtual void updateFromElement() override;
     
+    RenderMathMLRootWrapper* baseWrapper() const;
+    RenderMathMLRootWrapper* indexWrapper() const;
+
 protected:
     virtual void layout() override;
     
@@ -61,9 +64,7 @@
     void updateStyle();
     void restructureWrappers();
 
-    RenderMathMLRootWrapper* baseWrapper() const;
     RenderMathMLBlock* radicalWrapper() const;
-    RenderMathMLRootWrapper* indexWrapper() const;
     RenderMathMLRadicalOperator* radicalOperator() const;
 
     LayoutUnit m_verticalGap;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to