| Index: cc/layer_tree_host_common_unittest.cc
|
| diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
|
| index 9d5a19026c41037a261f099f1e6a8c8dc178ba15..00999a972d579a39fe1e862bc90b05809842b4ed 100644
|
| --- a/cc/layer_tree_host_common_unittest.cc
|
| +++ b/cc/layer_tree_host_common_unittest.cc
|
| @@ -22,6 +22,7 @@
|
| #include "ui/gfx/quad_f.h"
|
| #include "ui/gfx/size_conversions.h"
|
| #include "ui/gfx/transform.h"
|
| +#include "ui/gfx/transform_util.h"
|
|
|
| namespace cc {
|
| namespace {
|
| @@ -287,7 +288,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
|
| // Sublayer matrix is applied to the center of the parent layer.
|
| parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * inverse(parentTranslationToAnchor)
|
| * parentTranslationToCenter * parentSublayerMatrix * inverse(parentTranslationToCenter);
|
| - gfx::Transform flattenedCompositeTransform = MathUtil::to2dTransform(parentCompositeTransform);
|
| + gfx::Transform flattenedCompositeTransform = gfx::CreateFlattenedTransform(parentCompositeTransform);
|
| setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
|
| setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
|
| setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
|
| @@ -616,7 +617,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
|
| scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
|
|
|
| gfx::Transform rotationAboutYAxis;
|
| - MathUtil::rotateEulerAngles(&rotationAboutYAxis, 0, 30, 0);
|
| + rotationAboutYAxis.RotateAboutYAxis(30);
|
|
|
| const gfx::Transform identityMatrix;
|
| setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
|
| @@ -635,7 +636,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
|
| gfx::Transform expectedChildDrawTransform = rotationAboutYAxis;
|
| gfx::Transform expectedChildScreenSpaceTransform = rotationAboutYAxis;
|
| gfx::Transform expectedGrandChildDrawTransform = rotationAboutYAxis; // draws onto child's renderSurface
|
| - gfx::Transform expectedGrandChildScreenSpaceTransform = MathUtil::to2dTransform(rotationAboutYAxis) * rotationAboutYAxis;
|
| + gfx::Transform expectedGrandChildScreenSpaceTransform = gfx::CreateFlattenedTransform(rotationAboutYAxis) * rotationAboutYAxis;
|
|
|
| executeCalculateDrawProperties(root.get());
|
|
|
| @@ -911,7 +912,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
|
| LayerImpl* greatGrandChild = grandChild->children()[0];
|
|
|
| gfx::Transform rotationAboutZ;
|
| - MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
|
| + rotationAboutZ.RotateAboutZAxis(90);
|
|
|
| child->setIsContainerForFixedPositionLayers(true);
|
| child->setTransform(rotationAboutZ);
|
| @@ -973,7 +974,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
|
| LayerImpl* greatGrandChild = grandChild->children()[0];
|
|
|
| gfx::Transform rotationAboutZ;
|
| - MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
|
| + rotationAboutZ.RotateAboutZAxis(90);
|
|
|
| child->setIsContainerForFixedPositionLayers(true);
|
| child->setTransform(rotationAboutZ);
|
| @@ -1041,7 +1042,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
|
| greatGrandChild->setDrawsContent(true);
|
|
|
| gfx::Transform rotationAboutZ;
|
| - MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
|
| + rotationAboutZ.RotateAboutZAxis(90);
|
| grandChild->setTransform(rotationAboutZ);
|
|
|
| // Case 1: scrollDelta of 0, 0
|
| @@ -1131,7 +1132,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
|
| // clip away layers that we want to test.
|
| gfx::Transform rotationAboutZ;
|
| rotationAboutZ.Translate(50, 50);
|
| - MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
|
| + rotationAboutZ.RotateAboutZAxis(90);
|
| rotationAboutZ.Translate(-50, -50);
|
| grandChild->setTransform(rotationAboutZ);
|
| greatGrandChild->setTransform(rotationAboutZ);
|
| @@ -1302,7 +1303,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
|
| LayerImpl* grandChild = child->children()[0];
|
|
|
| gfx::Transform rotationByZ;
|
| - MathUtil::rotateEulerAngles(&rotationByZ, 0, 0, 90);
|
| + rotationByZ.RotateAboutZAxis(90);
|
|
|
| root->setTransform(rotationByZ);
|
| grandChild->setFixedToContainerLayer(true);
|
| @@ -1929,7 +1930,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
|
|
|
| // Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface.
|
| layerToSurfaceTransform.MakeIdentity();
|
| - MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
|
| + layerToSurfaceTransform.RotateAboutYAxis(45);
|
| gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
|
| gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
|
| EXPECT_RECT_EQ(expected, actual);
|
| @@ -1940,7 +1941,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
|
| double halfWidthOfRotatedLayer = (100 / sqrt(2.0)) * 0.5; // 100 is the un-rotated layer width; divided by sqrt(2) is the rotated width.
|
| layerToSurfaceTransform.MakeIdentity();
|
| layerToSurfaceTransform.Translate(-halfWidthOfRotatedLayer, 0);
|
| - MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0); // rotates about the left edge of the layer
|
| + layerToSurfaceTransform.RotateAboutYAxis(45); // rotates about the left edge of the layer
|
| expected = gfx::Rect(gfx::Point(50, 0), gfx::Size(50, 100)); // right half of the layer.
|
| actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
|
| EXPECT_RECT_EQ(expected, actual);
|
| @@ -2001,7 +2002,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehi
|
| // center of the layer.
|
| layerToSurfaceTransform.MakeIdentity();
|
| layerToSurfaceTransform.Translate(50, 0);
|
| - MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
|
| + layerToSurfaceTransform.RotateAboutYAxis(45);
|
| layerToSurfaceTransform.Translate(-50, 0);
|
|
|
| gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
|
| @@ -2028,7 +2029,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW)
|
| layerToSurfaceTransform.MakeIdentity();
|
| layerToSurfaceTransform.ApplyPerspectiveDepth(1);
|
| layerToSurfaceTransform.Translate3d(-2, 0, 1);
|
| - MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
|
| + layerToSurfaceTransform.RotateAboutYAxis(45);
|
|
|
| // Sanity check that this transform does indeed cause w < 0 when applying the
|
| // transform, otherwise this code is not testing the intended scenario.
|
| @@ -2057,8 +2058,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
|
| layerToSurfaceTransform.MakeIdentity();
|
| layerToSurfaceTransform.ApplyPerspectiveDepth(1);
|
| layerToSurfaceTransform.Translate3d(0, 0, -5);
|
| - MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
|
| - MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 80, 0, 0);
|
| + layerToSurfaceTransform.RotateAboutYAxis(45);
|
| + layerToSurfaceTransform.RotateAboutXAxis(80);
|
|
|
| // Sanity check that un-projection does indeed cause w < 0, otherwise this code is not
|
| // testing the intended scenario.
|
| @@ -2936,7 +2937,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
|
| gfx::Transform identityMatrix;
|
| gfx::Transform rotation45DegreesAboutCenter;
|
| rotation45DegreesAboutCenter.Translate(50, 50);
|
| - MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45);
|
| + rotation45DegreesAboutCenter.RotateAboutZAxis(45);
|
| rotation45DegreesAboutCenter.Translate(-50, -50);
|
| gfx::PointF anchor(0, 0);
|
| gfx::PointF position(0, 0);
|
| @@ -3195,7 +3196,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
|
| child->setMasksToBounds(true);
|
|
|
| gfx::Transform rotation45DegreesAboutCorner;
|
| - MathUtil::rotateEulerAngles(&rotation45DegreesAboutCorner, 0, 0, 45);
|
| + rotation45DegreesAboutCorner.RotateAboutZAxis(45);
|
|
|
| position = gfx::PointF(0, 0); // remember, positioned with respect to its parent which is already at 10, 10
|
| bounds = gfx::Size(200, 200); // to ensure it covers at least sqrt(2) * 100.
|
| @@ -3205,9 +3206,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
|
| // Rotates about the center of the layer
|
| gfx::Transform rotatedLeafTransform;
|
| rotatedLeafTransform.Translate(-10, -10); // cancel out the grandParent's position
|
| - MathUtil::rotateEulerAngles(&rotatedLeafTransform, 0, 0, -45); // cancel out the corner 45-degree rotation of the parent.
|
| + rotatedLeafTransform.RotateAboutZAxis(-45); // cancel out the corner 45-degree rotation of the parent.
|
| rotatedLeafTransform.Translate(50, 50);
|
| - MathUtil::rotateEulerAngles(&rotatedLeafTransform, 0, 0, 45);
|
| + rotatedLeafTransform.RotateAboutZAxis(45);
|
| rotatedLeafTransform.Translate(-50, -50);
|
| position = gfx::PointF(0, 0);
|
| bounds = gfx::Size(100, 100);
|
|
|