OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/layer_sorter.h" | 7 #include "cc/layer_sorter.h" |
8 | 8 |
9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bool clipped = false; | 182 bool clipped = false; |
183 MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped); | 183 MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped); |
184 ASSERT_TRUE(clipped); | 184 ASSERT_TRUE(clipped); |
185 | 185 |
186 overlapResult = LayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weig
ht); | 186 overlapResult = LayerSorter::checkOverlap(&layerA, &layerB, zThreshold, weig
ht); |
187 EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); | 187 EXPECT_EQ(LayerSorter::ABeforeB, overlapResult); |
188 } | 188 } |
189 | 189 |
190 TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) | 190 TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff) |
191 { | 191 { |
| 192 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 193 |
192 // If there is no reason to re-sort the layers (i.e. no 3d z difference), th
en the | 194 // If there is no reason to re-sort the layers (i.e. no 3d z difference), th
en the |
193 // existing ordering provided on input should be retained. This test covers
the fix in | 195 // existing ordering provided on input should be retained. This test covers
the fix in |
194 // https://bugs.webkit.org/show_bug.cgi?id=75046. Before this fix, ordering
was | 196 // https://bugs.webkit.org/show_bug.cgi?id=75046. Before this fix, ordering
was |
195 // accidentally reversed, causing bugs in z-index ordering on websites when | 197 // accidentally reversed, causing bugs in z-index ordering on websites when |
196 // preserves3D triggered the LayerSorter. | 198 // preserves3D triggered the LayerSorter. |
197 | 199 |
198 // Input list of layers: [1, 2, 3, 4, 5]. | 200 // Input list of layers: [1, 2, 3, 4, 5]. |
199 // Expected output: [3, 4, 1, 2, 5]. | 201 // Expected output: [3, 4, 1, 2, 5]. |
200 // - 1, 2, and 5 do not have a 3d z difference, and therefore their relat
ive ordering should be retained. | 202 // - 1, 2, and 5 do not have a 3d z difference, and therefore their relat
ive ordering should be retained. |
201 // - 3 and 4 do not have a 3d z difference, and therefore their relative
ordering should be retained. | 203 // - 3 and 4 do not have a 3d z difference, and therefore their relative
ordering should be retained. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 258 |
257 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); | 259 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); |
258 EXPECT_EQ(3, layerList[0]->id()); | 260 EXPECT_EQ(3, layerList[0]->id()); |
259 EXPECT_EQ(4, layerList[1]->id()); | 261 EXPECT_EQ(4, layerList[1]->id()); |
260 EXPECT_EQ(1, layerList[2]->id()); | 262 EXPECT_EQ(1, layerList[2]->id()); |
261 EXPECT_EQ(2, layerList[3]->id()); | 263 EXPECT_EQ(2, layerList[3]->id()); |
262 EXPECT_EQ(5, layerList[4]->id()); | 264 EXPECT_EQ(5, layerList[4]->id()); |
263 } | 265 } |
264 | 266 |
265 } // namespace | 267 } // namespace |
OLD | NEW |