Bug 159213

Summary: Move MathML-specific code into a separate accessibility class
Product: WebKit Reporter: Frédéric Wang (:fredw) <fred.wang>
Component: AccessibilityAssignee: Frédéric Wang (:fredw) <fred.wang>
Status: RESOLVED FIXED    
Severity: Normal CC: cfleizach, jdiggs, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 161081    
Attachments:
Description Flags
WIP Patch
none
Patch cfleizach: review+

Description Frédéric Wang (:fredw) 2016-06-28 09:09:58 PDT
Currently, MathML is completely handled in the generic AccessibilityRenderObject and it's sometimes not very convenient to work with. We could improve the organization a bit and move MathML-specific code into a separate AccessibilityMathMLElement class:

1) textUnderElement

  The case isAnonymousMathOperator() can be moved into AccessibilityMathMLElement.

2) computeAccessibilityIsIgnored (and its helper function isIgnoredElementWithinMathTree)

   We can easily return the boolean value for math elements. However, we also ignore anonymous RenderBlock inside MathML which are *not* mathml renderers, so some special handling must be kept in AccessibilityRenderObject.

3) determineAccessibilityRole

   We can move the mapping mathTag => DocumentMathRole into AccessibilityMathMLElement.

4) All the other math functions (isMathElement, mathRadicandObject etc) can directly be moved into AccessibilityMathMLElement.
Comment 1 Radar WebKit Bug Importer 2016-06-28 09:10:32 PDT
<rdar://problem/27056316>
Comment 2 Frédéric Wang (:fredw) 2016-06-28 10:13:25 PDT
Created attachment 282253 [details]
WIP Patch
Comment 3 Frédéric Wang (:fredw) 2016-06-28 23:20:36 PDT
Created attachment 282323 [details]
Patch
Comment 4 Frédéric Wang (:fredw) 2016-07-07 15:41:10 PDT
@Chris: can you please take a look at this patch?
Comment 5 chris fleizach 2016-07-07 17:55:53 PDT
Comment on attachment 282323 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=282323&action=review

> Source/WebCore/accessibility/AccessibilityMathMLElement.cpp:146
> +    if (!m_renderer || !m_renderer->isRenderMathMLOperator())

this can be written in one line
Comment 6 Frédéric Wang (:fredw) 2016-07-07 22:52:05 PDT
Committed r202961: <http://trac.webkit.org/changeset/202961>