| 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 "CCLayerSorter.h" | 7 #include "CCLayerSorter.h" |
| 8 | 8 |
| 9 #include "CCLayerImpl.h" | 9 #include "CCLayerImpl.h" |
| 10 #include "CCMathUtil.h" | 10 #include "CCMathUtil.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // 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 |
| 197 // accidentally reversed, causing bugs in z-index ordering on websites when | 197 // accidentally reversed, causing bugs in z-index ordering on websites when |
| 198 // preserves3D triggered the CCLayerSorter. | 198 // preserves3D triggered the CCLayerSorter. |
| 199 | 199 |
| 200 // Input list of layers: [1, 2, 3, 4, 5]. | 200 // Input list of layers: [1, 2, 3, 4, 5]. |
| 201 // Expected output: [3, 4, 1, 2, 5]. | 201 // 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. | 202 // - 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. | 203 // - 3 and 4 do not have a 3d z difference, and therefore their relative
ordering should be retained. |
| 204 // - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5. | 204 // - 3 and 4 should be re-sorted so they are in front of 1, 2, and 5. |
| 205 | 205 |
| 206 OwnPtr<CCLayerImpl> layer1 = CCLayerImpl::create(1); | 206 scoped_ptr<CCLayerImpl> layer1 = CCLayerImpl::create(1); |
| 207 OwnPtr<CCLayerImpl> layer2 = CCLayerImpl::create(2); | 207 scoped_ptr<CCLayerImpl> layer2 = CCLayerImpl::create(2); |
| 208 OwnPtr<CCLayerImpl> layer3 = CCLayerImpl::create(3); | 208 scoped_ptr<CCLayerImpl> layer3 = CCLayerImpl::create(3); |
| 209 OwnPtr<CCLayerImpl> layer4 = CCLayerImpl::create(4); | 209 scoped_ptr<CCLayerImpl> layer4 = CCLayerImpl::create(4); |
| 210 OwnPtr<CCLayerImpl> layer5 = CCLayerImpl::create(5); | 210 scoped_ptr<CCLayerImpl> layer5 = CCLayerImpl::create(5); |
| 211 | 211 |
| 212 WebTransformationMatrix BehindMatrix; | 212 WebTransformationMatrix BehindMatrix; |
| 213 BehindMatrix.translate3d(0, 0, 2); | 213 BehindMatrix.translate3d(0, 0, 2); |
| 214 WebTransformationMatrix FrontMatrix; | 214 WebTransformationMatrix FrontMatrix; |
| 215 FrontMatrix.translate3d(0, 0, 1); | 215 FrontMatrix.translate3d(0, 0, 1); |
| 216 | 216 |
| 217 layer1->setBounds(IntSize(10, 10)); | 217 layer1->setBounds(IntSize(10, 10)); |
| 218 layer1->setContentBounds(IntSize(10, 10)); | 218 layer1->setContentBounds(IntSize(10, 10)); |
| 219 layer1->setDrawTransform(BehindMatrix); | 219 layer1->setDrawTransform(BehindMatrix); |
| 220 layer1->setDrawsContent(true); | 220 layer1->setDrawsContent(true); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); | 259 ASSERT_EQ(static_cast<size_t>(5), layerList.size()); |
| 260 EXPECT_EQ(3, layerList[0]->id()); | 260 EXPECT_EQ(3, layerList[0]->id()); |
| 261 EXPECT_EQ(4, layerList[1]->id()); | 261 EXPECT_EQ(4, layerList[1]->id()); |
| 262 EXPECT_EQ(1, layerList[2]->id()); | 262 EXPECT_EQ(1, layerList[2]->id()); |
| 263 EXPECT_EQ(2, layerList[3]->id()); | 263 EXPECT_EQ(2, layerList[3]->id()); |
| 264 EXPECT_EQ(5, layerList[4]->id()); | 264 EXPECT_EQ(5, layerList[4]->id()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace | 267 } // namespace |
| OLD | NEW |