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 #inner { | 11 #inner { |
11 height: 1000px; | 12 height: 1000px; |
12 width: 250px; | 13 width: 250px; |
13 background-color: blue; | 14 background-color: blue; |
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="inner"> | 27 <div id="inner"> |
27 <div id="fixed"></div> | 28 <div id="fixed"></div> |
28 </div> | 29 </div> |
29 </div> | 30 </div> |
30 <script> | 31 <script> |
31 function isUsingCompositedScrolling(layer) { | |
32 if (layer.bounds[1] == 1000) | |
33 return true; | |
34 if (layer.children) { | |
35 for (var i = 0; i < layer.children.length; i++) { | |
36 if (isUsingCompositedScrolling(layer.children[i])) | |
37 return true; | |
38 } | |
39 } | |
40 return false; | |
41 } | |
42 | |
43 if (window.internals) | 32 if (window.internals) |
44 window.internals.settings.setPreferCompositingToLCDTextEnabled(true); | 33 window.internals.settings.setPreferCompositingToLCDTextEnabled(true); |
45 | 34 |
46 if (window.testRunner) { | 35 if (window.testRunner) { |
47 window.testRunner.dumpAsText(); | 36 window.testRunner.dumpAsText(); |
48 window.testRunner.waitUntilDone(); | 37 window.testRunner.waitUntilDone(); |
49 } | 38 } |
50 | 39 |
51 var result = ""; | 40 var result = ""; |
52 | 41 |
53 onload = function() { | 42 onload = function() { |
54 if (window.internals) { | 43 if (window.internals) { |
55 result += "No clip path descendant (should be using composited scrolling
): "; | 44 result += "No clip path descendant (should be using composited scrolling
): "; |
56 if (isUsingCompositedScrolling(JSON.parse(window.internals.layerTreeAsTe
xt(document)))) | 45 if (isUsingCompositedScrolling(JSON.parse(window.internals.layerTreeAsTe
xt(document, window.internals.OUTPUT_CHILDREN_AS_LAYER_LIST)))) |
57 result += "Pass.\n"; | 46 result += "Pass.\n"; |
58 else | 47 else |
59 result += "Fail.\n" | 48 result += "Fail.\n" |
60 } | 49 } |
61 document.getElementById("inner").style.webkitClipPath = "polygon(40px 550px,
432px 302px,409px 237px,46px 156px)"; | 50 document.getElementById("inner").style.webkitClipPath = "polygon(40px 550px,
432px 302px,409px 237px,46px 156px)"; |
62 requestAnimationFrame(function() { | 51 requestAnimationFrame(function() { |
63 if (window.internals) { | 52 if (window.internals) { |
64 result += "Has clip path descendant (should not be using composited
scrolling): "; | 53 result += "Has clip path descendant (should not be using composited
scrolling): "; |
65 if (!isUsingCompositedScrolling(JSON.parse(window.internals.layerTre
eAsText(document)))) | 54 if (!isUsingCompositedScrolling(JSON.parse(window.internals.layerTre
eAsText(document, window.internals.OUTPUT_CHILDREN_AS_LAYER_LIST)))) |
66 result += "Pass.\n"; | 55 result += "Pass.\n"; |
67 else | 56 else |
68 result += "Fail.\n" | 57 result += "Fail.\n" |
69 } | 58 } |
70 | 59 |
71 if (window.testRunner) { | 60 if (window.testRunner) { |
72 window.testRunner.setCustomTextOutput(result); | 61 window.testRunner.setCustomTextOutput(result); |
73 window.testRunner.notifyDone(); | 62 window.testRunner.notifyDone(); |
74 } | 63 } |
75 }); | 64 }); |
76 }; | 65 }; |
77 </script> | 66 </script> |
OLD | NEW |