| OLD | NEW |
| 1 <script src="../../resources/run-after-layout-and-paint.js"></script> | 1 <script src="../../resources/run-after-layout-and-paint.js"></script> |
| 2 <script src="resources/composited-scroll.js"></script> |
| 2 <script> | 3 <script> |
| 3 if (window.internals) | 4 if (window.internals) |
| 4 internals.runtimeFlags.compositeOpaqueScrollersEnabled = true; | 5 internals.runtimeFlags.compositeOpaqueScrollersEnabled = true; |
| 5 | 6 |
| 6 if (window.testRunner) { | 7 if (window.testRunner) { |
| 7 testRunner.dumpAsTextWithPixelResults(); | 8 testRunner.dumpAsTextWithPixelResults(); |
| 8 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
| 9 } | 10 } |
| 10 | 11 |
| 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() { | 12 onload = function() { |
| 36 if (!window.testRunner || !window.internals) | 13 if (!window.testRunner || !window.internals) |
| 37 return; | 14 return; |
| 38 | 15 |
| 39 var result = "Should not have opaque composited scrolling contents layer
: "; | 16 var result = "Should not have opaque composited scrolling contents layer
: "; |
| 40 if (!hasCompositedScrollingContentsLayer(JSON.parse(window.internals.lay
erTreeAsText(document)))) | 17 if (!isUsingCompositedScrolling(JSON.parse(window.internals.layerTreeAsT
ext(document)))) |
| 41 result += "Pass.\n"; | 18 result += "Pass.\n"; |
| 42 else | 19 else |
| 43 result += "Fail.\n"; | 20 result += "Fail.\n"; |
| 44 document.getElementById("test-1-output").innerHTML = result; | 21 document.getElementById("test-1-output").innerHTML = result; |
| 45 | 22 |
| 46 scrollerElement = document.getElementById("scroller"); | 23 scrollerElement = document.getElementById("scroller"); |
| 47 scrollerElement.style.background = "green local content-box"; | 24 scrollerElement.style.background = "green local content-box"; |
| 48 | 25 |
| 49 runAfterLayoutAndPaint(function() { | 26 runAfterLayoutAndPaint(function() { |
| 50 var result = "Should have opaque composited scrolling contents layer
: "; | 27 var result = "Should have opaque composited scrolling contents layer
: "; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 67 } | 44 } |
| 68 .spacer { | 45 .spacer { |
| 69 height: 300px; | 46 height: 300px; |
| 70 } | 47 } |
| 71 </style> | 48 </style> |
| 72 <div id="scroller"><div class="spacer"></div></div> | 49 <div id="scroller"><div class="spacer"></div></div> |
| 73 <p>Scroller background should be green</p> | 50 <p>Scroller background should be green</p> |
| 74 <p id="test-1-output"></p> | 51 <p id="test-1-output"></p> |
| 75 <p id="test-2-output"></p> | 52 <p id="test-2-output"></p> |
| 76 | 53 |
| OLD | NEW |