Bug 159131

Summary: Small refactoring MathMLInlineContainerElement::createElementRenderer
Product: WebKit Reporter: Frédéric Wang (:fredw) <fred.wang>
Component: MathMLAssignee: Frédéric Wang (:fredw) <fred.wang>
Status: RESOLVED FIXED    
Severity: Normal CC: alex, bfulgham, commit-queue, darin, dbarton, mrobinson, svillar
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch bfulgham: review+

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>