OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <html><head> | 3 <html><head> |
4 <style> | 4 <style> |
5 .filler { | 5 .filler { |
6 background-color: #CC9900; | 6 background-color: #CC9900; |
7 border-style: solid; | 7 border-style: solid; |
8 border-width: 1px; | 8 border-width: 1px; |
9 width: 400px; | 9 width: 400px; |
10 height: 100px; | 10 height: 100px; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 write(stackingOrder.length + " " + i + " " + paintOrder.length + " " + j
); | 92 write(stackingOrder.length + " " + i + " " + paintOrder.length + " " + j
); |
93 | 93 |
94 return j === paintOrder.length; | 94 return j === paintOrder.length; |
95 } | 95 } |
96 | 96 |
97 function doTest() | 97 function doTest() |
98 { | 98 { |
99 var parentscrollinglayer = document.getElementById('parentscrollinglayer')
; | 99 var parentscrollinglayer = document.getElementById('parentscrollinglayer')
; |
100 var childscrollinglayer = document.getElementById('childscrollinglayer'); | 100 var childscrollinglayer = document.getElementById('childscrollinglayer'); |
101 | 101 |
102 if (window.internals) { | 102 if (window.internals) |
103 var failure = false; | 103 return; |
104 | 104 |
105 // Here we want to compare paint order lists before and after promotion | 105 var failure = false; |
106 // to the actual stacking order as determined by hit-testing. So we | |
107 // first force the element not to promote, then compute its paint and | |
108 // stacking order lists. We then force the element to opt in, and | |
109 // generate the paint and stacking order lists after opt-in. | |
110 // | |
111 // The paint order lists should exactly match the stacking order lists | |
112 // (modulo children that fall outside of the hit-testing area | |
113 // on-screen), both before and after promotion. | |
114 parentscrollinglayer.style.webkitTransform = 'translateZ(0px)'; | |
115 document.body.offsetTop; | |
116 | 106 |
117 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnab
led(false); | 107 // Here we want to compare paint order lists before and after promotion |
118 parentscrollinglayer.style.webkitTransform = ''; | 108 // to the actual stacking order as determined by hit-testing. So we |
| 109 // first force the element not to promote, then compute its paint and |
| 110 // stacking order lists. We then force the element to opt in, and |
| 111 // generate the paint and stacking order lists after opt-in. |
| 112 // |
| 113 // The paint order lists should exactly match the stacking order lists |
| 114 // (modulo children that fall outside of the hit-testing area |
| 115 // on-screen), both before and after promotion. |
| 116 parentscrollinglayer.style.webkitTransform = 'translateZ(0px)'; |
| 117 document.body.offsetTop; |
119 | 118 |
120 var oldStackingOrder = getStackingOrder(); | 119 window.internals.setNeedsCompositedScrolling(parentscrollinglayer, |
121 var oldPaintOrder = getPaintOrder(childscrollinglayer); | 120 window.internals.FORCE_COMPOSITED_SCROLLING_OFF); |
| 121 parentscrollinglayer.style.webkitTransform = ''; |
122 | 122 |
123 window.internals.settings.setAcceleratedCompositingForOverflowScrollEnab
led(true); | 123 var oldStackingOrder = getStackingOrder(); |
124 parentscrollinglayer.style.webkitTransform = 'translateZ(0px)'; | 124 var oldPaintOrder = getPaintOrder(childscrollinglayer); |
125 | 125 |
126 var newStackingOrder = getStackingOrder(); | 126 window.internals.setNeedsCompositedScrolling(parentscrollinglayer, |
127 var newPaintOrder = getPaintOrder(childscrollinglayer); | 127 window.internals.FORCE_COMPOSITED_SCROLLING_ON); |
| 128 parentscrollinglayer.style.webkitTransform = 'translateZ(0px)'; |
128 | 129 |
129 // The getPaintOrder() function should return a pair of paint orders. | 130 var newStackingOrder = getStackingOrder(); |
130 // One before promotion and one after. This pair of lists should remain | 131 var newPaintOrder = getPaintOrder(childscrollinglayer); |
131 // identical whether the element is actually currently promoted or not, | |
132 // its purpose is to generate hypothetical pre- and post-lists to | |
133 // determine if the element is promotable. | |
134 if (!comparePaintOrderLists(oldPaintOrder, newPaintOrder)) { | |
135 failure = true; | |
136 write("FAIL - paint order lists not identical before/after promotion")
; | |
137 } | |
138 | 132 |
139 if (!compareStackingOrderWithPaintOrder(oldStackingOrder, oldPaintOrder.
beforePromote)) { | 133 // The getPaintOrder() function should return a pair of paint orders. |
140 failure = true; | 134 // One before promotion and one after. This pair of lists should remain |
141 write("FAIL - paint order list before promote doesn't match stacking o
rder"); | 135 // identical whether the element is actually currently promoted or not, |
142 } | 136 // its purpose is to generate hypothetical pre- and post-lists to |
| 137 // determine if the element is promotable. |
| 138 if (!comparePaintOrderLists(oldPaintOrder, newPaintOrder)) { |
| 139 failure = true; |
| 140 write("FAIL - paint order lists not identical before/after promotion"); |
| 141 } |
143 | 142 |
144 if (!compareStackingOrderWithPaintOrder(newStackingOrder, oldPaintOrder.
afterPromote)) { | 143 if (!compareStackingOrderWithPaintOrder(oldStackingOrder, oldPaintOrder.be
forePromote)) { |
145 failure = true; | 144 failure = true; |
146 write("FAIL - paint order list after promote doesn't match stacking or
der"); | 145 write("FAIL - paint order list before promote doesn't match stacking ord
er"); |
147 } | 146 } |
148 | 147 |
149 var childScrollingLayerOccurrences = countOccurrencesOfElementInPaintOrd
erList(oldPaintOrder.beforePromote, childscrollinglayer); | 148 if (!compareStackingOrderWithPaintOrder(newStackingOrder, oldPaintOrder.af
terPromote)) { |
150 if (childScrollingLayerOccurrences !== 1) { | 149 failure = true; |
151 failure = true; | 150 write("FAIL - paint order list after promote doesn't match stacking orde
r"); |
152 write("FAIL - paint order list before promote contains " + childScroll
ingLayerOccurrences + " occurrences of child scrolling layer. Should be exactly
1."); | 151 } |
153 } | |
154 | 152 |
155 childScrollingLayerOccurrences = countOccurrencesOfElementInPaintOrderLi
st(oldPaintOrder.afterPromote, childscrollinglayer); | 153 var childScrollingLayerOccurrences = countOccurrencesOfElementInPaintOrder
List(oldPaintOrder.beforePromote, childscrollinglayer); |
156 if (childScrollingLayerOccurrences !== 1) { | 154 if (childScrollingLayerOccurrences !== 1) { |
157 failure = true; | 155 failure = true; |
158 write("FAIL - paint order list after promote contains " + childScrolli
ngLayerOccurrences + " occurrences of child scrolling layer. Should be exactly 1
."); | 156 write("FAIL - paint order list before promote contains " + childScrollin
gLayerOccurrences + " occurrences of child scrolling layer. Should be exactly 1.
"); |
159 } | 157 } |
160 | 158 |
161 if(!failure) | 159 childScrollingLayerOccurrences = countOccurrencesOfElementInPaintOrderList
(oldPaintOrder.afterPromote, childscrollinglayer); |
162 write("PASS - did not crash."); | 160 if (childScrollingLayerOccurrences !== 1) { |
| 161 failure = true; |
| 162 write("FAIL - paint order list after promote contains " + childScrolling
LayerOccurrences + " occurrences of child scrolling layer. Should be exactly 1."
); |
163 } | 163 } |
| 164 |
| 165 if(!failure) |
| 166 write("PASS - did not crash."); |
164 } | 167 } |
165 | 168 |
166 window.addEventListener('load', doTest, false); | 169 window.addEventListener('load', doTest, false); |
167 </script> | 170 </script> |
168 </head> | 171 </head> |
169 <body> | 172 <body> |
170 <div class="filler"></div> | 173 <div class="filler"></div> |
171 <div id="parentscrollinglayer"> | 174 <div id="parentscrollinglayer"> |
172 <div id="childscrollinglayer"> | 175 <div id="childscrollinglayer"> |
173 <div class="filler"></div> | 176 <div class="filler"></div> |
174 </div> | 177 </div> |
175 <div class="filler"></div> | 178 <div class="filler"></div> |
176 <div class="filler"></div> | 179 <div class="filler"></div> |
177 </div> | 180 </div> |
178 <div id="fillerchild1" class="filler negativechild"></div> | 181 <div id="fillerchild1" class="filler negativechild"></div> |
179 <div id="fillerchild2" class="filler negativechild"></div> | 182 <div id="fillerchild2" class="filler negativechild"></div> |
180 <div id="fillerchild3" class="filler negativechild"></div> | 183 <div id="fillerchild3" class="filler negativechild"></div> |
181 <div id="fillerchild4" class="filler negativechild"></div> | 184 <div id="fillerchild4" class="filler negativechild"></div> |
182 <pre id="console"></pre> | 185 <pre id="console"></pre> |
183 </body> | 186 </body> |
184 </html> | 187 </html> |
OLD | NEW |