Bug 104107 - [WK2] Move button image to injected bundle
Summary: [WK2] Move button image to injected bundle
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.8
: P2 Normal
Assignee: Jon Lee
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-12-05 03:10 PST by Jon Lee
Modified: 2012-12-09 02:44 PST (History)
15 users (show)

See Also:


Attachments
Patch (75.53 KB, patch)
2012-12-05 03:33 PST, Jon Lee
no flags Details | Formatted Diff | Diff
Patch (75.50 KB, patch)
2012-12-05 03:52 PST, Jon Lee
no flags Details | Formatted Diff | Diff
Patch (75.57 KB, patch)
2012-12-05 09:02 PST, Jon Lee
no flags Details | Formatted Diff | Diff
Patch (74.29 KB, patch)
2012-12-07 04:15 PST, Jon Lee
no flags Details | Formatted Diff | Diff
Patch (26.18 KB, patch)
2012-12-07 09:21 PST, Jon Lee
no flags Details | Formatted Diff | Diff
Patch (47.24 KB, patch)
2012-12-07 09:32 PST, Jon Lee
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Lee 2012-12-05 03:10:57 PST
Allow the bundle to specify the images to use.
Comment 1 Radar WebKit Bug Importer 2012-12-05 03:11:25 PST
<rdar://problem/12813842>
Comment 2 Jon Lee 2012-12-05 03:33:58 PST
Created attachment 177713 [details]
Patch
Comment 3 Early Warning System Bot 2012-12-05 03:40:02 PST
Comment on attachment 177713 [details]
Patch

Attachment 177713 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/15159206
Comment 4 Early Warning System Bot 2012-12-05 03:40:43 PST
Comment on attachment 177713 [details]
Patch

Attachment 177713 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/15160179
Comment 5 Jon Lee 2012-12-05 03:52:43 PST
Created attachment 177720 [details]
Patch
Comment 6 Early Warning System Bot 2012-12-05 03:58:11 PST
Comment on attachment 177720 [details]
Patch

Attachment 177720 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/15133796
Comment 7 WebKit Review Bot 2012-12-05 04:07:25 PST
Comment on attachment 177720 [details]
Patch

Attachment 177720 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15152360
Comment 8 Peter Beverloo (cr-android ews) 2012-12-05 04:07:37 PST
Comment on attachment 177720 [details]
Patch

Attachment 177720 [details] did not pass cr-android-ews (chromium-android):
Output: http://queues.webkit.org/results/15152358
Comment 9 Build Bot 2012-12-05 04:25:38 PST
Comment on attachment 177720 [details]
Patch

Attachment 177720 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/15148445
Comment 10 EFL EWS Bot 2012-12-05 05:06:24 PST
Comment on attachment 177720 [details]
Patch

Attachment 177720 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/15152374
Comment 11 kov's GTK+ EWS bot 2012-12-05 08:24:58 PST
Comment on attachment 177720 [details]
Patch

Attachment 177720 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/15159276
Comment 12 Jon Lee 2012-12-05 09:02:35 PST
Created attachment 177766 [details]
Patch
Comment 13 Jon Lee 2012-12-07 04:15:09 PST
Created attachment 178195 [details]
Patch
Comment 14 Jon Lee 2012-12-07 09:21:03 PST
Created attachment 178226 [details]
Patch
Comment 15 Jon Lee 2012-12-07 09:32:14 PST
Created attachment 178228 [details]
Patch
Comment 16 Simon Fraser (smfr) 2012-12-07 13:50:26 PST
Comment on attachment 178228 [details]
Patch

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

> Source/WebCore/page/ChromeClient.h:376
> +        virtual PassRefPtr<Image> generatePlugInStartButtonImage(RenderSnapshottedPlugIn::ButtonSize) const { return 0; }

Why 'generate'? Why not just plugInStartButtonImage() ?

> Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp:138
> +    if (initializedImages[arrayIndex])
> +        return 0;

Is this just to avoid multiple aborted attempts to get the image? Do we expect that ever to happen?

> Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp:154
> +    Image* buttonImage = 0;
> +    if (plugInImageElement()->hovered())
> +        buttonImage = startButtonImage(m_buttonType);

This logic is a bit odd. Why not just early return if not hovered?

> Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp:245
> +    m_buttonRect = tryToFitStartButton(ButtonSizeLarge, rect);
> +    if (!m_buttonRect.isEmpty()) {
> +        m_buttonType = ButtonSizeLarge;
> +        return;
> +    }
> +
> +    m_buttonRect = tryToFitStartButton(ButtonSizeSmall, rect);
> +    if (!m_buttonRect.isEmpty()) {
> +        m_buttonType = ButtonSizeSmall;
> +        return;
> +    }
> +
> +    m_buttonType = NoButton;

I'm not sure why you have to run this logic at layout time. Can't you just choose what to paint at paint time?
Comment 17 Jon Lee 2012-12-07 14:20:34 PST
Comment on attachment 178228 [details]
Patch

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

>> Source/WebCore/page/ChromeClient.h:376
>> +        virtual PassRefPtr<Image> generatePlugInStartButtonImage(RenderSnapshottedPlugIn::ButtonSize) const { return 0; }
> 
> Why 'generate'? Why not just plugInStartButtonImage() ?

Renamed. This was originally connected to the idea that via the WK2 API we have to copy the data to a bitmap image every time we make this call, but since the code already caches those images, this is less important.

>> Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp:138
>> +        return 0;
> 
> Is this just to avoid multiple aborted attempts to get the image? Do we expect that ever to happen?

If a client decides not to provide an image, then we will already ask for it. So I wanted to avoid that. Clients that implement this probably will provide all buttons.

>> Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp:154
>> +        buttonImage = startButtonImage(m_buttonType);
> 
> This logic is a bit odd. Why not just early return if not hovered?

Yes, I've updated the logic here.

>> Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp:245
>> +    m_buttonType = NoButton;
> 
> I'm not sure why you have to run this logic at layout time. Can't you just choose what to paint at paint time?

I thought it might be less performant to do this on every paint, but I can move it. Moving it would also obviate the need for these instance variables.
Comment 18 Jon Lee 2012-12-09 02:44:05 PST
Committed r137067: <http://trac.webkit.org/changeset/137067>