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

Unified Diff: third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp

Issue 2482753002: Fix matrix3d transform under page zoom (Closed)
Patch Set: Add a comment for zoom Created 4 years, 1 month 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
Index: third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp
diff --git a/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp b/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp
index f1f6245c86252820ebf14f6691d47ec1a5bf062d..cf6bdd1201ace8ac27acd0967d368b0f72b7aedb 100644
--- a/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp
+++ b/third_party/WebKit/Source/platform/transforms/TransformOperationsTest.cpp
@@ -508,4 +508,36 @@ TEST(TransformOperationsTest, AbsoluteSequenceBoundsTest) {
FloatBox(-7, -3, 2, 15, 23, 20), bounds);
}
+TEST(TransformOperationsTest, ZoomTest) {
+ double zoomFactor = 1.25;
+
+ FloatPoint3D originalPoint(2, 3, 4);
+
+ TransformOperations ops;
+ ops.operations().append(TranslateTransformOperation::create(
+ Length(1, Fixed), Length(2, Fixed), 3, TransformOperation::Translate3D));
+ ops.operations().append(PerspectiveTransformOperation::create(1234));
+ ops.operations().append(
+ Matrix3DTransformOperation::create(TransformationMatrix(
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)));
+
+ // Apply unzoomed ops to unzoomed units, then zoom in
+ FloatPoint3D unzoomedPoint = originalPoint;
+ TransformOperations unzoomedOps = ops;
+ TransformationMatrix unzoomedMatrix;
+ ops.apply(FloatSize(0, 0), unzoomedMatrix);
+ FloatPoint3D result1 = unzoomedMatrix.mapPoint(unzoomedPoint);
+ result1.scale(zoomFactor, zoomFactor, zoomFactor);
+
+ // Apply zoomed ops to zoomed units
+ FloatPoint3D zoomedPoint = originalPoint;
+ zoomedPoint.scale(zoomFactor, zoomFactor, zoomFactor);
+ TransformOperations zoomedOps = ops.zoom(zoomFactor);
+ TransformationMatrix zoomedMatrix;
+ zoomedOps.apply(FloatSize(0, 0), zoomedMatrix);
+ FloatPoint3D result2 = zoomedMatrix.mapPoint(zoomedPoint);
+
+ EXPECT_EQ(result1, result2);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698