12017-11-29 Frederic Wang <fwang@igalia.com>
2
3 Improve initialization of script/root type of MathML renderers
4 https://bugs.webkit.org/show_bug.cgi?id=180161
5
6 Reviewed by NOBODY (OOPS!).
7
8 RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the
9 constructors and remained unchanged. This patch refactors a bit the initialization so that
10 these members are changed to const in order to guarantee they are not modified during the
11 life time of the renderer. The patch also includes minor stylistic improvements.
12
13 No new tests, behavior unchanged.
14
15 * rendering/mathml/RenderMathMLRoot.cpp: Add "using" statement for MathMLNames namespace.
16 (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use rootTypeOf() to initialize the m_rootType.
17 (WebCore::RenderMathMLRoot::rootTypeOf): New helper function to determine the kind of root
18 expression from the tag name. Make the comment a real sentence, add an ASSERT and remove the
19 MathMLNames:: namespace.
20 (WebCore::RenderMathMLRoot::isValid const): Rename m_kind to m_rootType.
21 (WebCore::RenderMathMLRoot::getBase const): Ditto.
22 (WebCore::RenderMathMLRoot::getIndex const): Ditto.
23 (WebCore::RenderMathMLRoot::horizontalParameters): Ditto.
24 (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
25 (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto.
26 (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
27 (WebCore::RenderMathMLRoot::paint): Ditto.
28 * rendering/mathml/RenderMathMLRoot.h: Ditto, make m_rootType a const and declare the
29 rootTypeOf() helper function.
30 * rendering/mathml/RenderMathMLScripts.cpp: Add "using" statement for MathMLNames namespace.
31 (WebCore::isPrescriptDelimiter): Remove the MathMLNames:: namespace.
32 (WebCore::RenderMathMLScripts::RenderMathMLScripts): Use scriptTypeOf() to initialize m_scriptType.
33 (WebCore::RenderMathMLScripts::scriptTypeOf): New helper function to determine the kind of
34 scripted expression from the tag name. Make the comment a real sentence and remove the
35 MathMLNames:: namespace.
36 * rendering/mathml/RenderMathMLScripts.h: Make m_scriptType a const and declare the
37 scriptTypeOf() helper function.
38