Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html |
index 851733635dd90bd483c8478e419e55d35963d1fb..4fa3946ef5e3b16f99d8b049b7fb304a1308404a 100644 |
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-out-of-bounds-src.html |
@@ -18,6 +18,7 @@ bgctx.fillStyle = 'green'; |
bgctx.fillRect(0, 0, bgcanvas.width, bgcanvas.height); |
var greenSquareURL = bgcanvas.toDataURL(); |
var img = new Image(); |
+img.onload = imgLoaded; |
img.src = greenSquareURL; |
var ctx1 = canvas1.getContext('2d'); |
var ctx2 = canvas2.getContext('2d'); |
@@ -36,15 +37,17 @@ ctx1.drawImage(bgcanvas, -100, 0, 200, 200, -25, 175, 100, 100); |
ctx1.drawImage(bgcanvas, 0, 0, 100, 200, 75, 175, 100, 100); |
ctx1.drawImage(bgcanvas, 0, 0, 200, 200, 175, 175, 100, 100); |
-ctx2.drawImage(img, -100, -100, 300, 300, -25, -25, 300, 300); |
-ctx2.drawImage(img, -100, -100, 200, 200, -25, -25, 100, 100); |
-ctx2.drawImage(img, 0, -100, 100, 200, 75, -25, 100, 100); |
-ctx2.drawImage(img, 0, -100, 200, 200, 175, -25, 100, 100); |
-ctx2.drawImage(img, -100, 0, 200, 100, -25, 75, 100, 100); |
-ctx2.drawImage(img, 0, 0, 200, 100, 175, 75, 100, 100); |
-ctx2.drawImage(img, -100, 0, 200, 200, -25, 175, 100, 100); |
-ctx2.drawImage(img, 0, 0, 100, 200, 75, 175, 100, 100); |
-ctx2.drawImage(img, 0, 0, 200, 200, 175, 175, 100, 100); |
+function imgLoaded() { |
+ ctx2.drawImage(img, -100, -100, 300, 300, -25, -25, 300, 300); |
+ ctx2.drawImage(img, -100, -100, 200, 200, -25, -25, 100, 100); |
+ ctx2.drawImage(img, 0, -100, 100, 200, 75, -25, 100, 100); |
+ ctx2.drawImage(img, 0, -100, 200, 200, 175, -25, 100, 100); |
+ ctx2.drawImage(img, -100, 0, 200, 100, -25, 75, 100, 100); |
+ ctx2.drawImage(img, 0, 0, 200, 100, 175, 75, 100, 100); |
+ ctx2.drawImage(img, -100, 0, 200, 200, -25, 175, 100, 100); |
+ ctx2.drawImage(img, 0, 0, 100, 200, 75, 175, 100, 100); |
+ ctx2.drawImage(img, 0, 0, 200, 200, 175, 175, 100, 100); |
+} |
if (window.testRunner) { |
testRunner.waitUntilDone(); |