OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <html> | 3 <html> |
4 <head> | 4 <head> |
5 <style> | 5 <style> |
6 .container { | 6 .container { |
7 width: 200px; | 7 width: 200px; |
8 height: 200px; | 8 height: 200px; |
9 overflow: scroll; | 9 overflow: scroll; |
10 margin: 20px; | 10 margin: 20px; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 #normalFlow { | 47 #normalFlow { |
48 width: 180px; | 48 width: 180px; |
49 height: 30px; | 49 height: 30px; |
50 margin: 10px; | 50 margin: 10px; |
51 background-color: yellow; | 51 background-color: yellow; |
52 } | 52 } |
53 </style> | 53 </style> |
54 <script src="resources/automatically-opt-into-composited-scrolling.js"></scrip t> | 54 <script src="resources/automatically-opt-into-composited-scrolling.js"></scrip t> |
55 <script> | 55 <script> |
56 if (window.internals) | |
57 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(true); | |
58 | |
56 function testPermutation(count, ordering, hasPositionedAncestor, containerIs Positioned) | 59 function testPermutation(count, ordering, hasPositionedAncestor, containerIs Positioned) |
57 { | 60 { |
58 if (!window.internals) | 61 if (!window.internals) |
59 return; | 62 return; |
60 | 63 |
61 var container = document.getElementById('container'); | 64 var container = document.getElementById('container'); |
65 var containerOptedIn = didOptIn(container); | |
62 | 66 |
63 // Below, when we set webkitTransform to '', we want that to force an | 67 // Below, when we set webkitTransform to '', we want that to force an |
64 // immediate, synchronous style recalculation. Querying the | 68 // immediate, synchronous style recalculation. Querying the |
65 // document.body.offsetTop value should force this for us. | 69 // document.body.offsetTop value should force this for us. |
66 // Note that this step is also performed inside getStackingOrder() to make | 70 // Note that this step is also performed inside getStackingOrder() to make |
67 // sure we have fresh values when we need them. | 71 // sure we have fresh values when we need them. |
68 container.style.webkitTransform = 'translateZ(0px)'; | 72 container.style.webkitTransform = 'translateZ(0px)'; |
69 document.body.offsetTop; | 73 document.body.offsetTop; |
70 | 74 |
71 // container may be opting in automatically, so even if | 75 // container may be opting in automatically, so even if |
72 // container.style.webkitTransform === '', we need to explicitly force it | 76 // container.style.webkitTransform === '', we need to explicitly force it |
73 // not to opt in to get our first stacking order list. To do this, we need | 77 // not to opt in to get our first stacking order list. To do this, we need |
74 // to disable compositing for overflow scroll entirely. | 78 // to disable compositing for overflow scroll entirely. |
75 // | 79 // |
76 // Unfortunately this operation won't dirty any style bits, and we will | 80 // Unfortunately this operation won't dirty any style bits, and we will |
77 // need to perform a full style recalc both here and below when we force | 81 // need to perform a full style recalc both here and below when we force |
78 // to promote, so that we reevaluate whether or not container can be | 82 // to promote, so that we reevaluate whether or not container can be |
79 // composited. To ensure that we perform the full style recalc, we need to | 83 // composited. To ensure that we perform the full style recalc, we need to |
80 // change a style property so the style is dirty, and force the style to | 84 // change a style property so the style is dirty, and force the style to |
81 // be cleaned with document.body.offsetTop (inside getStackingOrder()). | 85 // be cleaned with document.body.offsetTop (inside getStackingOrder()). |
82 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(false); | 86 window.internals.setNeedsCompositedScrolling(container, |
87 window.internals.FORCE_COMPOSITED_SCROLLING_OFF); | |
83 container.style.webkitTransform = ''; | 88 container.style.webkitTransform = ''; |
84 | 89 |
85 var oldStackingOrder = getStackingOrder(container); | 90 var oldStackingOrder = getStackingOrder(container); |
86 | 91 |
87 // force to promote. | 92 window.internals.setNeedsCompositedScrolling(container, |
88 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(true); | 93 window.internals.FORCE_COMPOSITED_SCROLLING_ON); |
hartmanng
2013/05/02 14:04:01
This doesn't match the .idl file, shouldn't it be
| |
89 container.style.webkitTransform = 'translateZ(0px)'; | 94 container.style.webkitTransform = 'translateZ(0px)'; |
90 | 95 |
91 var newStackingOrder = getStackingOrder(container); | 96 var newStackingOrder = getStackingOrder(container); |
92 | 97 |
98 window.internals.setNeedsCompositedScrolling(container, | |
99 window.internals.settings.DO_NOT_FORCE_COMPOSITED_SCROLLING); | |
hartmanng
2013/05/02 14:04:01
same as above
| |
100 | |
93 var shouldOptIn = oldStackingOrder.length === newStackingOrder.length; | 101 var shouldOptIn = oldStackingOrder.length === newStackingOrder.length; |
94 for (var i = 0; i < oldStackingOrder.length; ++i) { | 102 for (var i = 0; i < oldStackingOrder.length; ++i) { |
95 if (oldStackingOrder[i] !== newStackingOrder[i]) { | 103 if (oldStackingOrder[i] !== newStackingOrder[i]) { |
96 shouldOptIn = false; | 104 shouldOptIn = false; |
97 break; | 105 break; |
98 } | 106 } |
99 } | 107 } |
100 | 108 |
101 container.style.webkitTransform = ''; | 109 container.style.webkitTransform = ''; |
102 if (shouldOptIn !== didOptIn(container)) { | 110 if (shouldOptIn !== containerOptedIn) { |
103 if (shouldOptIn) | 111 if (shouldOptIn) |
104 write("FAIL - should've automatically opted in but didn't " + count); | 112 write("FAIL - should've automatically opted in but didn't " + count); |
105 else | 113 else |
106 write('FAIL - automatically opted in and changed stacking order ' + co unt); | 114 write('FAIL - automatically opted in and changed stacking order ' + co unt); |
107 | 115 |
108 var additionalFailureInfo = "\tOrdering:"; | 116 var additionalFailureInfo = "\tOrdering:"; |
109 for(var i = 0; i < ordering.length; ++i) { | 117 for(var i = 0; i < ordering.length; ++i) { |
110 additionalFailureInfo += " " + ordering[i].id + " (z-index: " + orderi ng[i].style.zIndex + ")"; | 118 additionalFailureInfo += " " + ordering[i].id + " (z-index: " + orderi ng[i].style.zIndex + ")"; |
111 if(i < ordering.length - 1) | 119 if(i < ordering.length - 1) |
112 additionalFailureInfo += ","; | 120 additionalFailureInfo += ","; |
(...skipping 15 matching lines...) Expand all Loading... | |
128 permute(testPermutation); | 136 permute(testPermutation); |
129 } | 137 } |
130 | 138 |
131 window.addEventListener('load', doTest, false); | 139 window.addEventListener('load', doTest, false); |
132 </script> | 140 </script> |
133 </head> | 141 </head> |
134 | 142 |
135 <body> | 143 <body> |
136 </body> | 144 </body> |
137 </html> | 145 </html> |
OLD | NEW |