Bug 88837 - [Chromium] Add WebDocument.images
Summary: [Chromium] Add WebDocument.images
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: Nobody
URL:
Keywords:
Depends on:
Blocks: 66687
  Show dependency treegraph
 
Reported: 2012-06-11 22:36 PDT by Jesse Greenwald
Modified: 2012-06-13 23:32 PDT (History)
6 users (show)

See Also:


Attachments
Patch (2.59 KB, patch)
2012-06-12 16:09 PDT, Jesse Greenwald
no flags Details | Formatted Diff | Diff
Patch (2.61 KB, patch)
2012-06-13 11:36 PDT, Jesse Greenwald
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Greenwald 2012-06-11 22:36:08 PDT
This is an API needed for Chrome.
Comment 1 Jesse Greenwald 2012-06-12 16:09:40 PDT
Created attachment 147184 [details]
Patch
Comment 2 WebKit Review Bot 2012-06-12 16:11:52 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 3 James Robinson 2012-06-12 16:14:53 PDT
(In reply to comment #0)
> This is an API needed for Chrome.

Why?
Comment 4 Adam Barth 2012-06-12 19:43:40 PDT
Comment on attachment 147184 [details]
Patch

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

A few minor nits below.  The main thing to improve about this patch is the ChangeLog.  The ChangeLog should explain why we're making this change.  In this case, I suspect the reason is that this API is needed by Chrome on Android for some purpose.  It would be nice to elaborate a bit about that purpose, if you're able to.

In the particular case of this patch, it's not a big deal because we're mirroring a long-established DOM API, but it's still a good practice when contributing to WebKit.

Thanks for the patch!

> Source/WebKit/chromium/src/WebDocument.cpp:142
> +void WebDocument::images(WebVector<WebElement>& results) const

Why "const"?  You're ending up const_casting the Document anyway.  It seems better to model this after body() and head() and skip the const.

> Source/WebKit/chromium/src/WebDocument.cpp:150
> +        // Strange but true, sometimes node can be 0.

I'd skip this comment.  WebKit usually only includes comments if they something about why the code is the way it is.
Comment 5 Jesse Greenwald 2012-06-13 10:57:40 PDT
Comment on attachment 147184 [details]
Patch

I'll expand on the ChangeLog when I upload the next patch.  Thanks for taking a look!


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

>> Source/WebKit/chromium/src/WebDocument.cpp:142
>> +void WebDocument::images(WebVector<WebElement>& results) const
> 
> Why "const"?  You're ending up const_casting the Document anyway.  It seems better to model this after body() and head() and skip the const.

I originally modeled this after forms(), which is const.  Actually, isn't body() const as well?  Either way, I can remove const from this method.

>> Source/WebKit/chromium/src/WebDocument.cpp:150
>> +        // Strange but true, sometimes node can be 0.
> 
> I'd skip this comment.  WebKit usually only includes comments if they something about why the code is the way it is.

Ok.  For reference, the comment was copied from forms().
Comment 6 Adam Barth 2012-06-13 10:59:27 PDT
Yeah, you're discovering that WebDocument.cpp was written a long time ago and we've learned a bunch since then.  :)
Comment 7 Jesse Greenwald 2012-06-13 11:36:51 PDT
Created attachment 147374 [details]
Patch
Comment 8 Adam Barth 2012-06-13 11:40:00 PDT
Comment on attachment 147374 [details]
Patch

Thanks!
Comment 9 WebKit Review Bot 2012-06-13 23:32:04 PDT
Comment on attachment 147374 [details]
Patch

Clearing flags on attachment: 147374

Committed r120284: <http://trac.webkit.org/changeset/120284>
Comment 10 WebKit Review Bot 2012-06-13 23:32:09 PDT
All reviewed patches have been landed.  Closing bug.