Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 <script src="../../resources/run-after-layout-and-paint.js"></script> | |
| 2 <script> | |
| 3 if (window.internals) | |
| 4 internals.runtimeFlags.compositeOpaqueScrollersEnabled = true; | |
| 5 | |
| 6 if (window.testRunner) { | |
| 7 testRunner.dumpAsTextWithPixelResults(); | |
| 8 testRunner.waitUntilDone(); | |
| 9 } | |
| 10 | |
| 11 function hasOpaqueCompositedScrollingContentsLayer(layer) { | |
| 12 if (layer.name == "Scrolling Contents Layer") | |
| 13 return layer.contentsOpaque; | |
| 14 if (layer.children) { | |
| 15 for (var i = 0; i < layer.children.length; i++) { | |
| 16 if (hasOpaqueCompositedScrollingContentsLayer(layer.children[i]) ) | |
| 17 return true; | |
| 18 } | |
| 19 } | |
| 20 return false; | |
| 21 } | |
| 22 | |
| 23 function hasCompositedScrollingContentsLayer(layer) { | |
| 24 if (layer.name == "Scrolling Contents Layer") | |
| 25 return true; | |
| 26 if (layer.children) { | |
| 27 for (var i = 0; i < layer.children.length; i++) { | |
| 28 if (hasCompositedScrollingContentsLayer(layer.children[i])) | |
| 29 return true; | |
| 30 } | |
| 31 } | |
| 32 return false; | |
| 33 } | |
| 34 | |
| 35 onload = function() { | |
| 36 if (!window.testRunner || !window.internals) | |
| 37 return; | |
| 38 | |
| 39 var result = "Should not have opaque composited scrolling contents layer : "; | |
| 40 if (!hasCompositedScrollingContentsLayer(JSON.parse(window.internals.lay erTreeAsText(document)))) | |
| 41 result += "Pass.\n"; | |
| 42 else | |
| 43 result += "Fail.\n"; | |
| 
 
chrishtr
2016/09/02 01:19:38
Same comment as on the other test.
 
 | |
| 44 document.getElementById("test-1-output").innerHTML = result; | |
| 45 | |
| 46 scrollerElement = document.getElementById("scroller"); | |
| 47 scrollerElement.style.background = "green local content-box"; | |
| 48 | |
| 49 runAfterLayoutAndPaint(function() { | |
| 50 var result = "Should have opaque composited scrolling contents layer : "; | |
| 51 if (hasOpaqueCompositedScrollingContentsLayer(JSON.parse(window.inte rnals.layerTreeAsText(document)))) | |
| 52 result += "Pass.\n"; | |
| 53 else | |
| 54 result += "Fail.\n"; | |
| 55 document.getElementById("test-2-output").innerHTML = result; | |
| 56 runAfterLayoutAndPaint(function() { testRunner.notifyDone(); }); | |
| 57 }); | |
| 58 } | |
| 59 </script> | |
| 60 <style> | |
| 61 #scroller { | |
| 62 background: transparent local content-box; | |
| 63 border: 10px solid rgba(0, 255, 0, 0.5); | |
| 64 overflow: scroll; | |
| 65 width: 200px; | |
| 66 height: 200px; | |
| 67 } | |
| 68 .spacer { | |
| 69 height: 300px; | |
| 70 } | |
| 71 </style> | |
| 72 <div id="scroller"><div class="spacer"></div></div> | |
| 73 <p>Scroller background should be green</p> | |
| 74 <p id="test-1-output"></p> | |
| 75 <p id="test-2-output"></p> | |
| OLD | NEW |