Bug 92933 - [chromium] Add API to make it possible to request several variants of a WebImage
Summary: [chromium] Add API to make it possible to request several variants of a WebImage
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: Nico Weber
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-01 19:00 PDT by Nico Weber
Modified: 2012-08-03 20:25 PDT (History)
6 users (show)

See Also:


Attachments
Patch (4.78 KB, patch)
2012-08-01 19:01 PDT, Nico Weber
no flags Details | Formatted Diff | Diff
Patch (4.95 KB, patch)
2012-08-02 15:29 PDT, Nico Weber
no flags Details | Formatted Diff | Diff
Patch (4.18 KB, patch)
2012-08-03 14:50 PDT, Nico Weber
no flags Details | Formatted Diff | Diff
Patch (4.17 KB, patch)
2012-08-03 15:02 PDT, Nico Weber
no flags Details | Formatted Diff | Diff
Patch for landing (4.04 KB, patch)
2012-08-03 16:17 PDT, Nico Weber
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Weber 2012-08-01 19:00:37 PDT
[chromium] Add API to make it possible to request several variants of a WebImage
Comment 1 Nico Weber 2012-08-01 19:01:04 PDT
Created attachment 155948 [details]
Patch
Comment 2 Nico Weber 2012-08-01 19:01:18 PDT
Comment on attachment 155948 [details]
Patch

just wip
Comment 3 Nico Weber 2012-08-02 15:29:39 PDT
Created attachment 156181 [details]
Patch
Comment 4 Nico Weber 2012-08-03 14:50:41 PDT
Created attachment 156463 [details]
Patch
Comment 5 WebKit Review Bot 2012-08-03 14:53:06 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 6 Adam Barth 2012-08-03 14:57:12 PDT
Comment on attachment 156463 [details]
Patch

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

> Source/WebKit/chromium/src/WebImageSkia.cpp:92
> +    // This is to protect from malicious favicons. It should be big enough that it's never hit in pracice.
> +    const size_t kMaxFaviconCount = 8;

As written, this function doesn't have anything to do with favicons.  Maybe we should use a different name for this constant?  Also, WebKit doesn't use the k prefix.

> Source/WebKit/chromium/src/WebImageSkia.cpp:100
> +    // Frames are arranged by decreasing size, then decreasing bit depth.
> +    // Keep the first frame at every size, has the highest bit depth.

Is this true of things other than favicons?  I would imagine that a GIF might not follow this rule.
Comment 7 Adam Barth 2012-08-03 14:57:45 PDT
Is this function specific to favicons?  If so, we should put that in the name somewhere.
Comment 8 Nico Weber 2012-08-03 15:02:28 PDT
Thanks!

(In reply to comment #6)
> (From update of attachment 156463 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=156463&action=review
> 
> > Source/WebKit/chromium/src/WebImageSkia.cpp:92
> > +    // This is to protect from malicious favicons. It should be big enough that it's never hit in pracice.
> > +    const size_t kMaxFaviconCount = 8;
> 
> As written, this function doesn't have anything to do with favicons.  Maybe we should use a different name for this constant?  Also, WebKit doesn't use the k prefix.

Change "favicon" to "frame".

WebKit/Source/WTF/wtf/ThreadSpecific.h and a few other places do seem to use it. But constantNamesLikeThis seem most common, so changed to that.

> > Source/WebKit/chromium/src/WebImageSkia.cpp:100
> > +    // Frames are arranged by decreasing size, then decreasing bit depth.
> > +    // Keep the first frame at every size, has the highest bit depth.
> 
> Is this true of things other than favicons?  I would imagine that a GIF might not follow this rule.

WebImage::fromData() above has the same comment.


In practice, these functions are only used for favicon-like functionality at the moment, but they aren't inherently favicon-specific.

The APIs can't be used to get all frames from a gif, but since that's not needed anywhere at the moment I think that's fine?
Comment 9 Nico Weber 2012-08-03 15:02:56 PDT
Created attachment 156466 [details]
Patch
Comment 10 Adam Barth 2012-08-03 15:08:35 PDT
Comment on attachment 156466 [details]
Patch

ok
Comment 11 Darin Fisher (:fishd, Google) 2012-08-03 16:13:41 PDT
Comment on attachment 156466 [details]
Patch

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

> Source/WebKit/chromium/src/WebImageSkia.cpp:119
> +    return result;

nit: you should just be able to write "return frames;" here.  It should auto-convert to WebVector for you.  See the WebVector(const C&) constructor.
Comment 12 Nico Weber 2012-08-03 16:17:28 PDT
Created attachment 156476 [details]
Patch for landing
Comment 13 Nico Weber 2012-08-03 16:17:43 PDT
> nit: you should just be able to write "return frames;" here.  It should auto-convert to WebVector for you.  See the WebVector(const C&) constructor.

Neat! Done.
Comment 14 WebKit Review Bot 2012-08-03 20:25:37 PDT
Comment on attachment 156476 [details]
Patch for landing

Clearing flags on attachment: 156476

Committed r124688: <http://trac.webkit.org/changeset/124688>
Comment 15 WebKit Review Bot 2012-08-03 20:25:42 PDT
All reviewed patches have been landed.  Closing bug.