Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: LayoutTests/compositing/overflow/automatically-opt-into-composited-scrolling.html

Issue 14741004: NOT FOR REVIEW - Update comp-scrolling state at a well defined point in the pipeline. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
64 if (count > 0)
65 return;
66
61 var container = document.getElementById('container'); 67 var container = document.getElementById('container');
68 var containerOptedIn = didOptIn(container);
62 69
63 // Below, when we set webkitTransform to '', we want that to force an 70 // Below, when we set webkitTransform to '', we want that to force an
64 // immediate, synchronous style recalculation. Querying the 71 // immediate, synchronous style recalculation. Querying the
65 // document.body.offsetTop value should force this for us. 72 // document.body.offsetTop value should force this for us.
66 // Note that this step is also performed inside getStackingOrder() to make 73 // Note that this step is also performed inside getStackingOrder() to make
67 // sure we have fresh values when we need them. 74 // sure we have fresh values when we need them.
68 container.style.webkitTransform = 'translateZ(0px)'; 75 container.style.webkitTransform = 'translateZ(0px)';
69 document.body.offsetTop; 76 document.body.offsetTop;
70 77
71 // container may be opting in automatically, so even if 78 // container may be opting in automatically, so even if
72 // container.style.webkitTransform === '', we need to explicitly force it 79 // 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 80 // not to opt in to get our first stacking order list. To do this, we need
74 // to disable compositing for overflow scroll entirely. 81 // to disable compositing for overflow scroll entirely.
75 // 82 //
76 // Unfortunately this operation won't dirty any style bits, and we will 83 // 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 84 // 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 85 // 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 86 // 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 87 // change a style property so the style is dirty, and force the style to
81 // be cleaned with document.body.offsetTop (inside getStackingOrder()). 88 // be cleaned with document.body.offsetTop (inside getStackingOrder()).
82 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(false); 89 window.internals.setNeedsCompositedScrolling(container,
90 window.internals.FORCE_COMPOSITED_SCROLLING_OFF);
83 container.style.webkitTransform = ''; 91 container.style.webkitTransform = '';
84
85 var oldStackingOrder = getStackingOrder(container); 92 var oldStackingOrder = getStackingOrder(container);
86 93
87 // force to promote. 94 window.internals.setNeedsCompositedScrolling(container,
88 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(true); 95 window.internals.FORCE_COMPOSITED_SCROLLING_ON);
89 container.style.webkitTransform = 'translateZ(0px)'; 96 container.style.webkitTransform = 'translateZ(0px)';
97 var newStackingOrder = getStackingOrder(container);
90 98
91 var newStackingOrder = getStackingOrder(container); 99 window.internals.setNeedsCompositedScrolling(container,
100 window.internals.settings.DO_NOT_FORCE_COMPOSITED_SCROLLING);
92 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
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698