| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Check repaint region of fillRect() and drawImage() with different com
posite modes.</title> | 4 <title>Check repaint region of fillRect() and drawImage() with different com
posite modes.</title> |
| 5 <style type="text/css"> | 5 <style type="text/css"> |
| 6 body { margin: 5px; font-family: arial,verdana,helvetica; background: #fff
; } | 6 body { margin: 5px; font-family: arial,verdana,helvetica; background: #fff
; } |
| 7 canvas { border: 1px solid #999; } | 7 canvas { border: 1px solid #999; } |
| 8 div { margin: 10px; } | 8 div { margin: 10px; } |
| 9 #output h1 { font-size: medium; font-weight: normal; } | 9 #output h1 { font-size: medium; font-weight: normal; } |
| 10 #output h2 { font-size: small; font-weight: normal; } | 10 #output h2 { font-size: small; font-weight: normal; } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 context.restore(); | 149 context.restore(); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 // Because canvas invalidations are processed at the end of the current ta
sk, | 152 // Because canvas invalidations are processed at the end of the current ta
sk, |
| 153 // the repaint test has to end in a subsequent task in order to capture th
e repaint. | 153 // the repaint test has to end in a subsequent task in order to capture th
e repaint. |
| 154 setTimeout(finishRepaintTest, 0); | 154 setTimeout(finishRepaintTest, 0); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // we can start this test after the video can be played. | 157 // we can start this test after the video can be played. |
| 158 function startTest() { | 158 function startTest() { |
| 159 video.removeEventListener("playing", startTest, true); | |
| 160 prepareRepaintTest(); | 159 prepareRepaintTest(); |
| 161 runRepaintTest(); | 160 runRepaintTest(); |
| 162 } | 161 } |
| 163 | 162 |
| 164 var video = document.getElementById("video"); | 163 var video = document.getElementById("video"); |
| 165 video.addEventListener("playing", startTest, true); | 164 video.addEventListener("playing", _ => { |
| 165 // Video controls will do a re-paint when it starts playing. |
| 166 setTimeout(startTest); |
| 167 }, { passive: true, once: true }); |
| 166 video.play(); | 168 video.play(); |
| 167 | 169 |
| 168 var imageElement = document.getElementById('image'); | 170 var imageElement = document.getElementById('image'); |
| 169 var canvas = document.getElementById('source-canvas'); | 171 var canvas = document.getElementById('source-canvas'); |
| 170 canvas.width = imageElement.width; | 172 canvas.width = imageElement.width; |
| 171 canvas.height = imageElement.height; | 173 canvas.height = imageElement.height; |
| 172 var context = canvas.getContext('2d'); | 174 var context = canvas.getContext('2d'); |
| 173 context.drawImage(imageElement, 0, 0); | 175 context.drawImage(imageElement, 0, 0); |
| 174 | 176 |
| 175 window.testIsAsync = true; | 177 window.testIsAsync = true; |
| 176 </script> | 178 </script> |
| 177 </body> | 179 </body> |
| 178 </html> | 180 </html> |
| OLD | NEW |