OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <script src="resources/composited-scroll.js"></script> |
2 <style> | 3 <style> |
3 #scroller { | 4 #scroller { |
4 overflow: scroll; | 5 overflow: scroll; |
5 height: 300px; | 6 height: 300px; |
6 width: 300px; | 7 width: 300px; |
7 background-color: red; | 8 background-color: red; |
8 } | 9 } |
9 | 10 |
10 #scrolled { | 11 #scrolled { |
11 height: 1000px; | 12 height: 1000px; |
12 width: 250px; | 13 width: 250px; |
13 background-color: green; | 14 background-color: green; |
14 } | 15 } |
15 | 16 |
16 #fixed { | 17 #fixed { |
17 position: fixed; | 18 position: fixed; |
18 height: 100px; | 19 height: 100px; |
19 width: 100px; | 20 width: 100px; |
20 background-color: green; | 21 background-color: green; |
21 top: 400px; | 22 top: 400px; |
22 left: 100px; | 23 left: 100px; |
23 } | 24 } |
24 </style> | 25 </style> |
25 <div id="scroller"> | 26 <div id="scroller"> |
26 <div id="scrolled"></div> | 27 <div id="scrolled"></div> |
27 <div id="fixed"></div> | 28 <div id="fixed"></div> |
28 </div> | 29 </div> |
29 <script> | 30 <script> |
30 function isUsingCompositedScrolling(layer) { | |
31 if (layer.bounds[1] == 1000) | |
32 return true; | |
33 if (layer.children) { | |
34 for (var i = 0; i < layer.children.length; i++) { | |
35 if (isUsingCompositedScrolling(layer.children[i])) | |
36 return true; | |
37 } | |
38 } | |
39 return false; | |
40 } | |
41 | |
42 if (window.internals) | 31 if (window.internals) |
43 window.internals.settings.setPreferCompositingToLCDTextEnabled(true); | 32 window.internals.settings.setPreferCompositingToLCDTextEnabled(true); |
44 | 33 |
45 if (window.testRunner) { | 34 if (window.testRunner) { |
46 window.testRunner.dumpAsText(); | 35 window.testRunner.dumpAsText(); |
47 window.testRunner.waitUntilDone(); | 36 window.testRunner.waitUntilDone(); |
48 } | 37 } |
49 | 38 |
50 var result = ""; | 39 var result = ""; |
51 | 40 |
52 onload = function() { | 41 onload = function() { |
53 if (window.internals) { | 42 if (window.internals) { |
54 result += "No border radius (should be using composited scrolling): "; | 43 result += "No border radius (should be using composited scrolling): "; |
55 if (isUsingCompositedScrolling(JSON.parse(window.internals.layerTreeAsTe
xt(document)))) | 44 if (isUsingCompositedScrolling(JSON.parse(window.internals.layerTreeAsTe
xt(document, window.internals.OUTPUT_CHILDREN_AS_LAYER_LIST)))) |
56 result += "Pass.\n"; | 45 result += "Pass.\n"; |
57 else | 46 else |
58 result += "Fail.\n" | 47 result += "Fail.\n" |
59 } | 48 } |
60 document.getElementById("scroller").style.borderRadius = '5px'; | 49 document.getElementById("scroller").style.borderRadius = '5px'; |
61 requestAnimationFrame(function() { | 50 requestAnimationFrame(function() { |
62 if (window.internals) { | 51 if (window.internals) { |
63 result += "Has border radius (should not be using composited scrolli
ng): "; | 52 result += "Has border radius (should not be using composited scrolli
ng): "; |
64 if (!isUsingCompositedScrolling(JSON.parse(window.internals.layerTre
eAsText(document)))) | 53 if (!isUsingCompositedScrolling(JSON.parse(window.internals.layerTre
eAsText(document, window.internals.OUTPUT_CHILDREN_AS_LAYER_LIST)))) |
65 result += "Pass.\n"; | 54 result += "Pass.\n"; |
66 else | 55 else |
67 result += "Fail.\n" | 56 result += "Fail.\n" |
68 } | 57 } |
69 | 58 |
70 if (window.testRunner) { | 59 if (window.testRunner) { |
71 window.testRunner.setCustomTextOutput(result); | 60 window.testRunner.setCustomTextOutput(result); |
72 window.testRunner.notifyDone(); | 61 window.testRunner.notifyDone(); |
73 } | 62 } |
74 }); | 63 }); |
75 }; | 64 }; |
76 </script> | 65 </script> |
OLD | NEW |