Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1597)

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp

Issue 2268773002: Support css clip on fixed-position GeometryMapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e763279eccdfd8580d71faa358ca61ed32bcf04d..554fb6ffea12f419b4a7b7228d548b3ba32f454e 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
@@ -390,4 +390,54 @@ TEST_F(GeometryMapperTest, SiblingTransforms)
EXPECT_RECT_EQ(expected, result);
}
+TEST_F(GeometryMapperTest, SiblingTransformsWithClip)
+{
+ // These transforms are siblings. Thus mapping from one to the other requires going through the root.
+ TransformationMatrix rotateTransform1;
+ rotateTransform1.rotate(45);
+ RefPtr<TransformPaintPropertyNode> transform1 = TransformPaintPropertyNode::create(rootPropertyTreeState().transform, rotateTransform1, FloatPoint3D());
+
+ TransformationMatrix rotateTransform2;
+ rotateTransform2.rotate(-45);
+ RefPtr<TransformPaintPropertyNode> transform2 = TransformPaintPropertyNode::create(rootPropertyTreeState().transform, rotateTransform2, FloatPoint3D());
+
+ RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::create(rootPropertyTreeState().clip, transform2.get(), FloatRoundedRect(10, 10, 70, 70));
+
+ PropertyTreeState transform1State = rootPropertyTreeState();
+ transform1State.transform = transform1;
+ PropertyTreeState transform2AndClipState = rootPropertyTreeState();
+ transform2AndClipState.transform = transform2;
+ transform2AndClipState.clip = clip;
+
+ bool success;
+ FloatRect input(0, 0, 100, 100);
+
+ // Test map from transform1State to transform2AndClipState.
+ FloatRect expected = rotateTransform2.inverse().mapRect(rotateTransform1.mapRect(input));
+
+ // mapToVisualRectInDestinationSpace ignores clip from the common ancestor to destination.
+ FloatRect result = geometryMapper->mapToVisualRectInDestinationSpace(input, transform1State, transform2AndClipState, success);
+ // Fails, because the clip of the destination state is not an ancestor of the clip of the source state.
+ EXPECT_FALSE(success);
+
+ // mapRectToDestinationSpace ignores clip.
+ result = geometryMapper->mapRectToDestinationSpace(input, transform1State, transform2AndClipState, success);
+ EXPECT_TRUE(success);
+ EXPECT_RECT_EQ(expected, result);
+
+ // Test map from transform2AndClipState to transform1State.
+ FloatRect expectedUnclipped = rotateTransform1.inverse().mapRect(rotateTransform2.mapRect(input));
+ FloatRect expectedClipped = rotateTransform1.inverse().mapRect(rotateTransform2.mapRect(FloatRect(10, 10, 70, 70)));
+
+ // mapToVisualRectInDestinationSpace ignores clip from the common ancestor to destination.
+ result = geometryMapper->mapToVisualRectInDestinationSpace(input, transform2AndClipState, transform1State, success);
+ EXPECT_TRUE(success);
+ EXPECT_RECT_EQ(expectedClipped, result);
+
+ // mapRectToDestinationSpace ignores clip.
+ result = geometryMapper->mapRectToDestinationSpace(input, transform2AndClipState, transform1State, success);
+ EXPECT_TRUE(success);
+ EXPECT_RECT_EQ(expectedUnclipped, result);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698