| 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 <script src="../../fast/repaint/resources/text-based-repaint.js"></script> |
| 15 <style> | 15 <style> |
| 16 | 16 |
| 17 .composited { | 17 .composited { |
| 18 -webkit-transform: translatez(0); | 18 -webkit-transform: translatez(0); |
| 19 } | 19 } |
| 20 | 20 |
| 21 .box { | 21 .box { |
| 22 position: absolute; | 22 position: absolute; |
| 23 z-index: 1; | 23 z-index: 1; |
| 24 width: 300px; | 24 width: 300px; |
| 25 height: 300px; | 25 height: 300px; |
| 26 top: 0px; | 26 top: 0px; |
| 27 left: 0px; | 27 left: 0px; |
| 28 } | 28 } |
| 29 | 29 |
| 30 canvas { | 30 canvas { |
| 31 position: absolute; | 31 position: absolute; |
| 32 z-index: 1; | 32 z-index: 1; |
| 33 top: 0px; | 33 top: 0px; |
| 34 left: 0px; | 34 left: 0px; |
| 35 } | 35 } |
| 36 | 36 |
| 37 </style> | 37 </style> |
| 38 | 38 |
| 39 <script> | 39 <script> |
| 40 | 40 function repaintTest() { |
| 41 if (window.testRunner) | 41 var canvasElement = document.createElement("canvas"); |
| 42 testRunner.dumpAsText(); | |
| 43 | |
| 44 | |
| 45 var canvasElement; | |
| 46 | |
| 47 function addCanvasToTree() { | |
| 48 document.getElementById("container").appendChild(canvasElement); | |
| 49 } | |
| 50 | |
| 51 function runTest() { | |
| 52 canvasElement = document.createElement("canvas"); | |
| 53 canvasElement.width = 200; | 42 canvasElement.width = 200; |
| 54 canvasElement.height = 200; | 43 canvasElement.height = 200; |
| 55 var context = canvasElement.getContext("2d"); | 44 var context = canvasElement.getContext("2d"); |
| 56 context.fillStyle = "green"; | 45 context.fillStyle = "green"; |
| 57 context.fillRect(80, 80, 50, 50); | 46 context.fillRect(80, 80, 50, 50); |
| 58 | 47 document.getElementById("container").appendChild(canvasElement); |
| 59 if (!window.testRunner) { | |
| 60 // If the test is being run interactively, then | |
| 61 // the canvas should correctly appear after 1 second. | |
| 62 setTimeout(addCanvasToTree, 1000); | |
| 63 return; | |
| 64 } | |
| 65 | |
| 66 testRunner.waitUntilDone(); | |
| 67 | |
| 68 runAfterDisplay(function() { | |
| 69 // This should initiate a compositor frame via scheduleAnimation(). | |
| 70 addCanvasToTree(); | |
| 71 | |
| 72 if (window.internals.isCompositorFramePending(document)) | |
| 73 document.getElementById("result").innerHTML = "PASS - did schedule anima
tion"; | |
| 74 else | |
| 75 document.getElementById("result").innerHTML = "FAIL - did not schedule a
nimation"; | |
| 76 testRunner.notifyDone(); | |
| 77 }); | |
| 78 } | 48 } |
| 79 | |
| 80 </script> | 49 </script> |
| 81 </head> | 50 </head> |
| 82 | 51 |
| 83 <body onload="runTest()"> | 52 <body onload="runRepaintAndPixelTest()"> |
| 84 <div id="container" class="composited box"></div> | 53 <div id="container" class="composited box"></div> |
| 85 <div id="result">The green box should appear after 1 second when running this
test interactively.</div> | |
| 86 </body> | 54 </body> |
| 87 | 55 |
| 88 </html> | 56 </html> |
| OLD | NEW |