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

Side by Side Diff: LayoutTests/compositing/overflow/build-paint-order-lists.html

Issue 14858004: Clean up the way layout tests force elements to opt in/out of composited scrolling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 6 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 border: 1px solid black; 10 border: 1px solid black;
(...skipping 30 matching lines...) Expand all
41 width: 180px; 41 width: 180px;
42 height: 30px; 42 height: 30px;
43 margin: 10px; 43 margin: 10px;
44 top: -20px; 44 top: -20px;
45 background-color: yellow; 45 background-color: yellow;
46 } 46 }
47 </style> 47 </style>
48 <script src="resources/automatically-opt-into-composited-scrolling.js"></scrip t> 48 <script src="resources/automatically-opt-into-composited-scrolling.js"></scrip t>
49 <script src="resources/build-paint-order-lists.js"></script> 49 <script src="resources/build-paint-order-lists.js"></script>
50 <script> 50 <script>
51 if (window.internals)
52 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(true);
53
51 function compareStackingOrderWithPaintOrder(stackingOrder, paintOrder) 54 function compareStackingOrderWithPaintOrder(stackingOrder, paintOrder)
52 { 55 {
53 if (debugMode) { 56 if (debugMode) {
54 write("paint order:") 57 write("paint order:")
55 for (var i = 0; i < paintOrder.length; i++) 58 for (var i = 0; i < paintOrder.length; i++)
56 write(paintOrder[i].id + " " + paintOrder[i].className + " " + paintOr der[paintOrder.length - i - 1].tagName); 59 write(paintOrder[i].id + " " + paintOrder[i].className + " " + paintOr der[paintOrder.length - i - 1].tagName);
57 60
58 write("stacking order:") 61 write("stacking order:")
59 for (var i = 0; i < stackingOrder.length; i++) 62 for (var i = 0; i < stackingOrder.length; i++)
60 write(stackingOrder[i].id + " " + stackingOrder[i].className + " " + s tackingOrder[i].tagName); 63 write(stackingOrder[i].id + " " + stackingOrder[i].className + " " + s tackingOrder[i].tagName);
(...skipping 12 matching lines...) Expand all
73 if (stackingOrder[i] === paintOrder[paintOrder.length - j - 1]) 76 if (stackingOrder[i] === paintOrder[paintOrder.length - j - 1])
74 j++; 77 j++;
75 78
76 if (debugMode) 79 if (debugMode)
77 write(stackingOrder.length + " " + i + " " + paintOrder.length + " " + j ); 80 write(stackingOrder.length + " " + i + " " + paintOrder.length + " " + j );
78 81
79 return j == paintOrder.length; 82 return j == paintOrder.length;
80 } 83 }
81 84
82 function testPermutation(count) { 85 function testPermutation(count) {
86 if (!window.internals)
87 return;
88
83 var container = document.getElementById('container'); 89 var container = document.getElementById('container');
84 // Here we want to compare paint order lists before and after promotion 90 // Here we want to compare paint order lists before and after promotion
85 // to the actual stacking order as determined by hit-testing. So we 91 // to the actual stacking order as determined by hit-testing. So we
86 // first force the element not to promote, then compute its paint and 92 // first force the element not to promote, then compute its paint and
87 // stacking order lists. We then force the element to opt in, and 93 // stacking order lists. We then force the element to opt in, and
88 // generate the paint and stacking order lists after opt-in. 94 // generate the paint and stacking order lists after opt-in.
89 // 95 //
90 // The paint order lists should exactly match the stacking order lists 96 // The paint order lists should exactly match the stacking order lists
91 // (modulo children that fall outside of the hit-testing area 97 // (modulo children that fall outside of the hit-testing area
92 // on-screen), both before and after promotion. 98 // on-screen), both before and after promotion.
93 container.style.webkitTransform = 'translateZ(0px)'; 99 container.style.webkitTransform = 'translateZ(0px)';
94 document.body.offsetTop; 100 document.body.offsetTop;
95 101
96 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(false); 102 window.internals.setNeedsCompositedScrolling(container,
103 window.internals.CompositedScrollingAlwaysOff);
97 container.style.webkitTransform = ''; 104 container.style.webkitTransform = '';
98 105
99 var oldStackingOrder = getStackingOrder(container); 106 var oldStackingOrder = getStackingOrder(container);
100 var oldPaintOrder = getPaintOrder(container); 107 var oldPaintOrder = getPaintOrder(container);
101 108
102 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnable d(true); 109 window.internals.setNeedsCompositedScrolling(container,
110 window.internals.CompositedScrollingAlwaysOn);
103 container.style.webkitTransform = 'translateZ(0px)'; 111 container.style.webkitTransform = 'translateZ(0px)';
104 112
105 var newStackingOrder = getStackingOrder(container); 113 var newStackingOrder = getStackingOrder(container);
106 var newPaintOrder = getPaintOrder(container); 114 var newPaintOrder = getPaintOrder(container);
107 115
116 window.internals.setNeedsCompositedScrolling(container,
117 window.internals.DoNotForceCompositedScrolling);
108 // The getPaintOrder() function should return a pair of paint orders. 118 // The getPaintOrder() function should return a pair of paint orders.
109 // One before promotion and one after. This pair of lists should remain 119 // One before promotion and one after. This pair of lists should remain
110 // identical whether the element is actually currently promoted or not, 120 // identical whether the element is actually currently promoted or not,
111 // its purpose is to generate hypothetical pre- and post-lists to 121 // its purpose is to generate hypothetical pre- and post-lists to
112 // determine if the element is promotable. 122 // determine if the element is promotable.
113 if (!comparePaintOrderLists(oldPaintOrder, newPaintOrder)) 123 if (!comparePaintOrderLists(oldPaintOrder, newPaintOrder))
114 write("iteration " + count + " FAIL - paint order lists not identical be fore/after promotion"); 124 write("iteration " + count + " FAIL - paint order lists not identical be fore/after promotion");
115 125
116 if (!compareStackingOrderWithPaintOrder(oldStackingOrder, oldPaintOrder.be forePromote)) 126 if (!compareStackingOrderWithPaintOrder(oldStackingOrder, oldPaintOrder.be forePromote))
117 write("iteration " + count + " FAIL - paint order list before promote do esn't match stacking order"); 127 write("iteration " + count + " FAIL - paint order list before promote do esn't match stacking order");
(...skipping 16 matching lines...) Expand all
134 permute(testPermutation); 144 permute(testPermutation);
135 } 145 }
136 146
137 window.addEventListener('load', doTest, false); 147 window.addEventListener('load', doTest, false);
138 </script> 148 </script>
139 </head> 149 </head>
140 150
141 <body> 151 <body>
142 </body> 152 </body>
143 </html> 153 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698