Chromium Code Reviews| 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 dMode( | |
| 58 window.internals.settings.AcceleratedCompositingForOverflowScrollEnabl ed); | |
| 59 | |
| 56 function testPermutation(count, ordering, hasPositionedAncestor, containerIs Positioned) | 60 function testPermutation(count, ordering, hasPositionedAncestor, containerIs Positioned) |
| 57 { | 61 { |
| 58 if (!window.internals) | 62 if (!window.internals) |
| 59 return; | 63 return; |
| 60 | 64 |
| 61 var container = document.getElementById('container'); | 65 var container = document.getElementById('container'); |
| 66 var containerOptedIn = didOptIn(container); | |
| 62 | 67 |
| 63 // Below, when we set webkitTransform to '', we want that to force an | 68 // Below, when we set webkitTransform to '', we want that to force an |
| 64 // immediate, synchronous style recalculation. Querying the | 69 // immediate, synchronous style recalculation. Querying the |
| 65 // document.body.offsetTop value should force this for us. | 70 // document.body.offsetTop value should force this for us. |
| 66 // Note that this step is also performed inside getStackingOrder() to make | 71 // Note that this step is also performed inside getStackingOrder() to make |
| 67 // sure we have fresh values when we need them. | 72 // sure we have fresh values when we need them. |
| 68 container.style.webkitTransform = 'translateZ(0px)'; | 73 container.style.webkitTransform = 'translateZ(0px)'; |
| 69 document.body.offsetTop; | 74 document.body.offsetTop; |
| 70 | 75 |
| 71 // container may be opting in automatically, so even if | 76 // container may be opting in automatically, so even if |
| 72 // container.style.webkitTransform === '', we need to explicitly force it | 77 // 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 | 78 // not to opt in to get our first stacking order list. To do this, we need |
| 74 // to disable compositing for overflow scroll entirely. | 79 // to disable compositing for overflow scroll entirely. |
| 75 // | 80 // |
| 76 // Unfortunately this operation won't dirty any style bits, and we will | 81 // 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 | 82 // 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 | 83 // 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 | 84 // 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 | 85 // change a style property so the style is dirty, and force the style to |
| 81 // be cleaned with document.body.offsetTop (inside getStackingOrder()). | 86 // be cleaned with document.body.offsetTop (inside getStackingOrder()). |
| 82 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(false); | 87 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable dMode( |
| 88 window.internals.settings.AcceleratedCompositingForOverflowScrollDisab led); | |
| 83 container.style.webkitTransform = ''; | 89 container.style.webkitTransform = ''; |
| 84 | 90 |
| 85 var oldStackingOrder = getStackingOrder(container); | 91 var oldStackingOrder = getStackingOrder(container); |
| 86 | 92 |
| 87 // force to promote. | 93 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable dMode( |
| 88 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(true); | 94 window.internals.settings.AcceleratedCompositingForOverflowScrollAlway sOn); |
|
Julien - ping for review
2013/05/13 20:48:56
This is actually a change in behavior in the test
| |
| 89 container.style.webkitTransform = 'translateZ(0px)'; | 95 container.style.webkitTransform = 'translateZ(0px)'; |
| 90 | 96 |
| 91 var newStackingOrder = getStackingOrder(container); | 97 var newStackingOrder = getStackingOrder(container); |
| 92 | 98 |
| 99 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable dMode( | |
| 100 window.internals.settings.AcceleratedCompositingForOverflowScrollEnabl ed); | |
| 101 | |
| 93 var shouldOptIn = oldStackingOrder.length === newStackingOrder.length; | 102 var shouldOptIn = oldStackingOrder.length === newStackingOrder.length; |
| 94 for (var i = 0; i < oldStackingOrder.length; ++i) { | 103 for (var i = 0; i < oldStackingOrder.length; ++i) { |
| 95 if (oldStackingOrder[i] !== newStackingOrder[i]) { | 104 if (oldStackingOrder[i] !== newStackingOrder[i]) { |
| 96 shouldOptIn = false; | 105 shouldOptIn = false; |
| 97 break; | 106 break; |
| 98 } | 107 } |
| 99 } | 108 } |
| 100 | 109 |
| 101 container.style.webkitTransform = ''; | 110 container.style.webkitTransform = ''; |
| 102 if (shouldOptIn !== didOptIn(container)) { | 111 if (shouldOptIn !== containerOptedIn) { |
| 103 if (shouldOptIn) | 112 if (shouldOptIn) |
| 104 write("FAIL - should've automatically opted in but didn't " + count); | 113 write("FAIL - should've automatically opted in but didn't " + count); |
| 105 else | 114 else |
| 106 write('FAIL - automatically opted in and changed stacking order ' + co unt); | 115 write('FAIL - automatically opted in and changed stacking order ' + co unt); |
| 107 | 116 |
| 108 var additionalFailureInfo = "\tOrdering:"; | 117 var additionalFailureInfo = "\tOrdering:"; |
| 109 for(var i = 0; i < ordering.length; ++i) { | 118 for(var i = 0; i < ordering.length; ++i) { |
| 110 additionalFailureInfo += " " + ordering[i].id + " (z-index: " + orderi ng[i].style.zIndex + ")"; | 119 additionalFailureInfo += " " + ordering[i].id + " (z-index: " + orderi ng[i].style.zIndex + ")"; |
| 111 if(i < ordering.length - 1) | 120 if(i < ordering.length - 1) |
| 112 additionalFailureInfo += ","; | 121 additionalFailureInfo += ","; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 128 permute(testPermutation); | 137 permute(testPermutation); |
| 129 } | 138 } |
| 130 | 139 |
| 131 window.addEventListener('load', doTest, false); | 140 window.addEventListener('load', doTest, false); |
| 132 </script> | 141 </script> |
| 133 </head> | 142 </head> |
| 134 | 143 |
| 135 <body> | 144 <body> |
| 136 </body> | 145 </body> |
| 137 </html> | 146 </html> |
| OLD | NEW |