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

Issue 2723093004: Adds SVGImageElement as a CanvasImageSource (Closed)

Created:
3 years, 9 months ago by fserb
Modified:
3 years, 9 months ago
Reviewers:
esprehn, fs, Justin Novosad
CC:
ajuma+watch-canvas_chromium.org, blink-reviews, blink-reviews-bindings_chromium.org, blink-reviews-html_chromium.org, Rik, chromium-reviews, dglazkov+blink, dshwang, krit, fmalita+watch_chromium.org, fs, gyuyoung2, haraken, kouhei+svg_chromium.org, pdr+svgwatchlist_chromium.org, rwlbuis, Stephen Chennney
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Adds SVGImageElement to CanvasImageSource Relevant spec: https://html.spec.whatwg.org/multipage/scripting.html#image-sources-for-2d-rendering-contexts:htmlorsvgimageelement SVGImageElement should be part of CanvasImageSource union typedef, i.e., be allowed as an source for drawImage(). This CL does that, while creating a common interface for both HTMLImageElement and SVGImageElement. BUG=695662 Review-Url: https://codereview.chromium.org/2723093004 Cr-Commit-Position: refs/heads/master@{#459289} Committed: https://chromium.googlesource.com/chromium/src/+/11a275c5522ae4dbf8e3dee5c7246e74141b5142

Patch Set 1 #

Patch Set 2 : Comments #

Patch Set 3 : y #

Total comments: 6

Patch Set 4 : Tests added #

Total comments: 4

Patch Set 5 : Refactored Canvas code out #

Total comments: 27

Patch Set 6 : Refactored, added tests #

Total comments: 21

Patch Set 7 : Review #

Patch Set 8 : Updated LayoutTest #

Patch Set 9 : Fixed more tests #

Patch Set 10 : Replaced circle with squares #

Patch Set 11 : Moved from circle to rect, to avoid aliasing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+337 lines, -108 lines) Patch
M third_party/WebKit/LayoutTests/canvas/philip/tests/2d.pattern.image.string-expected.txt View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/canvas/philip/tests/2d.pattern.image.undefined-expected.txt View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
A third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg.html View 1 2 3 4 5 6 7 8 9 1 chunk +49 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html View 1 2 3 4 5 6 7 8 9 1 chunk +31 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/canvas/resources/rect.svg View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html View 1 2 3 4 5 1 chunk +31 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/modules/v8/generated.gni View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/html/BUILD.gn View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLImageElement.h View 1 2 3 4 5 6 4 chunks +5 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLImageElement.cpp View 1 2 3 4 5 6 4 chunks +4 lines, -82 lines 0 comments Download
A third_party/WebKit/Source/core/html/canvas/CanvasImageElementSource.h View 1 2 3 4 5 6 1 chunk +52 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/html/canvas/CanvasImageElementSource.cpp View 1 2 3 4 5 6 1 chunk +126 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/canvas/CanvasImageSource.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGImageElement.h View 1 2 3 4 5 6 3 chunks +6 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGImageElement.cpp View 1 2 3 4 5 6 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.h View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl View 1 2 3 4 5 6 1 chunk +9 lines, -0 lines 0 comments Download

Messages

