Bug 155406 - MathMLMencloseElement style should not depend on rendering
Summary: MathMLMencloseElement style should not depend on rendering
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: MathML (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 155298
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-13 04:38 PDT by Antti Koivisto
Modified: 2016-07-07 08:42 PDT (History)
5 users (show)

See Also:


Attachments
patch (3.56 KB, patch)
2016-03-13 04:43 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2016-03-13 04:38:32 PDT
Style shouldn't depend on rendering.
Comment 1 Antti Koivisto 2016-03-13 04:43:05 PDT
Created attachment 273889 [details]
patch
Comment 2 Frédéric Wang (:fredw) 2016-03-13 04:52:49 PDT
See also the complete refactoring in bug 155019, that will probably make this unnecessary.
Comment 3 Antti Koivisto 2016-03-13 05:57:27 PDT
Yeah, looks much better. We could probably just disable mathml/presentation/menclose-notation-attribute-change-value.html until that lands.
Comment 4 Frédéric Wang (:fredw) 2016-03-13 06:03:33 PDT
(In reply to comment #3)
> Yeah, looks much better. We could probably just disable
> mathml/presentation/menclose-notation-attribute-change-value.html until that
> lands.

Yes, I guess we can do it either way. Just disabling that test is probably the easiest way so that it does not block the work on bug 155298.
Comment 5 Darin Adler 2016-03-13 14:31:44 PDT
Comment on attachment 273889 [details]
patch

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

> Source/WebCore/mathml/MathMLMencloseElement.cpp:134
>      String closingBrace(")", String::ConstructFromLiteral);
>      TextRun run(closingBrace);

We do not need a String to construct a TextRun, which takes a StringView. We can write something more like this:

    LChar rightParenthesis = ')';
    TextRun run({ &rightParenthesis, 1 });

I took the liberty of calling this what the Unicode standard calls it, rather than calling it "closing brace", which seems like it could be the name of some other characters.

> Source/WebCore/mathml/MathMLMencloseElement.cpp:136
> +    const FontCascade& font = parentStyle.fontCascade();
> +    padding.appendNumber(font.width(run));

I don’t think we need a local variable when we are just using it once. In fact, I would write this:

    LChar rightParenthesis = ')';
    padding.appendNumber(parentStyle.fontCascade().width(TextRun{ &rightParenthesis, 1 }));

Might need an extra type name or set of curly brackets in there, but something like that would work. The version with more lines of code seems no more clear to me.

> Source/WebCore/mathml/MathMLMencloseElement.cpp:143
> +String MathMLMencloseElement::longDivLeftPadding() const

This could return a const String& instead of a String to avoid unneeded reference count churn.
Comment 6 Darin Adler 2016-03-13 14:32:14 PDT
Oh, I see, this code is going away. Oops, my comments are overkill.
Comment 7 Frédéric Wang (:fredw) 2016-07-07 08:42:44 PDT
Resolving since this was fixed by https://trac.webkit.org/changeset/199980