Bug 160542

Summary: Rename MathMLTextElement to MathMLTokenElement
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, darin
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 160540    
Bug Blocks: 160543    
Attachments:
Description Flags
Patch
none
Patch darin: review+

Frédéric Wang (:fredw)
Reported 2016-08-04 03:05:15 PDT
MathMLTextElement is not a very good name: these elements may contain non-text content, the text-only element annotation is handled in a separate class after 160540 and the name does not match the associated renderer RenderMathMLToken. We should probably rename it MathMLTokenElement.
Attachments
Patch (26.12 KB, patch)
2016-08-04 03:18 PDT, Frédéric Wang (:fredw)
no flags
Patch (26.15 KB, patch)
2016-08-21 05:48 PDT, Frédéric Wang (:fredw)
darin: review+
Frédéric Wang (:fredw)
Comment 1 2016-08-04 03:18:07 PDT
Frédéric Wang (:fredw)
Comment 2 2016-08-04 03:26:48 PDT
Comment on attachment 285310 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=285310&action=review > Source/WebCore/CMakeLists.txt:2002 > + mathml/MathMLTokenElement.cpp I forgot to update Source/WebCore/mathml/MathMLAllInOne.cpp here too.
Frédéric Wang (:fredw)
Comment 3 2016-08-21 05:48:40 PDT
Darin Adler
Comment 4 2016-08-21 17:21:39 PDT
Comment on attachment 286564 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=286564&action=review > Source/WebCore/mathml/MathMLTokenElement.cpp:31 > +#if ENABLE(MATHML) > +#include "MathMLTokenElement.h" There should be a blank line between these two lines. I know sometimes we do a different style, but I think we should do this consistently; easier to mentally chunk when the #if is not grouped with one line of what’s inside the #if. > Source/WebCore/mathml/MathMLTokenElement.cpp:55 > + if (is<RenderMathMLToken>(renderer())) > + downcast<RenderMathMLToken>(*renderer()).updateTokenContent(); We should not make a habit of calling renderer() multiple times; it does include a branch. Maybe the compiler is smart enough to not do the work twice, but generally I put it into a local variable for code like this (and the similar code in the next two functions). > Source/WebCore/mathml/MathMLTokenElement.h:31 > +#if ENABLE(MATHML) > +#include "MathMLElement.h" There should be a blank line between these two lines. > Source/WebCore/mathml/MathMLTokenElement.h:38 > + bool acceptsMathVariantAttribute() final { return true; } Seems to me this should be private. If it’s a final function, no one would have a reason to call it on a MathMLTokenElement& since it would just always return true and thus no need for it to be a public function. Unless there is some template idiom where this actually needs to be called.
Frédéric Wang (:fredw)
Comment 5 2016-08-22 08:18:45 PDT
(In reply to comment #4) > > Source/WebCore/mathml/MathMLTokenElement.cpp:31 > > +#if ENABLE(MATHML) > > +#include "MathMLTokenElement.h" > > There should be a blank line between these two lines. I know sometimes we do > a different style, but I think we should do this consistently; easier to > mentally chunk when the #if is not grouped with one line of what’s inside > the #if. For that one, check-webkit-style complains with the following message: ERROR: Source/WebCore/mathml/MathMLTokenElement.cpp:32: You should not add a blank line before implementation file's own header. [build/include_order] [4] Total errors found: 1 in 11 files
Frédéric Wang (:fredw)
Comment 6 2016-08-22 08:20:04 PDT
Darin Adler
Comment 7 2016-08-22 23:09:50 PDT
(In reply to comment #5) > (In reply to comment #4) > > > Source/WebCore/mathml/MathMLTokenElement.cpp:31 > > > +#if ENABLE(MATHML) > > > +#include "MathMLTokenElement.h" > > > > There should be a blank line between these two lines. I know sometimes we do > > a different style, but I think we should do this consistently; easier to > > mentally chunk when the #if is not grouped with one line of what’s inside > > the #if. > > For that one, check-webkit-style complains with the following message: > > ERROR: Source/WebCore/mathml/MathMLTokenElement.cpp:32: You should not add > a blank line before implementation file's own header. [build/include_order] > [4] > Total errors found: 1 in 11 files Two thoughts: 1) That error message from check-webkit-style is wrong. 2) We don't need to fix that, though, because the preferred style is probably this: #include "config.h" #include "MathMLTokenElement.h" #if ENABLE(MATHML) #include "OtherHeader.h" ...
Frédéric Wang (:fredw)
Comment 8 2016-08-23 00:56:35 PDT
(In reply to comment #7) > 2) We don't need to fix that, though, because the preferred style is > probably this: > > #include "config.h" > #include "MathMLTokenElement.h" > > #if ENABLE(MATHML) > > #include "OtherHeader.h" > ... OK, that does not seem to be what is done in the MathML code so I'll open a follow-up bug to fix that.
Note You need to log in before you can comment on or make changes to this bug.