Total messages: 60 (29 generated)
fserb
3 years, 9 months ago (2017-03-01 19:20:56 UTC) #2
Justin Novosad
Code Looks good modulo tests. https://codereview.chromium.org/2723093004/diff/40001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp File third_party/WebKit/Source/core/svg/SVGImageElement.cpp (right): https://codereview.chromium.org/2723093004/diff/40001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp#newcode212 third_party/WebKit/Source/core/svg/SVGImageElement.cpp:212: if (!cachedImage()) { What ...
3 years, 9 months ago (2017-03-01 20:56:30 UTC) #5
fs
Drive-by https://codereview.chromium.org/2723093004/diff/60001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp File third_party/WebKit/Source/core/svg/SVGImageElement.cpp (right): https://codereview.chromium.org/2723093004/diff/60001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp#newcode207 third_party/WebKit/Source/core/svg/SVGImageElement.cpp:207: PassRefPtr<Image> SVGImageElement::getSourceImageForCanvas( This (and other method implementations) appear ...
3 years, 9 months ago (2017-03-01 21:20:42 UTC) #7
Justin Novosad
On 2017/03/01 21:20:42, fs wrote: > https://codereview.chromium.org/2723093004/diff/60001/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl#newcode31 > third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl:31: // > but there's a problem ...
3 years, 9 months ago (2017-03-01 23:03:20 UTC) #8
Justin Novosad
Oops, previous l-g-t-m was accidental. So to be clear: not lgtm (for now)
3 years, 9 months ago (2017-03-01 23:05:10 UTC) #9
fserb
Refactored CanvasHTMLSVGImage out. PTAL. https://codereview.chromium.org/2723093004/diff/40001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp File third_party/WebKit/Source/core/svg/SVGImageElement.cpp (right): https://codereview.chromium.org/2723093004/diff/40001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp#newcode212 third_party/WebKit/Source/core/svg/SVGImageElement.cpp:212: if (!cachedImage()) { On 2017/03/01 ...
3 years, 9 months ago (2017-03-06 21:05:13 UTC) #12
Justin Novosad
Could you also add tests where the image resource of the svg <image> is an ...
3 years, 9 months ago (2017-03-06 21:37:32 UTC) #15
fs
https://codereview.chromium.org/2723093004/diff/80001/third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html File third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html (right): https://codereview.chromium.org/2723093004/diff/80001/third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html#newcode8 third_party/WebKit/LayoutTests/http/tests/security/canvas-remote-read-remote-svg-image.html:8: stTest.step(function() { On 2017/03/06 at 21:37:32, Justin Novosad wrote: ...
3 years, 9 months ago (2017-03-06 22:46:16 UTC) #18
fserb
Thanks for the comments, it looks much better now. Added a few svg file tests. ...
3 years, 9 months ago (2017-03-07 20:44:03 UTC) #19
fs
https://codereview.chromium.org/2723093004/diff/80001/third_party/WebKit/Source/core/html/canvas/CanvasHTMLSVGImage.cpp File third_party/WebKit/Source/core/html/canvas/CanvasHTMLSVGImage.cpp (right): https://codereview.chromium.org/2723093004/diff/80001/third_party/WebKit/Source/core/html/canvas/CanvasHTMLSVGImage.cpp#newcode106 third_party/WebKit/Source/core/html/canvas/CanvasHTMLSVGImage.cpp:106: return false; On 2017/03/07 at 20:44:02, fserb wrote: > ...
3 years, 9 months ago (2017-03-07 22:01:25 UTC) #22
fserb
fs, just a comment. I'll get to the rest later. https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp File third_party/WebKit/Source/core/svg/SVGImageElement.cpp (right): https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp#newcode199 ...
3 years, 9 months ago (2017-03-08 18:31:59 UTC) #25
fs
https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp File third_party/WebKit/Source/core/svg/SVGImageElement.cpp (right): https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/core/svg/SVGImageElement.cpp#newcode199 third_party/WebKit/Source/core/svg/SVGImageElement.cpp:199: return FloatSize(0, 0); On 2017/03/08 at 18:31:59, fserb wrote: ...
3 years, 9 months ago (2017-03-08 18:57:16 UTC) #26
fs
https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl File third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl (right): https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl#newcode31 third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.idl:31: // but there's a problem with our IDL code ...
3 years, 9 months ago (2017-03-13 13:56:34 UTC) #27
Justin Novosad
I looked at the test failures. They just need to be rebaselined, it seems.
3 years, 9 months ago (2017-03-13 14:16:44 UTC) #28
Justin Novosad
https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html File third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html (right): https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html#newcode25 third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html:25: <circle cx="50%" cy="50%" r="50%" style="fill:blue;" /> This one shows ...
3 years, 9 months ago (2017-03-13 14:22:28 UTC) #29
fserb
Thanks for the comments. https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html File third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html (right): https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html#newcode25 third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg-expected.html:25: <circle cx="50%" cy="50%" r="50%" style="fill:blue;" ...
3 years, 9 months ago (2017-03-21 19:15:22 UTC) #30
fs
LGTM, thanks https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/core/html/HTMLImageElement.h File third_party/WebKit/Source/core/html/HTMLImageElement.h (right): https://codereview.chromium.org/2723093004/diff/100001/third_party/WebKit/Source/core/html/HTMLImageElement.h#newcode200 third_party/WebKit/Source/core/html/HTMLImageElement.h:200: HTMLImageLoader& imageLoader() const override { return *m_imageLoader; ...
3 years, 9 months ago (2017-03-21 21:05:42 UTC) #31
Justin Novosad
lgtm
3 years, 9 months ago (2017-03-21 21:08:57 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2723093004/120001
3 years, 9 months ago (2017-03-21 21:11:17 UTC) #34
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_tsan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_tsan_rel_ng/builds/36591)
3 years, 9 months ago (2017-03-21 21:30:36 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2723093004/120001
3 years, 9 months ago (2017-03-21 21:45:10 UTC) #38
fserb
esprehn: third_party/WebKit/Source/bindings/modules/v8/generated.gni
3 years, 9 months ago (2017-03-21 21:59:20 UTC) #41
esprehn
lgtm
3 years, 9 months ago (2017-03-21 22:37:03 UTC) #42
esprehn
Can you write a better change description and link to some mailing lists or specs?
3 years, 9 months ago (2017-03-21 22:37:26 UTC) #43
fserb
done. thanks.
3 years, 9 months ago (2017-03-22 18:31:08 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2723093004/120001
3 years, 9 months ago (2017-03-22 18:32:14 UTC) #47
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/405876)
3 years, 9 months ago (2017-03-22 20:41:20 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2723093004/160001
3 years, 9 months ago (2017-03-23 19:39:06 UTC) #52
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/413570)
3 years, 9 months ago (2017-03-23 20:52:33 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2723093004/200001
3 years, 9 months ago (2017-03-23 21:26:59 UTC) #57
commit-bot: I haz the power
3 years, 9 months ago (2017-03-24 00:06:10 UTC) #60
Message was sent while issue was closed.
Committed patchset #11 (id:200001) as
https://chromium.googlesource.com/chromium/src/+/11a275c5522ae4dbf8e3dee5c724...

Powered by Google App Engine
This is Rietveld 408576698