| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 This test checks that repaint testing works with composited layers. | 4 This test checks that repaint testing works with composited layers. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <html> | 7 <html> |
| 8 <head> | 8 <head> |
| 9 <style type="text/css"> | 9 <style type="text/css"> |
| 10 #parent { | 10 #parent { |
| 11 -webkit-transform: translateZ(0px); | 11 -webkit-transform: translateZ(0px); |
| 12 width: 400px; | 12 width: 400px; |
| 13 height: 400px; | 13 height: 400px; |
| 14 background: blue; | 14 background: blue; |
| 15 } | 15 } |
| 16 | 16 |
| 17 #child { | 17 #child { |
| 18 -webkit-transform: translateZ(0px); | 18 -webkit-transform: translateZ(0px); |
| 19 position: relative; | 19 position: relative; |
| 20 left: 50px; | 20 left: 50px; |
| 21 top: 50px; | 21 top: 50px; |
| 22 width: 75px; | 22 width: 75px; |
| 23 height: 75px; | 23 height: 75px; |
| 24 background: green; | 24 background: green; |
| 25 } | 25 } |
| 26 | 26 |
| 27 </style> | 27 </style> |
| 28 <script type="text/javascript"> | 28 <script src="../../fast/repaint/resources/text-based-repaint.js"></script> |
| 29 window.addEventListener('load', function() { | 29 <script> |
| 30 if (!window.testRunner) { | 30 function repaintTest() { |
| 31 alert('This test requires testRunner to run!'); | |
| 32 return; | |
| 33 } | |
| 34 | |
| 35 if (!window.internals) { | |
| 36 alert('This test requires window.interals to run!'); | |
| 37 return; | |
| 38 } | |
| 39 | |
| 40 testRunner.dumpAsText(); | |
| 41 | |
| 42 var parent = document.getElementById('parent'); | 31 var parent = document.getElementById('parent'); |
| 43 var child = document.getElementById('child'); | 32 var child = document.getElementById('child'); |
| 44 | 33 |
| 45 // Ensure that we've recalculated style before starting repaint | |
| 46 // tracking (we don't want our lists of invalidated rects to be | |
| 47 // polluted). | |
| 48 document.body.offsetTop; | |
| 49 window.internals.startTrackingRepaints(document); | |
| 50 | |
| 51 child.style.background = 'blue'; | 34 child.style.background = 'blue'; |
| 52 parent.style.background = 'green'; | 35 parent.style.background = 'green'; |
| 36 } |
| 53 | 37 |
| 54 var text = document.getElementById('text'); | 38 runRepaintTest(); |
| 55 text.innerHTML = 'This text will be replaced with the layer tree'; | |
| 56 | |
| 57 // Force a style recalc. | |
| 58 document.body.offsetTop; | |
| 59 | |
| 60 var layerTreeText = window.internals.layerTreeAsText(document, interna
ls.LAYER_TREE_INCLUDES_REPAINT_RECTS); | |
| 61 | |
| 62 window.internals.stopTrackingRepaints(document); | |
| 63 | |
| 64 text.innerHTML = layerTreeText; | |
| 65 }); | |
| 66 </script> | 39 </script> |
| 67 </head> | 40 </head> |
| 68 <body> | 41 <body> |
| 69 <pre id="text"></pre> | |
| 70 <div id="parent"> | 42 <div id="parent"> |
| 71 <div id="child"></div> | 43 <div id="child"></div> |
| 72 </div> | 44 </div> |
| 73 </body> | 45 </body> |
| 74 </html> | 46 </html> |
| OLD | NEW |