Bug 37220

Summary: Adding static method zero() to classes IntPoint and FloatPoint.
Product: WebKit Reporter: Luiz Agostini <luiz>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch none

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.