OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <!-- crbug.com/336676 - layer creation should not accidentally skip requesting | 3 <!-- crbug.com/336676 - layer creation should not accidentally skip requesting |
4 the compositor for a frame to be produced. When there were no other | 4 the compositor for a frame to be produced. When there were no other |
5 repaints or layout/style changes, the simple act of adding a layer was not | 5 repaints or layout/style changes, the simple act of adding a layer was not |
6 triggering compositing updates by itself. To recreate this scenario, an | 6 triggering compositing updates by itself. To recreate this scenario, an |
7 out-of-flow canvas element is added to an empty composited layer. The | 7 out-of-flow canvas element is added to an empty composited layer. The |
8 actual container layer does not get added to the tree until it realizes | 8 actual container layer does not get added to the tree until it realizes |
9 that it receives the canvas content. --> | 9 that it receives the canvas content. --> |
10 | 10 |
11 | 11 |
12 <html> | 12 <html> |
13 <head> | 13 <head> |
| 14 <script src="../../resources/run-after-display.js"></script> |
14 <style> | 15 <style> |
15 | 16 |
16 .composited { | 17 .composited { |
17 -webkit-transform: translatez(0); | 18 -webkit-transform: translatez(0); |
18 } | 19 } |
19 | 20 |
20 .box { | 21 .box { |
21 position: absolute; | 22 position: absolute; |
22 z-index: 1; | 23 z-index: 1; |
23 width: 300px; | 24 width: 300px; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 context.fillStyle = "green"; | 56 context.fillStyle = "green"; |
56 context.fillRect(80, 80, 50, 50); | 57 context.fillRect(80, 80, 50, 50); |
57 | 58 |
58 if (!window.testRunner) { | 59 if (!window.testRunner) { |
59 // If the test is being run interactively, then | 60 // If the test is being run interactively, then |
60 // the canvas should correctly appear after 1 second. | 61 // the canvas should correctly appear after 1 second. |
61 setTimeout(addCanvasToTree, 1000); | 62 setTimeout(addCanvasToTree, 1000); |
62 return; | 63 return; |
63 } | 64 } |
64 | 65 |
65 testRunner.display(); | 66 testRunner.waitUntilDone(); |
66 | 67 |
67 // This should initiate a compositor frame via scheduleAnimation(). | 68 runAfterDisplay(function() { |
68 addCanvasToTree(); | 69 // This should initiate a compositor frame via scheduleAnimation(). |
| 70 addCanvasToTree(); |
69 | 71 |
70 if (window.internals.isCompositorFramePending(document)) | 72 if (window.internals.isCompositorFramePending(document)) |
71 document.getElementById("result").innerHTML = "PASS - did schedule animati
on"; | 73 document.getElementById("result").innerHTML = "PASS - did schedule anima
tion"; |
72 else | 74 else |
73 document.getElementById("result").innerHTML = "FAIL - did not schedule ani
mation"; | 75 document.getElementById("result").innerHTML = "FAIL - did not schedule a
nimation"; |
| 76 testRunner.notifyDone(); |
| 77 }); |
74 } | 78 } |
75 | 79 |
76 </script> | 80 </script> |
77 </head> | 81 </head> |
78 | 82 |
79 <body onload="runTest()"> | 83 <body onload="runTest()"> |
80 <div id="container" class="composited box"></div> | 84 <div id="container" class="composited box"></div> |
81 <div id="result">The green box should appear after 1 second when running this
test interactively.</div> | 85 <div id="result">The green box should appear after 1 second when running this
test interactively.</div> |
82 </body> | 86 </body> |
83 | 87 |
84 </html> | 88 </html> |
OLD | NEW |