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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg.html

Issue 2723093004: Adds SVGImageElement as a CanvasImageSource (Closed)
Patch Set: Moved from circle to rect, to avoid aliasing Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg.html
new file mode 100644
index 0000000000000000000000000000000000000000..243b1f23bcc981ec47b76bebf871a5552350b1fb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-svg.html
@@ -0,0 +1,49 @@
+<!doctype html>
+<style>
+svg {
+ display: none;
+}
+canvas {
+ border: 1px solid black;
+}
+</style>
+
+<svg id="s1" width="200px" height="20px">
+ <image id="img1" href="resources/pattern.png" x="0" y="0" width="20px" height="20px" />
+ <image id="img2" href="resources/pattern.png" x="20" y="0" width="40px" height="40px" />
+ <image id="img3" href="resources/pattern.png" x="40" y="0" width="40px" height="40px" />
+ <image id="img4" href="invalid" x="60" y="0" width="20px" height="20px" />
+ <image id="img5" href="resources/pattern.png" x="80" y="0" width="20px" height="20px" />
+ <image id="img6" href="resources/rect.svg" x="100" y="0" width="20px" height="20px" />
+ <image id="img7" href="resources/empty.svg" x="120" y="0" width="20px" height="20px" />
+ <image id="img8" href="resources/zeroSize.svg" x="140" y="0" width="20px" height="20px" />
+</svg>
+
+<canvas id="c1" width="20" height="20"></canvas>
+<canvas id="c2" width="20" height="20"></canvas>
+<canvas id="c3" width="20" height="20"></canvas>
+<canvas id="c4" width="20" height="20"></canvas>
+<canvas id="c5" width="20" height="20"></canvas>
+<canvas id="c6" width="20" height="20"></canvas>
+<canvas id="c7" width="20" height="20"></canvas>
+<canvas id="c8" width="20" height="20"></canvas>
+
+<script>
+var draw = function(target, img, x, y) {
+ document.getElementById(img).addEventListener("load", function() {
+ document.getElementById(target).getContext("2d").drawImage(
+ document.getElementById(img), x || 0, y || 0);
+ });
+};
+
+draw("c1", "img1");
+draw("c2", "img2", 10, 10);
+draw("c3", "img3");
+draw("c4", "img4");
+document.getElementById("c5").getContext("2d").drawImage(
+ document.getElementById("img5"), 0, 0);
+draw("c6", "img6");
+draw("c7", "img7");
+draw("c8", "img8");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698