| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test drawImage(image) with canvas with different composite modes.</ti
tle> | 4 <title>Test drawImage(video) with canvas with different composite modes.</ti
tle> |
| 5 <script src="resources/canvas-composite-image-common.js"></script> | 5 <script src="resources/canvas-composite-image-common.js"></script> |
| 6 <style type="text/css"> | 6 <style type="text/css"> |
| 7 body { margin: 5px; font-family: arial,verdana,helvetica; background: #fff
; } | 7 body { margin: 5px; font-family: arial,verdana,helvetica; background: #fff
; } |
| 8 canvas { border: 1px solid #999; } | 8 canvas { border: 1px solid #999; } |
| 9 div { margin: 10px; } | 9 div { margin: 10px; } |
| 10 #output h1 { font-size: medium; font-weight: normal; } | 10 #output h1 { font-size: medium; font-weight: normal; } |
| 11 #output h2 { font-size: small; font-weight: normal; } | 11 #output h2 { font-size: small; font-weight: normal; } |
| 12 #output div { font-size: small; margin: 0px; } | 12 #output div { font-size: small; margin: 0px; } |
| 13 #output .pass { color: green; } | 13 #output .pass { color: green; } |
| 14 #output .fail { color: rgb(255, 0, 0); } | 14 #output .fail { color: rgb(255, 0, 0); } |
| 15 #output .error { color: rgb(255, 0, 64); } | 15 #output .error { color: rgb(255, 0, 64); } |
| 16 td { padding: 2px 5px; } | 16 td { padding: 2px 5px; } |
| 17 table { border-collapse: collapse; } | 17 table { border-collapse: collapse; } |
| 18 </style> | 18 </style> |
| 19 </head> | 19 </head> |
| 20 <body> | 20 <body> |
| 21 <div>Test Results</div> | 21 <div>Test Results</div> |
| 22 <div><table id='outputtable'></table></div> | 22 <div><table id='outputtable'></table></div> |
| 23 <div>Test Video</div> | 23 <div>Test Video</div> |
| 24 <div><video id="video"> | 24 <div><video id="video"> |
| 25 <source src="resources/canvas_video.mp4" type='video/mp4' /> | 25 <source src="resources/canvas_video.mp4" type='video/mp4' /> |
| 26 <source src="resources/canvas_video.webm" type='video/webm' /> | 26 <source src="resources/canvas_video.webm" type='video/webm' /> |
| 27 <source src="resources/canvas_video.ogv" type='video/ogg' /> | 27 <source src="resources/canvas_video.ogv" type='video/ogg' /> |
| 28 </video></div> | 28 </video></div> |
| 29 <script type="application/x-javascript"> | 29 <script type="application/x-javascript"> |
| 30 function drawImage(context, compositeIndex, alpha) { | 30 function drawImage(context, compositeIndex, alpha) { |
| 31 context.globalCompositeOperation = compositeTypes[compositeIndex]; | 31 context.globalCompositeOperation = compositeTypes[compositeIndex]; |
| 32 context.shadowOffsetX = -2; |
| 33 context.shadowOffsetY = 2; |
| 34 context.shadowBlur = 8; |
| 35 context.shadowColor = "purple"; |
| 32 if (alpha) | 36 if (alpha) |
| 33 context.globalAlpha = 0.5; | 37 context.globalAlpha = 0.5; |
| 34 var videoElement = document.getElementById('video'); | 38 var videoElement = document.getElementById('video'); |
| 35 context.drawImage(videoElement, 10, 10); | 39 context.drawImage(videoElement, 10, 10); |
| 36 } | 40 } |
| 37 | 41 |
| 38 function setupTest() {} | 42 function setupTest() {} |
| 39 | 43 |
| 40 var video = document.getElementById("video"); | 44 var video = document.getElementById("video"); |
| 41 video.addEventListener("playing", playVideo, true); | 45 video.addEventListener("playing", playVideo, true); |
| 42 video.play(); | 46 video.play(); |
| 43 | 47 |
| 44 function playVideo() { | 48 function playVideo() { |
| 45 video.removeEventListener("playing", playVideo, true); | 49 video.removeEventListener("playing", playVideo, true); |
| 46 // We cannot read pixel after drawing a video because of SecurityError: | 50 // We cannot read pixel after drawing a video because of SecurityError: |
| 47 // The canvas has been tainted by cross-origin data. | 51 // The canvas has been tainted by cross-origin data. |
| 48 runTest("dumpAsTextWithPixelResults") | 52 runTest("dumpAsTextWithPixelResults") |
| 49 } | 53 } |
| 50 </script> | 54 </script> |
| 51 </body> | 55 </body> |
| 52 </html> | 56 </html> |
| OLD | NEW |