Render a badge on system preview images
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Apr 2018 01:30:44 +0000 (01:30 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Apr 2018 01:30:44 +0000 (01:30 +0000)
commitba2d523f856c297ee72d09883c9ce321e55d9df1
tree5e9c571d86fa358210271e2ca4ea9ae050876914
parent726d3aa2cb5f44d7cb084f6e34bce603fccfcbaa
Render a badge on system preview images
https://bugs.webkit.org/show_bug.cgi?id=184854
<rdar://problem/39615154>

Reviewed by Tim Horton.

Source/WebCore:

At paint time, if a RenderImage is an image element
which is identified as a system preview, then draw
a little badge in the top right corner.

It is expected that platforms will override the
default rendering with something that identifies
how a system preview will operate. e.g. QuickLook
on Apple systems.

Test: system-preview/badge.html

* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintIntoRect): If we are
a system preview, call RenderTheme to draw a badge.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paintSystemPreviewBadge): A default
implementation that draws a red circle.
* rendering/RenderTheme.h:

LayoutTests:

* system-preview/badge-expected.html: Added.
* system-preview/badge.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/system-preview/badge-expected.html [new file with mode: 0644]
LayoutTests/system-preview/badge.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h