Bug 159131 - Small refactoring MathMLInlineContainerElement::createElementRenderer
Summary: Small refactoring MathMLInlineContainerElement::createElementRenderer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: MathML (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Frédéric Wang (:fredw)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-26 23:33 PDT by Frédéric Wang (:fredw)
Modified: 2016-06-27 10:34 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.35 KB, patch)
2016-06-27 00:04 PDT, Frédéric Wang (:fredw)
bfulgham: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2016-06-26 23:33:44 PDT
Now that we have merged many of the renderer classes, we can do the same for the creation in MathMLInlineContainerElement::createElementRenderer:

    if (hasTagName(annotation_xmlTag))
        return createRenderer<RenderMathMLRow>(*this, WTFMove(style));
    if (hasTagName(merrorTag) || hasTagName(mphantomTag) || hasTagName(mrowTag) || hasTagName(mstyleTag))
        return createRenderer<RenderMathMLRow>(*this, WTFMove(style));
    if (hasTagName(msubTag))
        return createRenderer<RenderMathMLScripts>(*this, WTFMove(style));
    if (hasTagName(msupTag))
        return createRenderer<RenderMathMLScripts>(*this, WTFMove(style));
    if (hasTagName(msubsupTag))
        return createRenderer<RenderMathMLScripts>(*this, WTFMove(style));
    if (hasTagName(mmultiscriptsTag))
        return createRenderer<RenderMathMLScripts>(*this, WTFMove(style));
    if (hasTagName(moverTag))
        return createRenderer<RenderMathMLUnderOver>(*this, WTFMove(style));
    if (hasTagName(munderTag))
        return createRenderer<RenderMathMLUnderOver>(*this, WTFMove(style));
    if (hasTagName(munderoverTag))
        return createRenderer<RenderMathMLUnderOver>(*this, WTFMove(style));
Comment 1 Frédéric Wang (:fredw) 2016-06-27 00:04:50 PDT
Created attachment 282103 [details]
Patch
Comment 2 Brent Fulgham 2016-06-27 10:22:31 PDT
Comment on attachment 282103 [details]
Patch

Yes -- simplify! r=me.
Comment 3 Brent Fulgham 2016-06-27 10:23:52 PDT
Comment on attachment 282103 [details]
Patch

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

> Source/WebCore/mathml/MathMLInlineContainerElement.cpp:68
> +    if (hasTagName(annotation_xmlTag) || hasTagName(merrorTag) || hasTagName(mphantomTag) || hasTagName(mrowTag) || hasTagName(mstyleTag))

It seems like we should have a templated predicate "hasOneOfTheseTagNames(....)" someday.
Comment 4 Frédéric Wang (:fredw) 2016-06-27 10:34:03 PDT
Committed r202488: <http://trac.webkit.org/changeset/202488>