Bug 104107

Summary: [WK2] Move button image to injected bundle
Product: WebKit Reporter: Jon Lee <jonlee>
Component: WebKit Misc.Assignee: Jon Lee <jonlee>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, ap, beidson, dglazkov, eric, gtk-ews, mjs, ojan.autocc, ojan, sam, simon.fraser, webkit-bug-importer, webkit-ews, webkit.review.bot, xan.lopez
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.8   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch simon.fraser: review+

Jon Lee
Reported 2012-12-05 03:10:57 PST
Allow the bundle to specify the images to use.
Attachments
Patch (75.53 KB, patch)
2012-12-05 03:33 PST, Jon Lee
no flags
Patch (75.50 KB, patch)
2012-12-05 03:52 PST, Jon Lee
no flags
Patch (75.57 KB, patch)
2012-12-05 09:02 PST, Jon Lee
no flags
Patch (74.29 KB, patch)
2012-12-07 04:15 PST, Jon Lee
no flags
Patch (26.18 KB, patch)
2012-12-07 09:21 PST, Jon Lee
no flags
Patch (47.24 KB, patch)
2012-12-07 09:32 PST, Jon Lee
simon.fraser: review+
Radar WebKit Bug Importer
Comment 1 2012-12-05 03:11:25 PST
Jon Lee
Comment 2 2012-12-05 03:33:58 PST
Early Warning System Bot
Comment 3 2012-12-05 03:40:02 PST
Early Warning System Bot
Comment 4 2012-12-05 03:40:43 PST
Jon Lee
Comment 5 2012-12-05 03:52:43 PST
Early Warning System Bot
Comment 6 2012-12-05 03:58:11 PST
WebKit Review Bot
Comment 7 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
Peter Beverloo (cr-android ews)
Comment 8 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
Build Bot
Comment 9 2012-12-05 04:25:38 PST
EFL EWS Bot
Comment 10 2012-12-05 05:06:24 PST
kov's GTK+ EWS bot
Comment 11 2012-12-05 08:24:58 PST
Jon Lee
Comment 12 2012-12-05 09:02:35 PST
Jon Lee
Comment 13 2012-12-07 04:15:09 PST
Jon Lee
Comment 14 2012-12-07 09:21:03 PST
Jon Lee
Comment 15 2012-12-07 09:32:14 PST
Simon Fraser (smfr)
Comment 16 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?
Jon Lee
Comment 17 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.
Jon Lee
Comment 18 2012-12-09 02:44:05 PST
Note You need to log in before you can comment on or make changes to this bug.