| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/paint/GeometryMapper.h" | 5 #include "platform/graphics/paint/GeometryMapper.h" |
| 6 | 6 |
| 7 #include "platform/geometry/GeometryTestHelpers.h" | 7 #include "platform/geometry/GeometryTestHelpers.h" |
| 8 #include "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
| 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 9 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 10 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 11 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | |
| 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 13 #include "platform/testing/PaintPropertyTestHelpers.h" | 12 #include "platform/testing/PaintPropertyTestHelpers.h" |
| 14 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 13 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 namespace blink { | 16 namespace blink { |
| 18 | 17 |
| 19 class GeometryMapperTest : public ::testing::Test, | 18 class GeometryMapperTest : public ::testing::Test, |
| 20 public ScopedSlimmingPaintV2ForTest { | 19 public ScopedSlimmingPaintV2ForTest { |
| 21 public: | 20 public: |
| 22 GeometryMapperTest() : ScopedSlimmingPaintV2ForTest(true) {} | 21 GeometryMapperTest() : ScopedSlimmingPaintV2ForTest(true) {} |
| 23 | 22 |
| 24 std::unique_ptr<GeometryMapper> geometryMapper; | 23 std::unique_ptr<GeometryMapper> geometryMapper; |
| 25 | 24 |
| 26 PropertyTreeState rootPropertyTreeState() { | 25 PropertyTreeState rootPropertyTreeState() { |
| 27 PropertyTreeState state( | 26 PropertyTreeState state(TransformPaintPropertyNode::root(), |
| 28 TransformPaintPropertyNode::root(), ClipPaintPropertyNode::root(), | 27 ClipPaintPropertyNode::root(), |
| 29 EffectPaintPropertyNode::root(), ScrollPaintPropertyNode::root()); | 28 EffectPaintPropertyNode::root()); |
| 30 return state; | 29 return state; |
| 31 } | 30 } |
| 32 | 31 |
| 33 PrecomputedDataForAncestor& getPrecomputedDataForAncestor( | 32 PrecomputedDataForAncestor& getPrecomputedDataForAncestor( |
| 34 const PropertyTreeState& propertyTreeState) { | 33 const PropertyTreeState& propertyTreeState) { |
| 35 return geometryMapper->getPrecomputedDataForAncestor( | 34 return geometryMapper->getPrecomputedDataForAncestor( |
| 36 propertyTreeState.transform()); | 35 propertyTreeState.transform()); |
| 37 } | 36 } |
| 38 | 37 |
| 39 const TransformPaintPropertyNode* lowestCommonAncestor( | 38 const TransformPaintPropertyNode* lowestCommonAncestor( |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 EXPECT_EQ(rootPropertyTreeState().transform(), | 600 EXPECT_EQ(rootPropertyTreeState().transform(), |
| 602 lowestCommonAncestor(childOfChild2.get(), | 601 lowestCommonAncestor(childOfChild2.get(), |
| 603 rootPropertyTreeState().transform())); | 602 rootPropertyTreeState().transform())); |
| 604 EXPECT_EQ(child2, lowestCommonAncestor(childOfChild2.get(), child2.get())); | 603 EXPECT_EQ(child2, lowestCommonAncestor(childOfChild2.get(), child2.get())); |
| 605 | 604 |
| 606 EXPECT_EQ(rootPropertyTreeState().transform(), | 605 EXPECT_EQ(rootPropertyTreeState().transform(), |
| 607 lowestCommonAncestor(child1.get(), child2.get())); | 606 lowestCommonAncestor(child1.get(), child2.get())); |
| 608 } | 607 } |
| 609 | 608 |
| 610 } // namespace blink | 609 } // namespace blink |
| OLD | NEW |