| 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" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 EXPECT_TRUE(success); \ | 88 EXPECT_TRUE(success); \ |
| 89 EXPECT_RECT_EQ(expectedTransformedRect, \ | 89 EXPECT_RECT_EQ(expectedTransformedRect, \ |
| 90 geometryMapper->localToAncestorRect( \ | 90 geometryMapper->localToAncestorRect( \ |
| 91 inputRect, localPropertyTreeState, \ | 91 inputRect, localPropertyTreeState, \ |
| 92 ancestorPropertyTreeState, success)); \ | 92 ancestorPropertyTreeState, success)); \ |
| 93 EXPECT_RECT_EQ(expectedTransformedRect, \ | 93 EXPECT_RECT_EQ(expectedTransformedRect, \ |
| 94 geometryMapper->mapRectToDestinationSpace( \ | 94 geometryMapper->mapRectToDestinationSpace( \ |
| 95 inputRect, localPropertyTreeState, \ | 95 inputRect, localPropertyTreeState, \ |
| 96 ancestorPropertyTreeState, success)); \ | 96 ancestorPropertyTreeState, success)); \ |
| 97 EXPECT_TRUE(success); \ | 97 EXPECT_TRUE(success); \ |
| 98 EXPECT_EQ( \ | 98 if (ancestorPropertyTreeState.transform() != \ |
| 99 expectedTransformToAncestor, \ | 99 localPropertyTreeState.transform()) { \ |
| 100 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \ | 100 EXPECT_EQ( \ |
| 101 .toAncestorTransforms.get(localPropertyTreeState.transform())); \ | 101 expectedTransformToAncestor, \ |
| 102 EXPECT_EQ(expectedClipInAncestorSpace, \ | 102 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \ |
| 103 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \ | 103 .toAncestorTransforms.get(localPropertyTreeState.transform())); \ |
| 104 .toAncestorClipRects.get(localPropertyTreeState.clip())); \ | 104 } \ |
| 105 if (ancestorPropertyTreeState.clip() != localPropertyTreeState.clip()) { \ |
| 106 EXPECT_EQ(expectedClipInAncestorSpace, \ |
| 107 getPrecomputedDataForAncestor(ancestorPropertyTreeState) \ |
| 108 .toAncestorClipRects.get(localPropertyTreeState.clip())); \ |
| 109 } \ |
| 105 } while (false) | 110 } while (false) |
| 106 | 111 |
| 107 TEST_F(GeometryMapperTest, Root) { | 112 TEST_F(GeometryMapperTest, Root) { |
| 108 FloatRect input(0, 0, 100, 100); | 113 FloatRect input(0, 0, 100, 100); |
| 109 | 114 |
| 110 CHECK_MAPPINGS(input, input, input, | 115 CHECK_MAPPINGS(input, input, input, |
| 111 TransformPaintPropertyNode::root()->matrix(), | 116 TransformPaintPropertyNode::root()->matrix(), |
| 112 ClipPaintPropertyNode::root()->clipRect().rect(), | 117 ClipPaintPropertyNode::root()->clipRect().rect(), |
| 113 rootPropertyTreeState(), rootPropertyTreeState()); | 118 rootPropertyTreeState(), rootPropertyTreeState()); |
| 114 } | 119 } |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 EXPECT_EQ(rootPropertyTreeState().transform(), | 581 EXPECT_EQ(rootPropertyTreeState().transform(), |
| 577 leastCommonAncestor(childOfChild2.get(), | 582 leastCommonAncestor(childOfChild2.get(), |
| 578 rootPropertyTreeState().transform())); | 583 rootPropertyTreeState().transform())); |
| 579 EXPECT_EQ(child2, leastCommonAncestor(childOfChild2.get(), child2.get())); | 584 EXPECT_EQ(child2, leastCommonAncestor(childOfChild2.get(), child2.get())); |
| 580 | 585 |
| 581 EXPECT_EQ(rootPropertyTreeState().transform(), | 586 EXPECT_EQ(rootPropertyTreeState().transform(), |
| 582 leastCommonAncestor(child1.get(), child2.get())); | 587 leastCommonAncestor(child1.get(), child2.get())); |
| 583 } | 588 } |
| 584 | 589 |
| 585 } // namespace blink | 590 } // namespace blink |
| OLD | NEW |