Bug 58362 - Bundle w and tmpW in findNextLineBreak together as a class
Summary: Bundle w and tmpW in findNextLineBreak together as a class
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 57779
  Show dependency treegraph
 
Reported: 2011-04-12 12:45 PDT by Ryosuke Niwa
Modified: 2011-04-12 14:33 PDT (History)
2 users (show)

See Also:


Attachments
cleanup (19.66 KB, patch)
2011-04-12 14:05 PDT, Ryosuke Niwa
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2011-04-12 12:45:11 PDT
This is a cleanup. In this patch, I'm going to rename w, tmpW, and width as committedWidth, uncommittedWidth, and availableWith respectively per Dave's suggestion.  Furthermore, I'm going to create a new LineWidth class out of committedWidth and uncommittedWidth.
Comment 1 Ryosuke Niwa 2011-04-12 14:05:22 PDT
Created attachment 89268 [details]
cleanup
Comment 2 Ryosuke Niwa 2011-04-12 14:07:43 PDT
After this patch, I'll move availableWidth into LineWidth and will merge LineWidth and LineOffsets after that.
Comment 3 Dave Hyatt 2011-04-12 14:10:44 PDT
Comment on attachment 89268 [details]
cleanup

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

This could also be done as a followup, but availableWidth should move into LineWidth as well.  Then you could ask questions like "remainingWidth()" to get availableWidth - currentWidth etc., and lots of these comparisons would get cleaner.

r=me

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1639
> +inline LineWidth::LineWidth()
> +    : m_uncommittedWidth(0)
> +    , m_committedWidth(0)
> +{
> +}

I don't much like this style when the class is so tiny.  I'd just put this right inside the class declaration.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1645
> +inline void LineWidth::commit()
> +{
> +    m_committedWidth += m_uncommittedWidth;
> +    m_uncommittedWidth = 0;
> +}

Same here.  Just put it up where you first declared the function.

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1660
> +    float availableWidth = lineOffsets.width();
> +    LineWidth width;

Any reason not to just merge LineWidth with LineOffsets? They're close enough to one another that I'd just make them a single struct. I guess that could be done in a future patch though.
Comment 4 Ryosuke Niwa 2011-04-12 14:13:47 PDT
(In reply to comment #3)
> (From update of attachment 89268 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=89268&action=review
> 
> This could also be done as a followup, but availableWidth should move into LineWidth as well.  Then you could ask questions like "remainingWidth()" to get availableWidth - currentWidth etc., and lots of these comparisons would get cleaner.

Yup. My plan exactly!

> > Source/WebCore/rendering/RenderBlockLineLayout.cpp:1639
> > +inline LineWidth::LineWidth()
> > +    : m_uncommittedWidth(0)
> > +    , m_committedWidth(0)
> > +{
> > +}
> 
> I don't much like this style when the class is so tiny.  I'd just put this right inside the class declaration.

Okay, will do.

> > Source/WebCore/rendering/RenderBlockLineLayout.cpp:1660
> > +    float availableWidth = lineOffsets.width();
> > +    LineWidth width;
> 
> Any reason not to just merge LineWidth with LineOffsets? They're close enough to one another that I'd just make them a single struct. I guess that could be done in a future patch though.

That's a part of my plan as well :)
Comment 5 Ryosuke Niwa 2011-04-12 14:33:03 PDT
Committed r83640: <http://trac.webkit.org/changeset/83640>