Bug 62867 - Update GraphicsContextSkia when the Chromium platform is Mac
Summary: Update GraphicsContextSkia when the Chromium platform is Mac
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Cary Clark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-17 08:31 PDT by Cary Clark
Modified: 2011-06-21 11:05 PDT (History)
2 users (show)

See Also:


Attachments
Patch (3.67 KB, patch)
2011-06-17 08:36 PDT, Cary Clark
no flags Details | Formatted Diff | Diff
Patch (4.27 KB, patch)
2011-06-21 07:53 PDT, Cary Clark
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cary Clark 2011-06-17 08:31:44 PDT
Update GraphicsContextSkia when the Chromium platform is Mac
Comment 1 Cary Clark 2011-06-17 08:36:38 PDT
Created attachment 97604 [details]
Patch
Comment 2 Eric Seidel (no email) 2011-06-20 13:35:57 PDT
Comment on attachment 97604 [details]
Patch

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

It's very unclear to me what code we're trying to share vs. not here.  Would be more clear if the #ifdefed code was pulled off into static functions.

> Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp:556
> +#if PLATFORM(CHROMIUM) && OS(DARWIN)
> +    float radius = (width - 1) / 2.0f;
> +    int outer = width;
> +    float inner = (width) / 2.0f;
> +    const SkScalar focusRingOutset = (width / 2.0f) + 0.25f;
> +#else
>      const SkScalar focusRingOutset = WebCoreFloatToSkScalar(0.5);
> +#endif

I think I would have abstracted this into a static inline focusRingOutset(width) function.
Comment 3 Cary Clark 2011-06-21 07:53:46 PDT
Created attachment 97988 [details]
Patch
Comment 4 Cary Clark 2011-06-21 07:56:17 PDT
Comment on attachment 97604 [details]
Patch

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

>> Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp:556
>> +#endif
> 
> I think I would have abstracted this into a static inline focusRingOutset(width) function.

Done.
Comment 5 Eric Seidel (no email) 2011-06-21 10:31:09 PDT
Comment on attachment 97988 [details]
Patch

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

This looks much nicer.  Thank you.

> Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp:579
> +    const SkScalar focusRingOutset = getFocusRingOutset(width);

WebKit style doesn't use "get" in method names.
Comment 6 Eric Seidel (no email) 2011-06-21 10:31:53 PDT
I guess I generalized a little:

http://www.webkit.org/coding/coding-style.html:

Precede setters with the word "set". Use bare words for getters. Setter and getter names should match the names of the variables being set/gotten.
Right:
void setCount(size_t); // sets m_count
size_t count(); // returns m_count
Wrong:
void setCount(size_t); // sets m_theCount
size_t getCount();
Comment 7 Eric Seidel (no email) 2011-06-21 10:32:53 PDT
Comment on attachment 97988 [details]
Patch

I'm not sure it's worth the round-trip for just the "get" though.
Comment 8 Cary Clark 2011-06-21 10:37:23 PDT
I imagine I will have to continue to tweak this code to make the look of the focus ring better -- I'm happy to rename it to remove the 'get' the next time I'm in there.
Comment 9 WebKit Review Bot 2011-06-21 11:05:20 PDT
Comment on attachment 97988 [details]
Patch

Clearing flags on attachment: 97988

Committed r89366: <http://trac.webkit.org/changeset/89366>
Comment 10 WebKit Review Bot 2011-06-21 11:05:25 PDT
All reviewed patches have been landed.  Closing bug.