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

Side by Side Diff: content/test/data/gpu/pixel_offscreenCanvas_resize.html

Issue 2521013003: Compositing Layer update for OffscreenCanvas resize (Closed)
Patch Set: test Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2
3 <!-- READ BEFORE UPDATING:
4 If this test is updated make sure to increment the "revision" value of the
5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure
6 that the baseline images are regenerated on the next run.
7 -->
8
9 <html>
10 <head>
11 <title>OffscreenCanvas commit flow With Resize: Blue Rectangle on white backgrou nd.</title>
12 <style type="text/css">
13 .nomargin {
14 margin: 0px auto;
15 }
16 </style>
17 <script id="myWorker" type="text/worker">
18 self.onmessage = function(e) {
19 var transferredCanvas = e.data;
20 var offscreen2d = transferredCanvas.getContext("2d");
21 offscreen2d.fillStyle = "blue";
22 offscreen2d.fillRect(0, 0, 200, 200);
23 offscreen2d.commit();
24
25 // Change the size of offscreenCanvas from 200X200 to 100X300
26 transferredCanvas.width = 100;
27 transferredCanvas.height = 300;
28 offscreen2d.fillStyle = "blue";
29 offscreen2d.fillRect(0, 0, 200, 200);
30 offscreen2d.commit();
31 self.postMessage("");
32 };
33 </script>
34 <script>
35 var g_swapsBeforeAck = 15;
36
37 function makeWorker(script)
38 {
39 var blob = new Blob([script]);
40 return new Worker(URL.createObjectURL(blob));
41 }
42
43 function waitForFinish()
44 {
45 if (g_swapsBeforeAck == 0) {
46 domAutomationController.setAutomationId(1);
47 domAutomationController.send("SUCCESS");
48 } else {
49 g_swapsBeforeAck--;
50 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1;
51 window.webkitRequestAnimationFrame(waitForFinish);
52 }
53 }
54
55 function main()
56 {
57 var canvas2D = document.getElementById("c");
58 var offscreenCanvas = canvas2D.transferControlToOffscreen();
59 var worker = makeWorker(document.getElementById("myWorker").textContent);
60 worker.postMessage(offscreenCanvas, [offscreenCanvas]);
61 worker.onmessage = function (e) {
62 waitForFinish();
63 };
64 }
65 </script>
66 </head>
67 <body onload="main()">
68 <div style="position:relative; width:300px; height:300px; background-color:white ">
69 </div>
70 <div id="container" style="position:absolute; top:0px; left:0px">
71 <canvas id="c" width="200" height="200" class="nomargin"></canvas>
72 </div>
73 </body>
74 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698