Bug 79063 - MathML internals - code clean-up for RenderMathMLSubSup
Summary: MathML internals - code clean-up for RenderMathMLSubSup
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: MathML (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-20 18:17 PST by Dave Barton
Modified: 2012-02-20 22:00 PST (History)
2 users (show)

See Also:


Attachments
Patch (6.52 KB, patch)
2012-02-20 18:27 PST, Dave Barton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Barton 2012-02-20 18:17:48 PST
MathML internals - code clean-up for RenderMathMLSubSup
Comment 1 Dave Barton 2012-02-20 18:27:17 PST
Created attachment 127890 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-02-20 19:20:10 PST
Comment on attachment 127890 [details]
Patch

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

I think this is OK, but could be made a bit more clear.  Are you willing to go another round of cleanup before moving foward?

> Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp:-149
> -                if (top->isBoxModelObject()) {
> -                    RenderBoxModelObject* topBox = toRenderBoxModelObject(top);
> -                    topBox->updateBoxModelInfoFromStyle();
> -                }

We no longer need this update?

> Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp:151
> +    if (m_kind == SubSup && m_scripts) {

It would be better to early return so we didn't have to indent the whole rest of this function?

> Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp:153
> +            LayoutUnit heightDiff = (m_scripts->offsetHeight() - base->offsetHeight()) / 2;

heightDiff sounds like a strange name for this half-height diff?
Comment 3 Eric Seidel (no email) 2012-02-20 19:20:36 PST
Mostly we need to explain why deleting the update line is OK.
Comment 4 Dave Barton 2012-02-20 20:19:50 PST
Comment on attachment 127890 [details]
Patch

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

I appreciate your review & judgment and will do any changes you still want. In the next patch though this stretchToHeight() formatting code & the code in layout() will be combined and revised.

>> Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp:-149
>> -                }
> 
> We no longer need this update?

There's an old message from David Hyatt on webkit-dev saying that updateBoxModelInfoFromStyle() is an
internal method to styleWillChange()/styleDidChange() and should be considered private.
The supWrapper->setNeedsLayout(true) on new line 141 will cause these margins to be used, right?

>> Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp:151
>> +    if (m_kind == SubSup && m_scripts) {
> 
> It would be better to early return so we didn't have to indent the whole rest of this function?

I didn't want to rewrite too much. Also we could change someday to doing our own layout() of msub or msup also, instead
of using CSS vertical-align sub/super. That way we could get the baselines of msub or msup to be the same as the baselines
of subscripts & superscripts in <msubsup>s, maybe.

>> Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp:153
>> +            LayoutUnit heightDiff = (m_scripts->offsetHeight() - base->offsetHeight()) / 2;
> 
> heightDiff sounds like a strange name for this half-height diff?

This variable is going away in the next patch. I just left the name as is for now.
Comment 5 Eric Seidel (no email) 2012-02-20 20:21:20 PST
Comment on attachment 127890 [details]
Patch

I'm very happy to approve this as a first-iteration patch.  Small patches are always the best way to work, and I certainly wouldn't want to discourage you from such!  Thank you for your responses and I look forward to the next patch.
Comment 6 WebKit Review Bot 2012-02-20 22:00:36 PST
Comment on attachment 127890 [details]
Patch

Clearing flags on attachment: 127890

Committed r108302: <http://trac.webkit.org/changeset/108302>
Comment 7 WebKit Review Bot 2012-02-20 22:00:40 PST
All reviewed patches have been landed.  Closing bug.