| Index: third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
|
| index 7a5f7a718e5f6ded00babc994596b02e867c2a25..309a7bb04aac4c07c5fbecbb4b821bb10b9241ce 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
|
| @@ -29,10 +29,14 @@ class GeometryMapperTest : public ::testing::Test,
|
| return state;
|
| }
|
|
|
| - PrecomputedDataForAncestor& getPrecomputedDataForAncestor(
|
| + TransformCache& getTransformCache(
|
| const PropertyTreeState& propertyTreeState) {
|
| - return geometryMapper->getPrecomputedDataForAncestor(
|
| - propertyTreeState.transform());
|
| + return geometryMapper->getTransformCache(propertyTreeState.transform());
|
| + }
|
| +
|
| + ClipCache& getClipCache(const PropertyTreeState& propertyTreeState) {
|
| + return geometryMapper->getClipCache(propertyTreeState.transform(),
|
| + propertyTreeState.clip());
|
| }
|
|
|
| const TransformPaintPropertyNode* lowestCommonAncestor(
|
| @@ -123,15 +127,14 @@ const static float kTestEpsilon = 1e-6;
|
| ancestorPropertyTreeState.transform())); \
|
| if (ancestorPropertyTreeState.transform() != \
|
| localPropertyTreeState.transform()) { \
|
| - EXPECT_EQ( \
|
| - expectedTransformToAncestor, \
|
| - getPrecomputedDataForAncestor(ancestorPropertyTreeState) \
|
| - .toAncestorTransforms.get(localPropertyTreeState.transform())); \
|
| + EXPECT_EQ(expectedTransformToAncestor, \
|
| + getTransformCache(ancestorPropertyTreeState) \
|
| + .get(localPropertyTreeState.transform())); \
|
| } \
|
| if (ancestorPropertyTreeState.clip() != localPropertyTreeState.clip()) { \
|
| EXPECT_EQ(expectedClipInAncestorSpace, \
|
| - getPrecomputedDataForAncestor(ancestorPropertyTreeState) \
|
| - .toAncestorClipRects.get(localPropertyTreeState.clip())); \
|
| + getClipCache(ancestorPropertyTreeState) \
|
| + .get(localPropertyTreeState.clip())); \
|
| } \
|
| } while (false)
|
|
|
| @@ -245,8 +248,7 @@ TEST_F(GeometryMapperTest, NestedTransforms) {
|
|
|
| // Check the cached matrix for the intermediate transform.
|
| EXPECT_EQ(rotateTransform,
|
| - getPrecomputedDataForAncestor(rootPropertyTreeState())
|
| - .toAncestorTransforms.get(transform1.get()));
|
| + getTransformCache(rootPropertyTreeState()).get(transform1.get()));
|
| }
|
|
|
| TEST_F(GeometryMapperTest, NestedTransformsScaleAndTranslation) {
|
| @@ -276,9 +278,9 @@ TEST_F(GeometryMapperTest, NestedTransformsScaleAndTranslation) {
|
| rootPropertyTreeState());
|
|
|
| // Check the cached matrix for the intermediate transform.
|
| - EXPECT_EQ(scaleTransform,
|
| - getPrecomputedDataForAncestor(rootPropertyTreeState())
|
| - .toAncestorTransforms.get(transform1.get()));
|
| + EXPECT_EQ(scaleTransform, getTransformCache(rootPropertyTreeState())
|
| +
|
| + .get(transform1.get()));
|
| }
|
|
|
| TEST_F(GeometryMapperTest, NestedTransformsIntermediateDestination) {
|
| @@ -329,6 +331,44 @@ TEST_F(GeometryMapperTest, SimpleClip) {
|
| rootPropertyTreeState());
|
| }
|
|
|
| +TEST_F(GeometryMapperTest, TwoClips) {
|
| + RefPtr<ClipPaintPropertyNode> clip1 = ClipPaintPropertyNode::create(
|
| + ClipPaintPropertyNode::root(), TransformPaintPropertyNode::root(),
|
| + FloatRoundedRect(10, 10, 30, 40));
|
| +
|
| + RefPtr<ClipPaintPropertyNode> clip2 =
|
| + ClipPaintPropertyNode::create(clip1, TransformPaintPropertyNode::root(),
|
| + FloatRoundedRect(10, 10, 50, 50));
|
| +
|
| + PropertyTreeState localState = rootPropertyTreeState();
|
| + PropertyTreeState ancestorState = rootPropertyTreeState();
|
| + localState.setClip(clip2.get());
|
| +
|
| + FloatRect input(0, 0, 100, 100);
|
| + FloatRect output1(10, 10, 30, 40);
|
| +
|
| + CHECK_MAPPINGS(input, // Input
|
| + output1, // Visual rect
|
| + input, // Transformed rect (not clipped).
|
| + TransformPaintPropertyNode::root()
|
| + ->matrix(), // Transform matrix to ancestor space
|
| + clip1->clipRect().rect(), // Clip rect in ancestor space
|
| + localState,
|
| + ancestorState);
|
| +
|
| + ancestorState.setClip(clip1.get());
|
| + FloatRect output2(10, 10, 50, 50);
|
| +
|
| + CHECK_MAPPINGS(input, // Input
|
| + output2, // Visual rect
|
| + input, // Transformed rect (not clipped).
|
| + TransformPaintPropertyNode::root()
|
| + ->matrix(), // Transform matrix to ancestor space
|
| + clip2->clipRect().rect(), // Clip rect in ancestor space
|
| + localState,
|
| + ancestorState);
|
| +}
|
| +
|
| TEST_F(GeometryMapperTest, ClipBeforeTransform) {
|
| TransformationMatrix rotateTransform;
|
| rotateTransform.rotate(45);
|
|
|