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

Unified Diff: cc/layer_tree_host_common_unittest.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector Created 8 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
« no previous file with comments | « cc/layer_tree_host_common.cc ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ce0861709ac9b84017bb963d56d2b874d6c46ca1..d25bb58a67cf0b60d3b9d18c63894dbc9af3c280 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -29,7 +29,7 @@ using WebKit::WebTransformationMatrix;
namespace {
template<typename LayerType>
-void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
layer->setTransform(transform);
layer->setSublayerTransform(sublayerTransform);
@@ -39,13 +39,13 @@ void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformat
layer->setPreserves3D(preserves3D);
}
-void setLayerPropertiesForTesting(Layer* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+void setLayerPropertiesForTesting(Layer* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
setLayerPropertiesForTestingInternal<Layer>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
layer->setAutomaticallyComputeRasterScale(true);
}
-void setLayerPropertiesForTesting(LayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+void setLayerPropertiesForTesting(LayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
setLayerPropertiesForTestingInternal<LayerImpl>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
layer->setContentBounds(bounds);
@@ -56,10 +56,10 @@ void executeCalculateDrawTransformsAndVisibility(Layer* rootLayer, float deviceS
WebTransformationMatrix identityMatrix;
std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
- IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
+ gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
// We are probably not testing what is intended if the rootLayer bounds are empty.
- DCHECK(!rootLayer->bounds().isEmpty());
+ DCHECK(!rootLayer->bounds().IsEmpty());
LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
}
@@ -70,10 +70,10 @@ void executeCalculateDrawTransformsAndVisibility(LayerImpl* rootLayer, float dev
WebTransformationMatrix identityMatrix;
std::vector<LayerImpl*> dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
- IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
+ gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
// We are probably not testing what is intended if the rootLayer bounds are empty.
- DCHECK(!rootLayer->bounds().isEmpty());
+ DCHECK(!rootLayer->bounds().IsEmpty());
LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
}
@@ -98,9 +98,9 @@ scoped_ptr<LayerImpl> createTreeForFixedPositionTests()
scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4);
WebTransformationMatrix IdentityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
setLayerPropertiesForTesting(child.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
setLayerPropertiesForTesting(grandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
@@ -162,9 +162,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
child->addChild(grandChild);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
executeCalculateDrawTransformsAndVisibility(parent.get());
@@ -180,13 +180,13 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
scoped_refptr<Layer> layer = Layer::create();
scoped_refptr<Layer> root = Layer::create();
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
root->addChild(layer);
// Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform.
WebTransformationMatrix arbitraryTranslation;
arbitraryTranslation.translate(10, 20);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
executeCalculateDrawTransformsAndVisibility(root.get());
WebTransformationMatrix expectedDrawTransform = identityMatrix;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, layer->drawTransform());
@@ -195,13 +195,13 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// Case 2: Setting the bounds of the layer should not affect either the draw transform or the screenspace transform.
WebTransformationMatrix translationToCenter;
translationToCenter.translate(5, 6);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform());
// Case 3: The anchor point by itself (without a layer transform) should have no effect on the transforms.
- setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform());
@@ -209,7 +209,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// Case 4: A change in actual position affects both the draw transform and screen space transform.
WebTransformationMatrix positionTransform;
positionTransform.translate(0, 1.2);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransform());
@@ -218,7 +218,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// using a scale transform, because scale and translation are not commutative.
WebTransformationMatrix layerTransform;
layerTransform.scale3d(2, 2, 1);
- setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform());
@@ -227,7 +227,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
WebTransformationMatrix translationToAnchor;
translationToAnchor.translate(5, 0);
WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse();
- setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0.5, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform());
@@ -236,7 +236,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// The current implementation of calculateDrawTransforms does this implicitly, but it is
// still worth testing to detect accidental regressions.
expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse();
- setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2f), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0.5, 0), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform());
@@ -254,12 +254,12 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
child->addChild(grandChild);
// One-time setup of root layer
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Case 1: parent's anchorPoint should not affect child or grandChild.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, 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);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform());
@@ -269,9 +269,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
// Case 2: parent's position affects child and grandChild.
WebTransformationMatrix parentPositionTransform;
parentPositionTransform.translate(0, 1.2);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), 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);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->screenSpaceTransform());
@@ -284,9 +284,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
WebTransformationMatrix parentTranslationToAnchor;
parentTranslationToAnchor.translate(2.5, 3);
WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse();
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, 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);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform());
@@ -305,9 +305,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
* parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
WebTransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform);
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ 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);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform());
@@ -316,9 +316,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
// Case 5: same as Case 4, except that child does preserve 3D, so the grandChild should receive the non-flattened composite transform.
//
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), true);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ 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), true);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform());
@@ -338,7 +338,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
// One-time setup of root layer
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Child is set up so that a new render surface should be created.
child->setOpacity(0.5);
@@ -353,7 +353,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
parentTranslationToCenter.translate(50, 60);
WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
* parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
- FloatPoint parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
+ gfx::Vector2dF parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
WebTransformationMatrix surfaceSublayerTransform;
surfaceSublayerTransform.scaleNonUniform(parentCompositeScale.x(), parentCompositeScale.y());
WebTransformationMatrix surfaceSublayerCompositeTransform = parentCompositeTransform * surfaceSublayerTransform.inverse();
@@ -361,9 +361,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
// Child's render surface should not exist yet.
ASSERT_FALSE(child->renderSurface());
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(100, 120), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(8, 10), false);
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(100, 120), 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(8, 10), false);
executeCalculateDrawTransformsAndVisibility(root.get());
// Render surface should have been created now.
@@ -397,7 +397,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForReplica)
// One-time setup of root layer
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Child is set up so that a new render surface should be created.
child->setOpacity(0.5);
@@ -416,7 +416,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForReplica)
childTranslationToCenter.translate(8, 9);
WebTransformationMatrix replicaLayerTransform;
replicaLayerTransform.scale3d(3, 3, 1);
- FloatPoint parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
+ gfx::Vector2dF parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
WebTransformationMatrix surfaceSublayerTransform;
surfaceSublayerTransform.scaleNonUniform(parentCompositeScale.x(), parentCompositeScale.y());
WebTransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform * surfaceSublayerTransform.inverse();
@@ -424,10 +424,10 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForReplica)
// Child's render surface should not exist yet.
ASSERT_FALSE(child->renderSurface());
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-0.5, -0.5), IntSize(1, 1), false);
- setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false);
+ 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.5, -0.5), gfx::Size(1, 1), false);
+ setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
executeCalculateDrawTransformsAndVisibility(root.get());
// Render surface should have been created now.
@@ -477,7 +477,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// One-time setup of root layer
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// All layers in the tree are initialized with an anchor at .25 and a size of (10,10).
// matrix "A" is the composite layer transform used in all layers, centered about the anchor point
@@ -501,7 +501,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse();
WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse();
- FloatPoint surface1ParentTransformScale = MathUtil::computeTransform2dScaleComponents(A * B);
+ gfx::Vector2dF surface1ParentTransformScale = MathUtil::computeTransform2dScaleComponents(A * B);
WebTransformationMatrix surface1SublayerTransform;
surface1SublayerTransform.scaleNonUniform(surface1ParentTransformScale.x(), surface1ParentTransformScale.y());
@@ -510,7 +510,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// S1 = transform to move from renderSurface1 pixels to the layer space of the owning layer
WebTransformationMatrix S1 = surface1SublayerTransform.inverse();
- FloatPoint surface2ParentTransformScale = MathUtil::computeTransform2dScaleComponents(SS1 * A * B);
+ gfx::Vector2dF surface2ParentTransformScale = MathUtil::computeTransform2dScaleComponents(SS1 * A * B);
WebTransformationMatrix surface2SublayerTransform;
surface2SublayerTransform.scaleNonUniform(surface2ParentTransformScale.x(), surface2ParentTransformScale.y());
@@ -519,17 +519,17 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// S2 = transform to move from renderSurface2 pixels to the layer space of the owning layer
WebTransformationMatrix S2 = surface2SublayerTransform.inverse();
- setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(), false);
- setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(), false);
+ setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false);
+ setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false);
executeCalculateDrawTransformsAndVisibility(root.get());
@@ -635,9 +635,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
rotationAboutYAxis.rotate3d(0, 30, 0);
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), rotationAboutYAxis, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild.get(), rotationAboutYAxis, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), rotationAboutYAxis, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild.get(), rotationAboutYAxis, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
root->addChild(child);
child->addChild(grandChild);
@@ -679,9 +679,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer)
// The child height is zero, but has non-zero width that should be accounted for while computing drawTransforms.
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 0), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 0), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
root->addChild(child);
child->addChild(grandChild);
@@ -702,9 +702,9 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipped
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(30, 30), gfx::Size(10, 10), false);
parent->addChild(renderSurface1);
parent->setMasksToBounds(true);
@@ -730,8 +730,8 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
parent->addChild(renderSurface1);
renderSurface1->addChild(child);
@@ -748,7 +748,7 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
EXPECT_EQ(0U, parent->renderSurface()->layerList().size());
EXPECT_EQ(1U, renderSurfaceLayerList.size());
EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id());
- EXPECT_EQ(IntRect(), parent->drawableContentRect());
+ EXPECT_EQ(gfx::Rect(), parent->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyForceRenderSurface)
@@ -759,9 +759,9 @@ TEST(LayerTreeHostCommonTest, verifyForceRenderSurface)
renderSurface1->setForceRenderSurface(true);
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
parent->addChild(renderSurface1);
renderSurface1->addChild(child);
@@ -883,7 +883,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
LayerImpl* greatGrandChild = grandChild->children()[0];
child->setIsContainerForFixedPositionLayers(true);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
greatGrandChild->setFixedToContainerLayer(true);
// Case 1: scrollDelta of 0, 0
@@ -931,7 +931,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
child->setIsContainerForFixedPositionLayers(true);
child->setTransform(rotationAboutZ);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setTransform(rotationAboutZ);
greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is positioned upside-down with respect to the renderTarget.
@@ -993,7 +993,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
child->setIsContainerForFixedPositionLayers(true);
child->setTransform(rotationAboutZ);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setTransform(rotationAboutZ);
greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is positioned upside-down with respect to the renderTarget.
@@ -1051,7 +1051,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
LayerImpl* greatGrandChild = grandChild->children()[0];
child->setIsContainerForFixedPositionLayers(true);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setForceRenderSurface(true);
greatGrandChild->setFixedToContainerLayer(true);
greatGrandChild->setDrawsContent(true);
@@ -1127,16 +1127,16 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
{
WebTransformationMatrix identity;
scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5);
- setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
greatGrandChild->addChild(fixedPositionChild.Pass());
}
LayerImpl* fixedPositionChild = greatGrandChild->children()[0];
// Actually set up the scenario here.
child->setIsContainerForFixedPositionLayers(true);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setForceRenderSurface(true);
- greatGrandChild->setPosition(FloatPoint(40, 60));
+ greatGrandChild->setPosition(gfx::PointF(40, 60));
greatGrandChild->setForceRenderSurface(true);
fixedPositionChild->setFixedToContainerLayer(true);
fixedPositionChild->setDrawsContent(true);
@@ -1381,12 +1381,12 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
child->addChild(leafNode1);
greatGrandChild->addChild(leafNode2);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
- setLayerPropertiesForTesting(greatGrandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(45, 45), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(greatGrandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
child->setMasksToBounds(true);
child->setOpacity(0.4f);
@@ -1429,10 +1429,10 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
child->addChild(grandChild);
grandChild->addChild(leafNode);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(200, 200), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(200, 200), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
parent->setMasksToBounds(true);
child->setOpacity(0.4f);
@@ -1487,12 +1487,12 @@ TEST(LayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
child->addChild(grandChild3);
child->addChild(grandChild4);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(45, 45), gfx::Size(10, 10), false);
child->setMasksToBounds(true);
grandChild3->setMasksToBounds(true);
@@ -1508,10 +1508,10 @@ TEST(LayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
int dummyMaxTextureSize = 512;
LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
- EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect());
- EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(5, 5), gfx::Size(10, 10)), grandChild1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->drawableContentRect());
+ EXPECT_TRUE(grandChild4->drawableContentRect().IsEmpty());
}
TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
@@ -1547,16 +1547,16 @@ TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
grandChild3->addChild(leafNode3);
grandChild4->addChild(leafNode4);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(45, 45), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode4.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
child->setMasksToBounds(true);
grandChild3->setMasksToBounds(true);
@@ -1579,9 +1579,9 @@ TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entirely clipped, it is expected to not have a renderSurface.
// Surfaces are clipped by their parent, but un-affected by the owning layer's masksToBounds.
- EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild1->renderSurface()->clipRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild2->renderSurface()->clipRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild3->renderSurface()->clipRect());
}
TEST(LayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
@@ -1626,15 +1626,15 @@ TEST(LayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
addAnimatedTransformToController(*grandChildOfRoot->layerAnimationController(), 10, 30, 0);
addAnimatedTransformToController(*grandChildOfRS2->layerAnimationController(), 10, 30, 0);
- setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
executeCalculateDrawTransformsAndVisibility(parent.get());
@@ -1729,23 +1729,23 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform)
{
// Test the calculateVisibleRect() function works correctly for identity transforms.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
- IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30));
- IntRect expected = IntRect(IntPoint(10, 10), IntSize(30, 30));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(10, 10), gfx::Size(30, 30));
+ gfx::Rect expected = gfx::Rect(gfx::Point(10, 10), gfx::Size(30, 30));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
- layerContentRect = IntRect(IntPoint(120, 120), IntSize(30, 30));
+ layerContentRect = gfx::Rect(gfx::Point(120, 120), gfx::Size(30, 30));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
- EXPECT_TRUE(actual.isEmpty());
+ EXPECT_TRUE(actual.IsEmpty());
// Case 3: Layer is partially overlapping the surface rect.
- layerContentRect = IntRect(IntPoint(80, 80), IntSize(30, 30));
- expected = IntRect(IntPoint(80, 80), IntSize(20, 20));
+ layerContentRect = gfx::Rect(gfx::Point(80, 80), gfx::Size(30, 30));
+ expected = gfx::Rect(gfx::Point(80, 80), gfx::Size(20, 20));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1754,27 +1754,27 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForTranslations)
{
// Test the calculateVisibleRect() function works correctly for scaling transforms.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(10, 10);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(120, 120);
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
- EXPECT_TRUE(actual.isEmpty());
+ EXPECT_TRUE(actual.IsEmpty());
// Case 3: Layer is partially overlapping the surface rect.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(80, 80);
- expected = IntRect(IntPoint(0, 0), IntSize(20, 20));
+ expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1784,16 +1784,16 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
// Test the calculateVisibleRect() function works correctly for rotations about z-axis (i.e. 2D rotations).
// Remember that calculateVisibleRect() should return the visible rect in the layer's space.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(50, 50);
layerToSurfaceTransform.rotate(45);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
@@ -1801,7 +1801,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
layerToSurfaceTransform.translate(-50, 0);
layerToSurfaceTransform.rotate(45);
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
- EXPECT_TRUE(actual.isEmpty());
+ EXPECT_TRUE(actual.IsEmpty());
// Case 3: The layer is rotated about its top-left corner. In surface space, the layer
// is oriented diagonally, with the left half outside of the renderSurface. In
@@ -1810,7 +1810,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
// bottom-right corners of the layer are still visible.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.rotate(45);
- expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1822,7 +1822,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(0, -sqrt(2.0) * 15);
layerToSurfaceTransform.rotate(45);
- expected = IntRect(IntPoint(15, 0), IntSize(15, 30)); // right half of layer bounds.
+ expected = gfx::Rect(gfx::Point(15, 0), gfx::Size(15, 30)); // right half of layer bounds.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1831,15 +1831,15 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
{
// Test that the calculateVisibleRect() function works correctly for 3d transforms.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.rotate3d(0, 45, 0);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ 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);
// Case 2: Orthographic projection of a layer rotated about y-axis by 45 degrees, but
@@ -1849,7 +1849,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(-halfWidthOfRotatedLayer, 0);
layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer
- expected = IntRect(IntPoint(50, 0), IntSize(50, 100)); // right half 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);
}
@@ -1859,8 +1859,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
// Test the calculateVisibleRect() function works correctly when the layer has a
// perspective projection onto the target surface.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(-50, -50), IntSize(200, 200));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(200, 200));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Even though the layer is twice as large as the surface, due to perspective
@@ -1876,8 +1876,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
// This translate places the layer in front of the surface's projection plane.
layerToSurfaceTransform.translate3d(0, 0, -27);
- IntRect expected = IntRect(IntPoint(-50, -50), IntSize(200, 200));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(-50, -50), gfx::Size(200, 200));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: same projection as before, except that the layer is also translated to the
@@ -1889,7 +1889,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
// visible), then we would need to translate by (-36 / 9) * -50 == -200 in the layer's units.
//
layerToSurfaceTransform.translate3d(-200, 0, 0);
- expected = IntRect(IntPoint(50, -50), IntSize(100, 200)); // The right half of the layer's bounding rect.
+ expected = gfx::Rect(gfx::Point(50, -50), gfx::Size(100, 200)); // The right half of the layer's bounding rect.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1901,8 +1901,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehi
// behind the surface in an orthographic world should not be clipped when they are
// flattened to the surface.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
WebTransformationMatrix layerToSurfaceTransform;
// This sequence of transforms effectively rotates the layer about the y-axis at the
@@ -1912,8 +1912,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehi
layerToSurfaceTransform.rotate3d(0, 45, 0);
layerToSurfaceTransform.translate(-50, 0);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ 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);
}
@@ -1925,8 +1925,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW)
// but actually they are not. The visibleRect needs to be properly clipped by the
// w = 0 plane in homogeneous coordinates before converting to cartesian coordinates.
- IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(-10, -1), IntSize(20, 2));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-10, -1), gfx::Size(20, 2));
WebTransformationMatrix layerToSurfaceTransform;
// The layer is positioned so that the right half of the layer should be in front of
@@ -1941,12 +1941,12 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW)
// Sanity check that this transform does indeed cause w < 0 when applying the
// transform, otherwise this code is not testing the intended scenario.
bool clipped = false;
- MathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(FloatRect(layerContentRect)), clipped);
+ MathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(gfx::RectF(layerContentRect)), clipped);
ASSERT_TRUE(clipped);
int expectedXPosition = 0;
int expectedWidth = 10;
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_EQ(expectedXPosition, actual.x());
EXPECT_EQ(expectedWidth, actual.width());
}
@@ -1959,8 +1959,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
// Un-projecting this new rect may require clipping again.
// This sequence of transforms causes one corner of the layer to protrude across the w = 0 plane, and should be clipped.
- IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(-10, -10), IntSize(20, 20));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-10, -10), gfx::Size(20, 20));
WebTransformationMatrix layerToSurfaceTransform;
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.applyPerspective(1);
@@ -1971,15 +1971,15 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
// Sanity check that un-projection does indeed cause w < 0, otherwise this code is not
// testing the intended scenario.
bool clipped = false;
- FloatRect clippedRect = MathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect);
+ gfx::RectF clippedRect = MathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect);
MathUtil::projectQuad(layerToSurfaceTransform.inverse(), FloatQuad(clippedRect), clipped);
ASSERT_TRUE(clipped);
// Only the corner of the layer is not visible on the surface because of being
// clipped. But, the net result of rounding visible region to an axis-aligned rect is
// that the entire layer should still be considered visible.
- IntRect expected = IntRect(IntPoint(-10, -10), IntSize(20, 20));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(-10, -10), gfx::Size(20, 20));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1994,28 +1994,28 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayer
root->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
executeCalculateDrawTransformsAndVisibility(root.get());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
// layer visibleContentRects are clipped by their targetSurface
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect());
- EXPECT_TRUE(child3->visibleContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visibleContentRect());
+ EXPECT_TRUE(child3->visibleContentRect().IsEmpty());
// layer drawableContentRects are not clipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClippedByLayer)
@@ -2031,33 +2031,33 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClipp
child->addChild(grandChild3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
child->setMasksToBounds(true);
executeCalculateDrawTransformsAndVisibility(root.get());
ASSERT_FALSE(child->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), child->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), child->visibleContentRect());
// All grandchild visibleContentRects should be clipped by child.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), grandChild1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), grandChild2->visibleContentRect());
- EXPECT_TRUE(grandChild3->visibleContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), grandChild1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), grandChild2->visibleContentRect());
+ EXPECT_TRUE(grandChild3->visibleContentRect().IsEmpty());
// All grandchild drawableContentRects should also be clipped by child.
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), grandChild1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 25, 25), grandChild2->drawableContentRect());
- EXPECT_TRUE(grandChild3->drawableContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), grandChild1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 25, 25), grandChild2->drawableContentRect());
+ EXPECT_TRUE(grandChild3->drawableContentRect().IsEmpty());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface)
@@ -2073,35 +2073,35 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnc
renderSurface1->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
renderSurface1->setForceRenderSurface(true);
executeCalculateDrawTransformsAndVisibility(root.get());
ASSERT_TRUE(renderSurface1->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
// An unclipped surface grows its drawableContentRect to include all drawable regions of the subtree.
- EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 170, 170), renderSurface1->renderSurface()->drawableContentRect());
// All layers that draw content into the unclipped surface are also unclipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInClippedRenderSurface)
@@ -2117,11 +2117,11 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInCli
renderSurface1->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
root->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -2129,26 +2129,26 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInCli
ASSERT_TRUE(renderSurface1->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
// A clipped surface grows its drawableContentRect to include all drawable regions of the subtree,
// but also gets clamped by the ancestor's clip.
- EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
// All layers that draw content into the surface have their visibleContentRect clipped by the surface clipRect.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect());
- EXPECT_TRUE(child3->visibleContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visibleContentRect());
+ EXPECT_TRUE(child3->visibleContentRect().IsEmpty());
// But the drawableContentRects are unclipped.
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHierarchy)
@@ -2167,12 +2167,12 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHier
renderSurface2->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(7, 13), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(7, 13), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
root->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -2182,32 +2182,32 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHier
ASSERT_TRUE(renderSurface1->renderSurface());
ASSERT_TRUE(renderSurface2->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface2->visibleContentRect());
// A clipped surface grows its drawableContentRect to include all drawable regions of the subtree,
// but also gets clamped by the ancestor's clip.
- EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
// renderSurface1 lives in the "unclipped universe" of renderSurface1, and is only
// implicitly clipped by renderSurface1's contentRect. So, renderSurface2 grows to
// enclose all drawable content of its subtree.
- EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface2->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 170, 170), renderSurface2->renderSurface()->drawableContentRect());
// All layers that draw content into renderSurface2 think they are unclipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visibleContentRect());
// drawableContentRects are also unclipped.
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnUnclippedSurface)
@@ -2224,29 +2224,29 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childRotation;
childRotation.rotate(45);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, FloatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gfx::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false);
renderSurface1->setForceRenderSurface(true);
executeCalculateDrawTransformsAndVisibility(root.get());
ASSERT_TRUE(renderSurface1->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
// The unclipped surface grows its drawableContentRect to include all drawable regions of the subtree.
int diagonalRadius = ceil(sqrt(2.0) * 25);
- IntRect expectedSurfaceDrawableContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
+ gfx::Rect expectedSurfaceDrawableContent = gfx::Rect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect());
// All layers that draw content into the unclipped surface are also unclipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
EXPECT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect());
}
@@ -2264,9 +2264,9 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childRotation;
childRotation.rotate(45);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, FloatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gfx::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false);
root->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -2276,14 +2276,14 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
// The clipped surface clamps the drawableContentRect that encloses the rotated layer.
int diagonalRadius = ceil(sqrt(2.0) * 25);
- IntRect unclippedSurfaceContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
- IntRect expectedSurfaceDrawableContent = intersection(unclippedSurfaceContent, IntRect(0, 0, 50, 50));
+ gfx::Rect unclippedSurfaceContent = gfx::Rect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
+ gfx::Rect expectedSurfaceDrawableContent = gfx::IntersectRects(unclippedSurfaceContent, gfx::Rect(0, 0, 50, 50));
EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect());
// On the clipped surface, only a quarter of the child1 is visible, but when rotating
// it back to child1's content space, the actual enclosing rect ends up covering the
// full left half of child1.
- EXPECT_RECT_EQ(IntRect(0, 0, 26, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 26, 50), child1->visibleContentRect());
// The child's drawableContentRect is unclipped.
EXPECT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect());
@@ -2306,12 +2306,12 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI)
renderSurface2->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(3, 4), false);
- setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(7, 13), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(7, 13), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
const double deviceScaleFactor = 2;
root->setContentsScale(deviceScaleFactor);
@@ -2330,28 +2330,28 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI)
ASSERT_TRUE(renderSurface2->renderSurface());
// DrawableContentRects for all layers and surfaces are scaled by deviceScaleFactor.
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), root->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(10, 10, 190, 190), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(10, 10, 190, 190), renderSurface1->renderSurface()->drawableContentRect());
// renderSurface2 lives in the "unclipped universe" of renderSurface1, and
// is only implicitly clipped by renderSurface1.
- EXPECT_RECT_EQ(IntRect(10, 10, 350, 350), renderSurface2->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(10, 10, 350, 350), renderSurface2->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(10, 10, 100, 100), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(150, 150, 100, 100), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(250, 250, 100, 100), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(10, 10, 100, 100), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(150, 150, 100, 100), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(250, 250, 100, 100), child3->drawableContentRect());
// The root layer does not actually draw content of its own.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
// All layer visibleContentRects are expressed in content space of each
// layer, so they are also scaled by the deviceScaleFactor.
- EXPECT_RECT_EQ(IntRect(0, 0, 6, 8), renderSurface1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 14, 26), renderSurface2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), child2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), child3->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 8), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 14, 26), renderSurface2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child3->visibleContentRect());
}
TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
@@ -2401,15 +2401,15 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
// Nothing preserves 3d. According to current W3C CSS Transforms spec, these layers
// should blindly use their own local transforms to determine back-face culling.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2500,15 +2500,15 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
// should use the transform with respect to that context. This 3d rendering context
// occurs when (a) parent's transform style is flat and (b) the layer's transform
// style is preserve-3d.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // parent transform style is flat.
- setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surface transform style is preserve-3d.
- setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surface transform style is preserve-3d.
- setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); // parent transform style is flat.
+ setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // surface transform style is preserve-3d.
+ setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // surface transform style is preserve-3d.
+ setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2583,12 +2583,12 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
// This is just an animating layer, not a surface.
addAnimatedTransformToController(*animatingChild->layerAnimationController(), 10, 30, 0);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2615,13 +2615,13 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id());
EXPECT_EQ(childOfAnimatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id());
- EXPECT_FALSE(child2->visibleContentRect().isEmpty());
+ EXPECT_FALSE(child2->visibleContentRect().IsEmpty());
// The animating layers should have a visibleContentRect that represents the area of the front face that is within the viewport.
- EXPECT_EQ(animatingChild->visibleContentRect(), IntRect(IntPoint(), animatingChild->contentBounds()));
- EXPECT_EQ(animatingSurface->visibleContentRect(), IntRect(IntPoint(), animatingSurface->contentBounds()));
+ EXPECT_EQ(animatingChild->visibleContentRect(), gfx::Rect(gfx::Point(), animatingChild->contentBounds()));
+ EXPECT_EQ(animatingSurface->visibleContentRect(), gfx::Rect(gfx::Point(), animatingSurface->contentBounds()));
// And layers in the subtree of the animating layer should have valid visibleContentRects also.
- EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds()));
+ EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), gfx::Rect(gfx::Point(), childOfAnimatingSurface->contentBounds()));
}
TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningSurface)
@@ -2650,11 +2650,11 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningS
backfaceMatrix.rotate3d(0, 1, 0, 180);
backfaceMatrix.translate(-50, -50);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // parent transform style is preserve3d.
- setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // surface transform style is flat.
- setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // surface transform style is flat.
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // parent transform style is preserve3d.
+ setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); // surface transform style is flat.
+ setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); // surface transform style is flat.
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2688,11 +2688,11 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList)
std::vector<LayerImpl*> renderSurfaceLayerList;
- IntPoint testPoint(0, 0);
+ gfx::Point testPoint(0, 0);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(10, 20);
+ testPoint = gfx::Point(10, 20);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
}
@@ -2704,9 +2704,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2719,21 +2719,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
// Hit testing for a point outside the layer should return a null pointer.
- IntPoint testPoint(101, 101);
+ gfx::Point testPoint(101, 101);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(-1, -1);
+ testPoint = gfx::Point(-1, -1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(1, 1);
+ testPoint = gfx::Point(1, 1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(99, 99);
+ testPoint = gfx::Point(99, 99);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -2753,9 +2753,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
ASSERT_FALSE(uninvertibleTransform.isInvertible());
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2771,31 +2771,31 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
// Hit testing any point should not hit the layer. If the invertible matrix is
// accidentally ignored and treated like an identity, then the hit testing will
// incorrectly hit the layer when it shouldn't.
- IntPoint testPoint(1, 1);
+ gfx::Point testPoint(1, 1);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(10, 10);
+ testPoint = gfx::Point(10, 10);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(10, 30);
+ testPoint = gfx::Point(10, 30);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(50, 50);
+ testPoint = gfx::Point(50, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(67, 48);
+ testPoint = gfx::Point(67, 48);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(99, 99);
+ testPoint = gfx::Point(99, 99);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(-1, -1);
+ testPoint = gfx::Point(-1, -1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
}
@@ -2807,9 +2807,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(50, 50); // this layer is positioned, and hit testing should correctly know where the layer is located.
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(50, 50); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2822,22 +2822,22 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
// Hit testing for a point outside the layer should return a null pointer.
- IntPoint testPoint(49, 49);
+ gfx::Point testPoint(49, 49);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it.
- testPoint = IntPoint(101, 101);
+ testPoint = gfx::Point(101, 101);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(99, 99);
+ testPoint = gfx::Point(99, 99);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -2854,9 +2854,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
rotation45DegreesAboutCenter.translate(50, 50);
rotation45DegreesAboutCenter.rotate3d(0, 0, 45);
rotation45DegreesAboutCenter.translate(-50, -50);
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2870,26 +2870,26 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
// Hit testing for points outside the layer.
// These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer.
- IntPoint testPoint(99, 99);
+ gfx::Point testPoint(99, 99);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(1, 1);
+ testPoint = gfx::Point(1, 1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(1, 50);
+ testPoint = gfx::Point(1, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
// Hit testing the corners that would overlap the unclipped layer, but are outside the clipped region.
- testPoint = IntPoint(50, -1);
+ testPoint = gfx::Point(50, -1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_FALSE(resultLayer);
- testPoint = IntPoint(-1, 50);
+ testPoint = gfx::Point(-1, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_FALSE(resultLayer);
}
@@ -2910,9 +2910,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
WebTransformationMatrix translationByZ;
translationByZ.translate3d(0, 0, -1);
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter * translationByZ, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2926,21 +2926,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
// Hit testing for points outside the layer.
// These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer.
- IntPoint testPoint(24, 24);
+ gfx::Point testPoint(24, 24);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(76, 76);
+ testPoint = gfx::Point(76, 76);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(26, 26);
+ testPoint = gfx::Point(26, 26);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(74, 74);
+ testPoint = gfx::Point(74, 74);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -2963,18 +2963,18 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
+ gfx::PointF anchor(0, 0);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
- FloatPoint position(25, 25);
- IntSize bounds(50, 50);
+ gfx::PointF position(25, 25);
+ gfx::Size bounds(50, 50);
scoped_ptr<LayerImpl> testLayer = LayerImpl::create(12345);
setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
// override contentBounds and contentsScale
- testLayer->setContentBounds(IntSize(100, 100));
+ testLayer->setContentBounds(gfx::Size(100, 100));
testLayer->setContentsScale(2, 2);
testLayer->setDrawsContent(true);
@@ -2988,30 +2988,30 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
// Sanity check the scenario we just created.
// The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25.
LayerImpl* testLayer = root->children()[0];
- EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visibleContentRect());
ASSERT_EQ(1u, renderSurfaceLayerList.size());
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
// Hit testing for a point outside the layer should return a null pointer (the root layer does not draw content, so it will not be hit tested either).
- IntPoint testPoint(101, 101);
+ gfx::Point testPoint(101, 101);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(24, 24);
+ testPoint = gfx::Point(24, 24);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(76, 76);
+ testPoint = gfx::Point(76, 76);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the test layer.
- testPoint = IntPoint(26, 26);
+ testPoint = gfx::Point(26, 26);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(74, 74);
+ testPoint = gfx::Point(74, 74);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -3024,21 +3024,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
DebugScopedSetImplThread thisScopeIsOnImplThread;
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
+ gfx::PointF anchor(0, 0);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123);
- FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
- IntSize bounds(50, 50);
+ gfx::PointF position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ gfx::Size bounds(50, 50);
setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
clippingLayer->setMasksToBounds(true);
scoped_ptr<LayerImpl> child = LayerImpl::create(456);
- position = FloatPoint(-50, -50);
- bounds = IntSize(300, 300);
+ position = gfx::PointF(-50, -50);
+ bounds = gfx::Size(300, 300);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setDrawsContent(true);
clippingLayer->addChild(child.Pass());
@@ -3056,22 +3056,22 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
// Hit testing for a point outside the layer should return a null pointer.
// Despite the child layer being very large, it should be clipped to the root layer's bounds.
- IntPoint testPoint(24, 24);
+ gfx::Point testPoint(24, 24);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Even though the layer exists at (101, 101), it should not be visible there since the clippingLayer would clamp it.
- testPoint = IntPoint(76, 76);
+ testPoint = gfx::Point(76, 76);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the child layer.
- testPoint = IntPoint(26, 26);
+ testPoint = gfx::Point(26, 26);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
- testPoint = IntPoint(74, 74);
+ testPoint = gfx::Point(74, 74);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
@@ -3094,9 +3094,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
scoped_ptr<LayerImpl> root = LayerImpl::create(123);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setMasksToBounds(true);
@@ -3105,16 +3105,16 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
scoped_ptr<LayerImpl> grandChild = LayerImpl::create(789);
scoped_ptr<LayerImpl> rotatedLeaf = LayerImpl::create(2468);
- position = FloatPoint(10, 10);
- bounds = IntSize(80, 80);
+ position = gfx::PointF(10, 10);
+ bounds = gfx::Size(80, 80);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setMasksToBounds(true);
WebTransformationMatrix rotation45DegreesAboutCorner;
rotation45DegreesAboutCorner.rotate3d(0, 0, 45);
- position = FloatPoint(0, 0); // remember, positioned with respect to its parent which is already at 10, 10
- bounds = IntSize(200, 200); // to ensure it covers at least sqrt(2) * 100.
+ 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.
setLayerPropertiesForTesting(grandChild.get(), rotation45DegreesAboutCorner, identityMatrix, anchor, position, bounds, false);
grandChild->setMasksToBounds(true);
@@ -3125,8 +3125,8 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
rotatedLeafTransform.translate(50, 50);
rotatedLeafTransform.rotate3d(0, 0, 45);
rotatedLeafTransform.translate(-50, -50);
- position = FloatPoint(0, 0);
- bounds = IntSize(100, 100);
+ position = gfx::PointF(0, 0);
+ bounds = gfx::Size(100, 100);
setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, identityMatrix, anchor, position, bounds, false);
rotatedLeaf->setDrawsContent(true);
@@ -3148,12 +3148,12 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id());
// (11, 89) is close to the the bottom left corner within the clip, but it is not inside the layer.
- IntPoint testPoint(11, 89);
+ gfx::Point testPoint(11, 89);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Closer inwards from the bottom left will overlap the layer.
- testPoint = IntPoint(25, 75);
+ testPoint = gfx::Point(25, 75);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2468, resultLayer->id());
@@ -3162,24 +3162,24 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
// clipped away by the grandParent and should not get hit. If hit testing blindly uses
// visibleContentRect without considering how parent may clip the layer, then hit
// testing would accidentally think that the point successfully hits the layer.
- testPoint = IntPoint(4, 50);
+ testPoint = gfx::Point(4, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// (11, 50) is inside the layer and within the clipped area.
- testPoint = IntPoint(11, 50);
+ testPoint = gfx::Point(11, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2468, resultLayer->id());
// Around the middle, just to the right and up, would have hit the layer except that
// that area should be clipped away by the parent.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Around the middle, just to the left and down, should successfully hit the layer.
- testPoint = IntPoint(49, 51);
+ testPoint = gfx::Point(49, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2468, resultLayer->id());
@@ -3192,15 +3192,15 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
DebugScopedSetImplThread thisScopeIsOnImplThread;
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
+ gfx::PointF anchor(0, 0);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123);
- FloatPoint position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located.
- IntSize bounds(50, 50);
+ gfx::PointF position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ gfx::Size bounds(50, 50);
setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
// Sanity check the intermediate layer should not clip.
ASSERT_FALSE(intermediateLayer->masksToBounds());
@@ -3209,8 +3209,8 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
// The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all.
// If child is incorrectly clipped, we would not be able to hit it successfully.
scoped_ptr<LayerImpl> child = LayerImpl::create(456);
- position = FloatPoint(60, 60); // 70, 70 in screen space
- bounds = IntSize(20, 20);
+ position = gfx::PointF(60, 60); // 70, 70 in screen space
+ bounds = gfx::Size(20, 20);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setDrawsContent(true);
intermediateLayer->addChild(child.Pass());
@@ -3227,21 +3227,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id());
// Hit testing for a point outside the layer should return a null pointer.
- IntPoint testPoint(69, 69);
+ gfx::Point testPoint(69, 69);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(91, 91);
+ testPoint = gfx::Point(91, 91);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the child layer.
- testPoint = IntPoint(71, 71);
+ testPoint = gfx::Point(71, 71);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
- testPoint = IntPoint(89, 89);
+ testPoint = gfx::Point(89, 89);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
@@ -3255,9 +3255,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -3271,20 +3271,20 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4);
- position = FloatPoint(10, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(10, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child1->setDrawsContent(true);
- position = FloatPoint(50, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(50, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child2->setDrawsContent(true);
// Remember that grandChild is positioned with respect to its parent (i.e. child1).
// In screen space, the intended position is (10, 50), with size 100 x 50.
- position = FloatPoint(0, 40);
- bounds = IntSize(100, 50);
+ position = gfx::PointF(0, 40);
+ bounds = gfx::Size(100, 50);
setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
grandChild1->setDrawsContent(true);
@@ -3313,37 +3313,37 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
ASSERT_EQ(3, root->renderSurface()->layerList()[3]->id()); // child2
// Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer.
- IntPoint testPoint = IntPoint(1, 1);
+ gfx::Point testPoint = gfx::Point(1, 1);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(1, resultLayer->id());
// At (15, 15), child1 and root are the only layers. child1 is expected to be on top.
- testPoint = IntPoint(15, 15);
+ testPoint = gfx::Point(15, 15);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2, resultLayer->id());
// At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
- testPoint = IntPoint(51, 20);
+ testPoint = gfx::Point(51, 20);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top.
- testPoint = IntPoint(80, 51);
+ testPoint = gfx::Point(80, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top.
- testPoint = IntPoint(20, 51);
+ testPoint = gfx::Point(20, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(4, resultLayer->id());
@@ -3360,9 +3360,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -3376,22 +3376,22 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4);
- position = FloatPoint(10, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(10, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child1->setDrawsContent(true);
child1->setForceRenderSurface(true);
- position = FloatPoint(50, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(50, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child2->setDrawsContent(true);
child2->setForceRenderSurface(true);
// Remember that grandChild is positioned with respect to its parent (i.e. child1).
// In screen space, the intended position is (10, 50), with size 100 x 50.
- position = FloatPoint(0, 40);
- bounds = IntSize(100, 50);
+ position = gfx::PointF(0, 40);
+ bounds = gfx::Size(100, 50);
setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
grandChild1->setDrawsContent(true);
grandChild1->setForceRenderSurface(true);
@@ -3427,37 +3427,37 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
ASSERT_EQ(3, renderSurfaceLayerList[3]->id()); // child2
// Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer.
- IntPoint testPoint = IntPoint(1, 1);
+ gfx::Point testPoint = gfx::Point(1, 1);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(1, resultLayer->id());
// At (15, 15), child1 and root are the only layers. child1 is expected to be on top.
- testPoint = IntPoint(15, 15);
+ testPoint = gfx::Point(15, 15);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2, resultLayer->id());
// At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
- testPoint = IntPoint(51, 20);
+ testPoint = gfx::Point(51, 20);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top.
- testPoint = IntPoint(80, 51);
+ testPoint = gfx::Point(80, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top.
- testPoint = IntPoint(20, 51);
+ testPoint = gfx::Point(20, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(4, resultLayer->id());
@@ -3468,7 +3468,7 @@ class NoScaleContentLayer : public ContentLayer
public:
static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client) { return make_scoped_refptr(new NoScaleContentLayer(client)); }
- virtual IntSize contentBounds() const OVERRIDE { return bounds(); }
+ virtual gfx::Size contentBounds() const OVERRIDE { return bounds(); }
virtual float contentsScaleX() const OVERRIDE { return 1.0; }
virtual float contentsScaleY() const OVERRIDE { return 1.0; }
@@ -3491,13 +3491,13 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
parent->addChild(child);
parent->addChild(childNoScale);
@@ -3522,13 +3522,13 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform());
// Verify results of transformed parent rects
- FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds()));
+ gfx::RectF parentContentBounds(gfx::PointF(), gfx::SizeF(parent->contentBounds()));
- FloatRect parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
- FloatRect parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
+ gfx::RectF parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
+ gfx::RectF parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
- FloatRect expectedParentDrawRect(FloatPoint(), parent->bounds());
- expectedParentDrawRect.scale(deviceScaleFactor);
+ gfx::RectF expectedParentDrawRect(gfx::PointF(), parent->bounds());
+ expectedParentDrawRect.Scale(deviceScaleFactor);
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect);
@@ -3539,14 +3539,14 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform());
// Verify results of transformed child rects
- FloatRect childContentBounds(FloatPoint(), FloatSize(child->contentBounds()));
+ gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds()));
- FloatRect childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
- FloatRect childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
+ gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
+ gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
- FloatRect expectedChildDrawRect(FloatPoint(), child->bounds());
- expectedChildDrawRect.move(child->position().x(), child->position().y());
- expectedChildDrawRect.scale(deviceScaleFactor);
+ gfx::RectF expectedChildDrawRect(gfx::PointF(), child->bounds());
+ expectedChildDrawRect.Offset(child->position().x(), child->position().y());
+ expectedChildDrawRect.Scale(deviceScaleFactor);
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect);
@@ -3566,13 +3566,13 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(133, 133), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(133, 133), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 13), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 13), true);
scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 13), true);
+ setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 13), true);
parent->addChild(child);
parent->addChild(childNoScale);
@@ -3597,15 +3597,15 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform());
// Verify results of transformed parent rects
- FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds()));
+ gfx::RectF parentContentBounds(gfx::PointF(), gfx::SizeF(parent->contentBounds()));
- FloatRect parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
- FloatRect parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
+ gfx::RectF parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
+ gfx::RectF parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
- FloatRect expectedParentDrawRect(FloatPoint(), parent->bounds());
- expectedParentDrawRect.scale(deviceScaleFactor);
- expectedParentDrawRect.setWidth(ceil(expectedParentDrawRect.width()));
- expectedParentDrawRect.setHeight(ceil(expectedParentDrawRect.height()));
+ gfx::RectF expectedParentDrawRect(gfx::PointF(), parent->bounds());
+ expectedParentDrawRect.Scale(deviceScaleFactor);
+ expectedParentDrawRect.set_width(ceil(expectedParentDrawRect.width()));
+ expectedParentDrawRect.set_height(ceil(expectedParentDrawRect.height()));
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect);
@@ -3615,15 +3615,15 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform());
// Verify results of transformed child rects
- FloatRect childContentBounds(FloatPoint(), FloatSize(child->contentBounds()));
+ gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds()));
- FloatRect childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
- FloatRect childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
+ gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
+ gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
- FloatRect expectedChildDrawRect(FloatPoint(), child->bounds());
- expectedChildDrawRect.scale(deviceScaleFactor);
- expectedChildDrawRect.setWidth(ceil(expectedChildDrawRect.width()));
- expectedChildDrawRect.setHeight(ceil(expectedChildDrawRect.height()));
+ gfx::RectF expectedChildDrawRect(gfx::PointF(), child->bounds());
+ expectedChildDrawRect.Scale(deviceScaleFactor);
+ expectedChildDrawRect.set_width(ceil(expectedChildDrawRect.width()));
+ expectedChildDrawRect.set_height(ceil(expectedChildDrawRect.height()));
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect);
@@ -3652,16 +3652,16 @@ TEST(LayerTreeHostCommonTest, verifyContentsScale)
float fixedRasterScale = 2.5;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
scoped_refptr<ContentLayer> childScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(12, 12), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(12, 12), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> childNoAutoScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoAutoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(22, 22), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childNoAutoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(22, 22), gfx::Size(10, 10), true);
childNoAutoScale->setAutomaticallyComputeRasterScale(false);
childNoAutoScale->setRasterScale(fixedRasterScale);
@@ -3747,36 +3747,36 @@ TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces)
float fixedRasterScale = 4;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
scoped_refptr<ContentLayer> surfaceScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> surfaceScaleChildScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceScaleChildScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceScaleChildScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceScaleChildNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceScaleChildNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceScaleChildNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(12, 12), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(12, 12), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> surfaceNoScaleChildScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoScaleChildScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoScaleChildScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceNoScaleChildNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> surfaceNoAutoScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoAutoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(22, 22), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoAutoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(22, 22), gfx::Size(10, 10), true);
surfaceNoAutoScale->setAutomaticallyComputeRasterScale(false);
surfaceNoAutoScale->setRasterScale(fixedRasterScale);
scoped_refptr<ContentLayer> surfaceNoAutoScaleChildScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoAutoScaleChildScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoAutoScaleChildScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceNoAutoScaleChildNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoAutoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoAutoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
// FIXME: Remove this when pageScaleFactor is applied in the compositor.
// Page scale should not apply to the parent.
@@ -3882,20 +3882,20 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(30, 30), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
WebTransformationMatrix replicaTransform;
replicaTransform.scaleNonUniform(1, -1);
scoped_refptr<ContentLayer> replica = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
// This layer should end up in the same surface as child, with the same draw
// and screen space transforms.
scoped_refptr<ContentLayer> duplicateChildNonOwner = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
parent->addChild(child);
child->addChild(duplicateChildNonOwner);
@@ -3965,20 +3965,20 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScal
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(33, 31), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(33, 31), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 11), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
WebTransformationMatrix replicaTransform;
replicaTransform.scaleNonUniform(1, -1);
scoped_refptr<ContentLayer> replica = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 11), true);
+ setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
// This layer should end up in the same surface as child, with the same draw
// and screen space transforms.
scoped_refptr<ContentLayer> duplicateChildNonOwner = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 11), true);
+ setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
parent->addChild(child);
child->addChild(duplicateChildNonOwner);
« no previous file with comments | « cc/layer_tree_host_common.cc ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698