OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "platform/graphics/paint/DisplayItemPropertyTreeBuilder.h" | 6 #include "platform/graphics/paint/DisplayItemPropertyTreeBuilder.h" |
7 | 7 |
8 #include "platform/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/graphics/paint/DisplayItemClient.h" | 9 #include "platform/graphics/paint/DisplayItemClient.h" |
10 #include "platform/graphics/paint/DisplayItemClipTree.h" | 10 #include "platform/graphics/paint/DisplayItemClipTree.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 // There should be three range records, the middle one affected by the | 409 // There should be three range records, the middle one affected by the |
410 // scroll. Note that the translation due to scroll is the negative of the | 410 // scroll. Note that the translation due to scroll is the negative of the |
411 // scroll offset. | 411 // scroll offset. |
412 EXPECT_THAT(rangeRecordsAsStdVector(), ElementsAre( | 412 EXPECT_THAT(rangeRecordsAsStdVector(), ElementsAre( |
413 AllOf(hasRange(0, 1), hasTransformNode(0), hasOffset(FloatSize(0, 0))), | 413 AllOf(hasRange(0, 1), hasTransformNode(0), hasOffset(FloatSize(0, 0))), |
414 AllOf(hasRange(2, 3), hasTransformNode(0), hasOffset(FloatSize(90, -400)
)), | 414 AllOf(hasRange(2, 3), hasTransformNode(0), hasOffset(FloatSize(90, -400)
)), |
415 AllOf(hasRange(4, 5), hasTransformNode(0), hasOffset(FloatSize(0, 0)))))
; | 415 AllOf(hasRange(4, 5), hasTransformNode(0), hasOffset(FloatSize(0, 0)))))
; |
416 } | 416 } |
417 | 417 |
| 418 TEST_F(DisplayItemPropertyTreeBuilderTest, TransformTreeIncludesTransformOrigin) |
| 419 { |
| 420 FloatPoint3D transformOrigin(1, 2, 3); |
| 421 TransformationMatrix matrix; |
| 422 matrix.scale3d(2, 2, 2); |
| 423 |
| 424 auto transformClient = processBeginTransform3D(matrix, transformOrigin); |
| 425 processDummyDisplayItem(); |
| 426 processEndTransform3D(transformClient); |
| 427 finishPropertyTrees(); |
| 428 |
| 429 // There should be two transform nodes. |
| 430 ASSERT_EQ(2u, transformTree().nodeCount()); |
| 431 EXPECT_TRUE(transformTree().nodeAt(0).isRoot()); |
| 432 |
| 433 // And the non-root node should have both the matrix and the origin, |
| 434 // separately. |
| 435 const auto& transformNode = transformTree().nodeAt(1); |
| 436 EXPECT_EQ(0u, transformNode.parentNodeIndex); |
| 437 EXPECT_EQ(TransformationMatrix::toSkMatrix44(matrix), transformNode.matrix); |
| 438 EXPECT_EQ(transformOrigin, transformNode.transformOrigin); |
| 439 } |
| 440 |
418 } // namespace | 441 } // namespace |
419 } // namespace blink | 442 } // namespace blink |
OLD | NEW |