Bug 37220 - Adding static method zero() to classes IntPoint and FloatPoint.
Summary: Adding static method zero() to classes IntPoint and FloatPoint.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-07 11:05 PDT by Luiz Agostini
Modified: 2010-04-07 14:53 PDT (History)
2 users (show)

See Also:


Attachments
Patch (1.12 KB, patch)
2010-04-07 11:09 PDT, Luiz Agostini
no flags Details | Formatted Diff | Diff
Patch (1.88 KB, patch)
2010-04-07 13:17 PDT, Luiz Agostini
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luiz Agostini 2010-04-07 11:05:17 PDT
Adding static method zeroPoint to class IntPoint.
Comment 1 Luiz Agostini 2010-04-07 11:09:57 PDT
Created attachment 52757 [details]
Patch
Comment 2 Darin Adler 2010-04-07 12:41:48 PDT
Comment on attachment 52757 [details]
Patch

If it's a class member, then it's IntPoint::zeroPoint(), which is worse than IntPoint(). I think we either need it to be:

    inline IntPoint zeroIntPoint() { return IntPoint(); }

Or:

    static IntPoint zero() { return IntPoint(); }

So we don't repeat the word point twice.

I also think we should do this for FloatPoint too.
Comment 3 Darin Adler 2010-04-07 12:54:46 PDT
(In reply to comment #2)
>     inline IntPoint zeroIntPoint() { return IntPoint(); }

Outside the class, so it would be "zeroIntPoint()" at the call site.

>     static IntPoint zero() { return IntPoint(); }

Inside the class, so it would be "IntPoint::zero()" at the call site.
Comment 4 Luiz Agostini 2010-04-07 13:17:37 PDT
Created attachment 52776 [details]
Patch
Comment 5 Darin Adler 2010-04-07 14:10:01 PDT
Comment on attachment 52776 [details]
Patch

Thanks for implementing my suggestion. I think using this at various call sites instead of IntPoint() or IntPoint(0, 0) will make things a little more readable.
Comment 6 WebKit Commit Bot 2010-04-07 14:53:34 PDT
Comment on attachment 52776 [details]
Patch

Clearing flags on attachment: 52776

Committed r57236: <http://trac.webkit.org/changeset/57236>
Comment 7 WebKit Commit Bot 2010-04-07 14:53:41 PDT
All reviewed patches have been landed.  Closing bug.