Changeset 202497 in webkit
- Timestamp:
- Jun 27, 2016 10:57:49 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202496 r202497 1 2016-06-27 Joanmarie Diggs <jdiggs@igalia.com> 2 3 AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree 4 https://bugs.webkit.org/show_bug.cgi?id=139582 5 <rdar://problem/26938849> 6 7 Reviewed by Chris Fleizach. 8 9 This is based on a patch by Frederic Wang <fwang@igalia.com>. 10 11 One of the things making it difficult to tell that the operators were not 12 exposed on the Mac is the fact that the operator text is present. But the 13 operator text is simply a StaticTextRole object corresponding to the 14 RenderText descendant of the operator. Furthermore, on the Mac, accessible 15 math operators have subroles which are missing from the StaticTextRole 16 object which is exposed. In order to make issues like this more obvious, 17 add an option to include the subrole to dumpAccessibilityTree() and use it 18 in the new math-fenced.html. 19 20 This change also fixes the mfenced in mac/mathml-elements.html that was 21 broken after r202420. We enable it again and update the expectations of 22 that test because the operators are now in the accessibility tree. 23 24 We also add a new test to verify the render tree of foreign content in 25 MathML formulas. 26 27 * accessibility/mac/mathml-elements-expected.txt: Updated. 28 * accessibility/mac/mathml-elements.html: Re-enable the mfenced test. 29 * accessibility/math-fenced.html: Added. 30 * accessibility/math-foreign-content.html: Added. 31 * platform/gtk/accessibility/math-fenced-expected.txt: Added. 32 * platform/gtk/accessibility/math-foreign-content-expected.txt: Added. 33 * platform/mac/accessibility/math-fenced-expected.txt: Added. 34 * platform/mac/accessibility/math-foreign-content-expected.txt: Added. 35 * resources/accessibility-helper.js: Add option to include subrole in tree. 36 (dumpAccessibilityTree): 37 1 38 2016-06-27 Ryan Haddad <ryanhaddad@apple.com> 2 39 -
trunk/LayoutTests/accessibility/mac/mathml-elements-expected.txt
r202420 r202497 68 68 PASS fenced.stringAttributeValue('AXMathFencedOpen') is '{' 69 69 PASS fenced.stringAttributeValue('AXMathFencedClose') is '}' 70 PASS child.stringValue is 'AXValue: {' 71 PASS child.childAtIndex(0).stringValue is 'AXValue: 2' 72 PASS child.stringValue is 'AXValue: ,' 73 PASS child.childAtIndex(0).stringValue is 'AXValue: a' 74 PASS child.stringValue is 'AXValue: ,' 75 PASS child.childAtIndex(0).stringValue is 'AXValue: e' 76 PASS child.stringValue is 'AXValue: }' 70 77 PASS sub.role is 'AXRole: AXGroup' 71 78 PASS sub.subrole is 'AXSubrole: AXMathSubscriptSuperscript' -
trunk/LayoutTests/accessibility/mac/mathml-elements.html
r202420 r202497 109 109 shouldBe("fenced.stringAttributeValue('AXMathFencedOpen')", "'{'"); 110 110 shouldBe("fenced.stringAttributeValue('AXMathFencedClose')", "'}'"); 111 /*112 FIXME: AccessibilityRenderObject should be updated to properly expose the text of mfenced operators.113 See https://bugs.webkit.org/show_bug.cgi?id=139582.114 111 var fenceValues = new Array("{", "2", ",", "a", ",", "e", "}"); 115 112 for (var k = 0; k < fenceValues.length; k++) { … … 120 117 shouldBe("child.childAtIndex(0).stringValue", "'AXValue: " + fenceValues[k] + "'"); 121 118 } 122 */123 119 124 120 // Subscript -
trunk/LayoutTests/resources/accessibility-helper.js
r201216 r202497 1 function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle ) {1 function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle, includeSubrole) { 2 2 var str = ""; 3 3 var i = 0; … … 6 6 str += " "; 7 7 str += accessibilityObject.role; 8 if (includeSubrole === true && accessibilityObject.subrole) 9 str += " " + accessibilityObject.subrole; 8 10 str += " " + (getValueFromTitle === true ? accessibilityObject.title : accessibilityObject.stringValue); 9 11 str += allAttributesIfNeeded && accessibilityObject.role == '' ? accessibilityObject.allAttributes() : ''; … … 17 19 var count = accessibilityObject.childrenCount; 18 20 for (i = 0; i < count; ++i) { 19 if (!dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle ))21 if (!dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle, includeSubrole)) 20 22 return false; 21 23 } -
trunk/Source/WebCore/ChangeLog
r202494 r202497 1 2016-06-27 Joanmarie Diggs <jdiggs@igalia.com> 2 3 AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree 4 https://bugs.webkit.org/show_bug.cgi?id=139582 5 <rdar://problem/26938849> 6 7 Reviewed by Chris Fleizach. 8 9 This is based on a patch by Frederic Wang <fwang@igalia.com>. 10 11 WebCore assigns the generic MathElementRole AccessibilityRole to elements 12 which are expected to be included in the accessibility tree. This assignment 13 is based on the AccessibilityRenderObject's node being a MathMLElement. The 14 anonymous RenderMathMLOperators fail that test. 15 16 From the perspective of accessibility support, these operators function 17 like MathMLElements. Furthermore, both WebCore and the platforms rely 18 upon MathElementRole to identify accessible MathML objects. The simplest 19 fix is to have AccessibilityRenderObject::isMathElement() treat anonymous 20 MathML operators as if they were MathMLElements. 21 22 Now that these operators are being exposed, we need to handle them in 23 AccessibilityRenderObject::textUnderElement() which assumes that anonymous 24 objects either have nodes or have children with nodes. And crashes when 25 that fails to be the case. Making RenderMathMLOperator::textContent() 26 public and then using it to get the text under anonymous operators solves 27 this problem. We also assign StaticTextRole to these operators on the Mac 28 because the default platform mapping of MathElementRole is GroupRole, which 29 made sense when we had a child RenderText object holding the operator. 30 31 Lastly, AccessibilityRenderObject::isIgnoredElementWithinMathTree() no 32 longer needs to special-case anonymous operators because they now have 33 MathElementRole. 34 35 Tests: accessibility/math-fenced.html 36 accessibility/math-foreign-content.html 37 38 * accessibility/AccessibilityObject.h: 39 (WebCore::AccessibilityObject::isAnonymousMathOperator): 40 * accessibility/AccessibilityRenderObject.cpp: 41 (WebCore::AccessibilityRenderObject::textUnderElement): 42 (WebCore::AccessibilityRenderObject::stringValue): 43 (WebCore::AccessibilityRenderObject::isMathElement): 44 (WebCore::AccessibilityRenderObject::isAnonymousMathOperator): 45 (WebCore::AccessibilityRenderObject::isIgnoredElementWithinMathTree): 46 * accessibility/AccessibilityRenderObject.h: 47 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 48 (-[WebAccessibilityObjectWrapper role]): 49 * rendering/mathml/RenderMathMLMath.h: 50 * rendering/mathml/RenderMathMLOperator.h: 51 (WebCore::RenderMathMLOperator::textContent): 52 1 53 2016-06-27 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 54 -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r202063 r202497 996 996 virtual String mathFencedCloseString() const { return String(); } 997 997 virtual int mathLineThickness() const { return 0; } 998 virtual bool isAnonymousMathOperator() const { return false; } 998 999 999 1000 // Multiscripts components. -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r202168 r202497 85 85 #include "RenderMathMLBlock.h" 86 86 #include "RenderMathMLFraction.h" 87 #include "RenderMathMLMath.h" 87 88 #include "RenderMathMLOperator.h" 88 89 #include "RenderMathMLRoot.h" … … 636 637 if (isRenderText && m_renderer->isAnonymous() && ancestorsOfType<RenderMathMLOperator>(*m_renderer).first()) 637 638 return downcast<RenderText>(*m_renderer).text(); 639 if (isAnonymousMathOperator()) { 640 UChar operatorChar = downcast<RenderMathMLOperator>(*m_renderer).textContent(); 641 return operatorChar ? String(&operatorChar, 1) : String(); 642 } 638 643 if (is<RenderMathMLOperator>(*m_renderer) && !m_renderer->isAnonymous()) 639 644 return downcast<RenderMathMLOperator>(*m_renderer).element().textContent(); … … 761 766 762 767 if (is<RenderText>(*m_renderer)) 768 return textUnderElement(); 769 770 if (isAnonymousMathOperator()) 763 771 return textUnderElement(); 764 772 … … 3610 3618 return false; 3611 3619 3620 // The mfenced element creates anonymous RenderMathMLOperators which should be treated 3621 // as MathML elements and assigned the MathElementRole so that platform logic regarding 3622 // inclusion and role mapping is not bypassed. 3623 if (isAnonymousMathOperator()) 3624 return true; 3625 3612 3626 return is<MathMLElement>(node()); 3613 3627 } … … 3659 3673 3660 3674 return true; 3675 } 3676 3677 bool AccessibilityRenderObject::isAnonymousMathOperator() const 3678 { 3679 return is<RenderMathMLOperator>(m_renderer) && m_renderer->isAnonymous(); 3661 3680 } 3662 3681 … … 3752 3771 if (!m_renderer) 3753 3772 return true; 3754 3755 // We ignore anonymous renderers inside math blocks. 3756 // 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. 3757 if (m_renderer->isAnonymous()) { 3758 if (m_renderer->isRenderMathMLOperator()) 3759 return false; 3760 for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) { 3761 if (parent->isMathElement()) 3762 return !(m_renderer->isText() && ancestorsOfType<RenderMathMLOperator>(*m_renderer).first()); 3763 } 3764 } 3773 3774 if (is<RenderText>(*m_renderer)) 3775 return false; 3765 3776 3766 3777 // Only math elements that we explicitly recognize should be included … … 3775 3786 } 3776 3787 3777 return false;3788 return m_renderer->isAnonymous() && m_renderer->parent() && is<RenderMathMLBlock>(m_renderer->parent()); 3778 3789 } 3779 3790 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h
r201417 r202497 328 328 String mathFencedCloseString() const override; 329 329 int mathLineThickness() const override; 330 bool isAnonymousMathOperator() const override; 330 331 331 332 // Multiscripts components. -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r202063 r202497 2238 2238 role = StaticTextRole; 2239 2239 2240 // The mfenced element creates anonymous RenderMathMLOperators with no RenderText 2241 // descendants. Because these anonymous renderers are the only accessible objects 2242 // containing the operator, assign StaticTextRole. 2243 if (m_object->isAnonymousMathOperator()) 2244 role = StaticTextRole; 2245 2240 2246 if (role == CanvasRole && m_object->canvasHasFallbackContent()) 2241 2247 role = GroupRole; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h
r200041 r202497 44 44 } 45 45 46 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLMath, isRenderMathMLMath()) 47 46 48 #endif // ENABLE(MATHML) 47 49 #endif // RenderMathMLMath_h -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r202420 r202497 63 63 void updateOperatorProperties(); 64 64 void updateFromElement() final; 65 UChar textContent() const { return m_textContent; } 65 66 66 67 protected: … … 70 71 void setLeadingSpace(LayoutUnit leadingSpace) { m_leadingSpace = leadingSpace; } 71 72 void setTrailingSpace(LayoutUnit trailingSpace) { m_trailingSpace = trailingSpace; } 72 UChar textContent() const { return m_textContent; }73 73 74 74 private:
Note: See TracChangeset
for help on using the changeset viewer.