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 | |
194 // If there is no reason to re-sort the layers (i.e. no 3d z difference), th
en the | 192 // If there is no reason to re-sort the layers (i.e. no 3d z difference), th
en the |
195 // existing ordering provided on input should be retained. This test covers
the fix in | 193 // existing ordering provided on input should be retained. This test covers
the fix in |
196 // https://bugs.webkit.org/show_bug.cgi?id=75046. Before this fix, ordering
was | 194 // https://bugs.webkit.org/show_bug.cgi?id=75046. Before this fix, ordering
was |
197 // accidentally reversed, causing bugs in z-index ordering on websites when | 195 // accidentally reversed, causing bugs in z-index ordering on websites when |
198 // preserves3D triggered the LayerSorter. | 196 // preserves3D triggered the LayerSorter. |
199 | 197 |
200 // Input list of layers: [1, 2, 3, 4, 5]. | 198 // Input list of layers: [1, 2, 3, 4, 5]. |
201 // Expected output: [3, 4, 1, 2, 5]. | 199 // Expected output: [3, 4, 1, 2, 5]. |
202 // - 1, 2, and 5 do not have a 3d z difference, and therefore their relat
ive ordering should be retained. | 200 // - 1, 2, and 5 do not have a 3d z difference, and therefore their relat
ive ordering should be retained. |
203 // - 3 and 4 do not have a 3d z difference, and therefore their relative
ordering should be retained. | 201 // - 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... |
258 | 256 |
259 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); | 257 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); |
260 EXPECT_EQ(3, layerList[0]->id()); | 258 EXPECT_EQ(3, layerList[0]->id()); |
261 EXPECT_EQ(4, layerList[1]->id()); | 259 EXPECT_EQ(4, layerList[1]->id()); |
262 EXPECT_EQ(1, layerList[2]->id()); | 260 EXPECT_EQ(1, layerList[2]->id()); |
263 EXPECT_EQ(2, layerList[3]->id()); | 261 EXPECT_EQ(2, layerList[3]->id()); |
264 EXPECT_EQ(5, layerList[4]->id()); | 262 EXPECT_EQ(5, layerList[4]->id()); |
265 } | 263 } |
266 | 264 |
267 } // anonymous namespace | 265 } // anonymous namespace |
OLD | NEW |