Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Issue 19856004: Adds WebElement::imageContents() (Closed)

Created:
7 years, 5 months ago by jamesr
Modified:
7 years, 4 months ago
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, abarth-chromium, eseidel
Visibility:
Public.

Description

Adds WebElement::imageContents() This function returns the image contents for a given WebElement, if there is appropriate image data. This can be useful for implementing context-menu based actions on images. Currently it only fetches bitmap data for <img>s, but we could extend it to other image-like nodes if we wanted to. R=darin@chromium.org, esprehn@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=155179

Patch Set 1 #

Patch Set 2 : put it on WebNode since we retain the context menu node #

Total comments: 2

Patch Set 3 : put image fetching logic in WebCore::Element, add basic smoke test #

Total comments: 1

Patch Set 4 : move imageContents() call down to WebElement #

Total comments: 2

Patch Set 5 : fix webkit_test_support in static build, it needs to depend on skia so the SkBitma.h include works #

Unified diffs Side-by-side diffs Delta from patch set Stats (+59 lines, -1 line) Patch
M Source/WebKit/chromium/WebKit.gyp View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/Element.h View 1 2 2 chunks +2 lines, -0 lines 0 comments Download
M Source/core/html/HTMLImageElement.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/html/HTMLImageElement.cpp View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
M Source/web/WebElement.cpp View 1 2 3 1 chunk +16 lines, -0 lines 0 comments Download
M Source/web/WebNode.cpp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/web/tests/WebFrameTest.cpp View 1 2 3 1 chunk +23 lines, -0 lines 0 comments Download
M public/web/WebElement.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M public/web/WebNode.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
jamesr
Darin - I need to write tests, but what do you think of this API?
7 years, 5 months ago (2013-07-25 21:49:58 UTC) #1
darin (slow to review)
LGTM I'm curious about the cases where the image might be null. I assume if ...
7 years, 5 months ago (2013-07-25 22:18:44 UTC) #2
jamesr
I believe this could return an empty WebImage if: 1.) The WebNode is null 2.) ...
7 years, 5 months ago (2013-07-25 22:27:19 UTC) #3
darin (slow to review)
Makes sense. The DIV overlay case might be one of those annoying things to workaround ...
7 years, 5 months ago (2013-07-25 22:38:21 UTC) #4
esprehn
https://codereview.chromium.org/19856004/diff/2001/Source/web/WebNode.cpp File Source/web/WebNode.cpp (right): https://codereview.chromium.org/19856004/diff/2001/Source/web/WebNode.cpp#newcode269 Source/web/WebNode.cpp:269: WebCore::Image* image = cachedImage->imageForRenderer(renderer); This should be a method ...
7 years, 5 months ago (2013-07-25 22:52:03 UTC) #5
jamesr
https://codereview.chromium.org/19856004/diff/2001/Source/web/WebNode.cpp File Source/web/WebNode.cpp (right): https://codereview.chromium.org/19856004/diff/2001/Source/web/WebNode.cpp#newcode269 Source/web/WebNode.cpp:269: WebCore::Image* image = cachedImage->imageForRenderer(renderer); On 2013/07/25 22:52:03, esprehn wrote: ...
7 years, 4 months ago (2013-07-26 17:54:33 UTC) #6
jamesr
This puts the imageContents() logic down in WebCore::Element, where we can specialize it as necessary. ...
7 years, 4 months ago (2013-07-30 00:47:52 UTC) #7
esprehn
On 2013/07/30 00:47:52, jamesr wrote: > This puts the imageContents() logic down in WebCore::Element, where ...
7 years, 4 months ago (2013-07-30 00:49:23 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jamesr@chromium.org/19856004/12001
7 years, 4 months ago (2013-07-30 01:14:27 UTC) #9
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 4 months ago (2013-07-30 04:28:35 UTC) #10
darin (slow to review)
https://codereview.chromium.org/19856004/diff/12001/Source/web/WebNode.cpp File Source/web/WebNode.cpp (right): https://codereview.chromium.org/19856004/diff/12001/Source/web/WebNode.cpp#newcode260 Source/web/WebNode.cpp:260: RefPtr<Element> element = unwrap<Element>(); nit: perhaps we should have ...
7 years, 4 months ago (2013-07-30 05:02:41 UTC) #11
jamesr1
That'd just move the type check to the caller, wouldn't it? On Jul 29, 2013 ...
7 years, 4 months ago (2013-07-30 05:06:31 UTC) #12
darin (slow to review)
Perhaps. If you get the WebElement using an API that provides you a WebElement, then ...
7 years, 4 months ago (2013-07-30 05:36:48 UTC) #13
jamesr
On 2013/07/30 05:36:48, darin wrote: > Perhaps. If you get the WebElement using an API ...
7 years, 4 months ago (2013-07-30 19:31:26 UTC) #14
darin (slow to review)
It's possible that the context node should really be a WebElement as well. Although perhaps ...
7 years, 4 months ago (2013-07-30 19:33:04 UTC) #15
darin (slow to review)
LGTM, just fix nits: https://codereview.chromium.org/19856004/diff/35001/Source/web/WebNode.cpp File Source/web/WebNode.cpp (right): https://codereview.chromium.org/19856004/diff/35001/Source/web/WebNode.cpp#newcode52 Source/web/WebNode.cpp:52: #include "core/rendering/RenderImage.h" nit: not needed ...
7 years, 4 months ago (2013-07-30 19:38:47 UTC) #16
jamesr
On 2013/07/30 19:33:04, darin wrote: > It's possible that the context node should really be ...
7 years, 4 months ago (2013-07-30 19:39:50 UTC) #17
darin (slow to review)
Yeah, makes sense. I assume the plan is to worry about such heuristics later. -Darin ...
7 years, 4 months ago (2013-07-30 19:41:52 UTC) #18
jamesr
7 years, 4 months ago (2013-07-30 21:36:44 UTC) #19
Message was sent while issue was closed.
Committed patchset #5 manually as r155179 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698