| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <script src="resources/composited-scroll.js"></script> |
| 2 <script> | 3 <script> |
| 3 if (window.internals) | 4 if (window.internals) |
| 4 window.internals.settings.setPreferCompositingToLCDTextEnabled(false); | 5 window.internals.settings.setPreferCompositingToLCDTextEnabled(false); |
| 5 | 6 |
| 6 if (window.testRunner) { | 7 if (window.testRunner) { |
| 7 window.testRunner.dumpAsText(); | 8 window.testRunner.dumpAsText(); |
| 8 window.testRunner.waitUntilDone(); | 9 window.testRunner.waitUntilDone(); |
| 9 } | 10 } |
| 10 | 11 |
| 11 function isUsingCompositedScrolling(layer) { | |
| 12 if (layer.bounds[1] == 1000) | |
| 13 return true; | |
| 14 if (layer.children) { | |
| 15 for (var i = 0; i < layer.children.length; i++) { | |
| 16 if (isUsingCompositedScrolling(layer.children[i])) | |
| 17 return true; | |
| 18 } | |
| 19 } | |
| 20 return false; | |
| 21 } | |
| 22 | |
| 23 var result = ""; | 12 var result = ""; |
| 24 onload = function() { | 13 onload = function() { |
| 25 | 14 |
| 26 if (window.internals) { | 15 if (window.internals) { |
| 27 result += "Should not be using composited scrolling: "; | 16 result += "Should not be using composited scrolling: "; |
| 28 if (!isUsingCompositedScrolling(JSON.parse(window.internals.layerTreeAsT
ext(document)))) | 17 if (!isUsingCompositedScrolling(JSON.parse(window.internals.layerTreeAsT
ext(document, window.internals.OUTPUT_CHILDREN_AS_LAYER_LIST)))) |
| 29 result += "Pass.\n"; | 18 result += "Pass.\n"; |
| 30 else | 19 else |
| 31 result += "Fail.\n" | 20 result += "Fail.\n" |
| 32 } | 21 } |
| 33 | 22 |
| 34 document.getElementById("scroller").style.webkitTransform = "translateZ(0)"; | 23 document.getElementById("scroller").style.webkitTransform = "translateZ(0)"; |
| 35 requestAnimationFrame(function() { | 24 requestAnimationFrame(function() { |
| 36 if (window.internals) { | 25 if (window.internals) { |
| 37 result += "Should be using composited scrolling (since we're composi
ting anyhow): "; | 26 result += "Should be using composited scrolling (since we're composi
ting anyhow): "; |
| 38 if (isUsingCompositedScrolling(JSON.parse(window.internals.layerTree
AsText(document)))) | 27 if (isUsingCompositedScrolling(JSON.parse(window.internals.layerTree
AsText(document, window.internals.OUTPUT_CHILDREN_AS_LAYER_LIST)))) |
| 39 result += "Pass.\n"; | 28 result += "Pass.\n"; |
| 40 else | 29 else |
| 41 result += "Fail.\n" | 30 result += "Fail.\n" |
| 42 } | 31 } |
| 43 | 32 |
| 44 document.getElementById("scroller").style.webkitTransform = ""; | 33 document.getElementById("scroller").style.webkitTransform = ""; |
| 45 requestAnimationFrame(function() { | 34 requestAnimationFrame(function() { |
| 46 if (window.internals) { | 35 if (window.internals) { |
| 47 result += "Should not be using composited scrolling (since we've
lost our direct reason): "; | 36 result += "Should not be using composited scrolling (since we've
lost our direct reason): "; |
| 48 if (!isUsingCompositedScrolling(JSON.parse(window.internals.laye
rTreeAsText(document)))) | 37 if (!isUsingCompositedScrolling(JSON.parse(window.internals.laye
rTreeAsText(document, window.internals.OUTPUT_CHILDREN_AS_LAYER_LIST)))) |
| 49 result += "Pass.\n"; | 38 result += "Pass.\n"; |
| 50 else | 39 else |
| 51 result += "Fail.\n" | 40 result += "Fail.\n" |
| 52 } | 41 } |
| 53 | 42 |
| 54 if (window.testRunner) { | 43 if (window.testRunner) { |
| 55 window.testRunner.setCustomTextOutput(result); | 44 window.testRunner.setCustomTextOutput(result); |
| 56 window.testRunner.notifyDone(); | 45 window.testRunner.notifyDone(); |
| 57 } | 46 } |
| 58 }); | 47 }); |
| 59 }); | 48 }); |
| 60 } | 49 } |
| 61 </script> | 50 </script> |
| 62 <div id="scroller" style="overflow:scroll; width:100px; height:100px"> | 51 <div id="scroller" style="overflow:scroll; width:100px; height:100px"> |
| 63 <div id="tall" style="background: green; width:50px; height: 1000px"></div> | 52 <div id="tall" style="background: green; width:50px; height: 1000px"></div> |
| 64 </div> | 53 </div> |
| OLD | NEW |