| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <style> | 2 <style> |
| 3 #scroller { | 3 #scroller { |
| 4 width: 200px; | 4 width: 200px; |
| 5 height: 200px; | 5 height: 200px; |
| 6 border: 1px solid black; | 6 border: 1px solid black; |
| 7 overflow: scroll; | 7 overflow: scroll; |
| 8 } | 8 } |
| 9 | 9 |
| 10 .scrolled { | 10 .scrolled { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 <script src='../../resources/js-test.js'></script> | 50 <script src='../../resources/js-test.js'></script> |
| 51 | 51 |
| 52 | 52 |
| 53 <script> | 53 <script> |
| 54 description('Verifies that scroll children with composited descendants' + | 54 description('Verifies that scroll children with composited descendants' + |
| 55 ' do not squash.'); | 55 ' do not squash.'); |
| 56 | 56 |
| 57 if (window.internals) | 57 if (window.internals) |
| 58 internals.settings.setPreferCompositingToLCDTextEnabled(true); | 58 internals.settings.setPreferCompositingToLCDTextEnabled(true); |
| 59 | 59 |
| 60 function scrollChildDoesNotSquash(layer) { | 60 function scrollChildDoesNotSquash(layers) { |
| 61 if (layer.children) { | 61 var foundParent = false; |
| 62 for (var i = 0; i < layer.children.length; i++) { | 62 var foundChild = false; |
| 63 var child = layer.children[i]; | 63 layers["layers"].forEach(function(layer) { |
| 64 if (child.bounds && layer.bounds && | 64 // If the child's bounds are 20x20, we're the scroll child with the |
| 65 child.bounds[0] == 20 && child.bounds[1] == 20 && | 65 // composited descendant. We should not have squashed and therefore our |
| 66 layer.bounds[0] == 102 && layer.bounds[1] == 102) { | 66 // bounds should remain 102x102 (100x100 plus the 1px border). |
| 67 // If the child's bounds are 20x20, we're the scroll child with the | 67 if (layer.bounds && layer.bounds[0] == 20 && layer.bounds[1] == 20) |
| 68 // composited descendant. We should not have squashed and therefore our | 68 foundChild = true; |
| 69 // bounds should remain 102x102 (100x100 plus the 1px border). | 69 if (layer.bounds && layer.bounds[0] == 102 && layer.bounds[1] == 102) |
| 70 return true; | 70 foundParent = true; |
| 71 } | 71 }); |
| 72 | 72 return foundParent && foundChild; |
| 73 if (scrollChildDoesNotSquash(child)) | |
| 74 return true; | |
| 75 } | |
| 76 } | |
| 77 return false; | |
| 78 } | 73 } |
| 79 | 74 |
| 80 onload = function() { | 75 onload = function() { |
| 81 if (!window.internals) | 76 if (!window.internals) |
| 82 return; | 77 return; |
| 83 documentLayerTree = JSON.parse(window.internals.layerTreeAsText(document)); | 78 layers = JSON.parse(window.internals.layerTreeAsText(document)); |
| 84 shouldBe('scrollChildDoesNotSquash(documentLayerTree)', 'true'); | 79 shouldBe('scrollChildDoesNotSquash(layers)', 'true'); |
| 85 }; | 80 }; |
| 86 | 81 |
| 87 </script> | 82 </script> |
| OLD | NEW |