Bug 184854 - Render a badge on system preview images
Summary: Render a badge on system preview images
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-04-20 17:51 PDT by Dean Jackson
Modified: 2018-04-20 18:35 PDT (History)
3 users (show)

See Also:


Attachments
Patch (6.66 KB, patch)
2018-04-20 18:14 PDT, Dean Jackson
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2018-04-20 17:51:05 PDT
Render a badge on system preview images
Comment 1 Radar WebKit Bug Importer 2018-04-20 17:51:41 PDT
<rdar://problem/39615154>
Comment 2 Dean Jackson 2018-04-20 18:14:48 PDT
Created attachment 338503 [details]
Patch
Comment 3 Tim Horton 2018-04-20 18:19:38 PDT
Comment on attachment 338503 [details]
Patch

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

> Source/WebCore/rendering/RenderTheme.cpp:1374
> +    auto roundedMarkerRect = FloatRoundedRect { markerRect, { 8, 8 }, { 8, 8 }, { 8, 8 }, { 8, 8 } };

There is a single-float uniform radii constructor
Comment 4 zalan 2018-04-20 18:22:26 PDT
Comment on attachment 338503 [details]
Patch

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

> Source/WebCore/rendering/RenderTheme.cpp:1360
> +void RenderTheme::paintSystemPreviewBadge(Image& image, const PaintInfo& paintInfo, const FloatRect& rect)

const Image&

> Source/WebCore/rendering/RenderTheme.cpp:1375
> +    auto markerRect = FloatRect {rect.x() + rect.width() - 24, rect.y() + 8, 16, 16 };
> +    auto roundedMarkerRect = FloatRoundedRect { markerRect, { 8, 8 }, { 8, 8 }, { 8, 8 }, { 8, 8 } };
> +    auto color = Color { 255, 0, 0 };

How do these hardcoded values work in scaled context?
Comment 5 Tim Horton 2018-04-20 18:28:43 PDT
Comment on attachment 338503 [details]
Patch

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

>> Source/WebCore/rendering/RenderTheme.cpp:1375
>> +    auto color = Color { 255, 0, 0 };
> 
> How do these hardcoded values work in scaled context?

Assuming the badge should scale up, they'll be fine!
Comment 6 Dean Jackson 2018-04-20 18:32:05 PDT
Committed r230872: <https://trac.webkit.org/changeset/230872>
Comment 7 Dean Jackson 2018-04-20 18:35:28 PDT
(In reply to Tim Horton from comment #5)
> Comment on attachment 338503 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=338503&action=review
> 
> >> Source/WebCore/rendering/RenderTheme.cpp:1375
> >> +    auto color = Color { 255, 0, 0 };
> > 
> > How do these hardcoded values work in scaled context?
> 
> Assuming the badge should scale up, they'll be fine!

Yep, the badge should scale with the image.

The one we'll implement for Apple is specified to be 10% of the image height.