| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_tree_host_common.h" | 5 #include "cc/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include "cc/content_layer.h" | 7 #include "cc/content_layer.h" |
| 8 #include "cc/content_layer_client.h" | 8 #include "cc/content_layer_client.h" |
| 9 #include "cc/layer.h" | 9 #include "cc/layer.h" |
| 10 #include "cc/layer_animation_controller.h" | 10 #include "cc/layer_animation_controller.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 setLayerPropertiesForTestingInternal<Layer>(layer, transform, sublayerTransf
orm, anchor, position, bounds, preserves3D); | 42 setLayerPropertiesForTestingInternal<Layer>(layer, transform, sublayerTransf
orm, anchor, position, bounds, preserves3D); |
| 43 layer->setAutomaticallyComputeRasterScale(true); | 43 layer->setAutomaticallyComputeRasterScale(true); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void setLayerPropertiesForTesting(LayerImpl* layer, const gfx::Transform& transf
orm, const gfx::Transform& sublayerTransform, const gfx::PointF& anchor, const g
fx::PointF& position, const gfx::Size& bounds, bool preserves3D) | 46 void setLayerPropertiesForTesting(LayerImpl* layer, const gfx::Transform& transf
orm, const gfx::Transform& sublayerTransform, const gfx::PointF& anchor, const g
fx::PointF& position, const gfx::Size& bounds, bool preserves3D) |
| 47 { | 47 { |
| 48 setLayerPropertiesForTestingInternal<LayerImpl>(layer, transform, sublayerTr
ansform, anchor, position, bounds, preserves3D); | 48 setLayerPropertiesForTestingInternal<LayerImpl>(layer, transform, sublayerTr
ansform, anchor, position, bounds, preserves3D); |
| 49 layer->setContentBounds(bounds); | 49 layer->setContentBounds(bounds); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void executeCalculateDrawTransformsAndVisibility(Layer* rootLayer, float deviceS
caleFactor = 1, float pageScaleFactor = 1) | 52 void executeCalculateDrawProperties(Layer* rootLayer, float deviceScaleFactor =
1, float pageScaleFactor = 1) |
| 53 { | 53 { |
| 54 gfx::Transform identityMatrix; | 54 gfx::Transform identityMatrix; |
| 55 std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList; | 55 std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList; |
| 56 int dummyMaxTextureSize = 512; | 56 int dummyMaxTextureSize = 512; |
| 57 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); | 57 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); |
| 58 | 58 |
| 59 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 59 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
| 60 DCHECK(!rootLayer->bounds().IsEmpty()); | 60 DCHECK(!rootLayer->bounds().IsEmpty()); |
| 61 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayer
List); | 61 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayer
List); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void executeCalculateDrawTransformsAndVisibility(LayerImpl* rootLayer, float dev
iceScaleFactor = 1, float pageScaleFactor = 1) | 64 void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto
r = 1, float pageScaleFactor = 1) |
| 65 { | 65 { |
| 66 // Note: this version skips layer sorting. | 66 // Note: this version skips layer sorting. |
| 67 | 67 |
| 68 gfx::Transform identityMatrix; | 68 gfx::Transform identityMatrix; |
| 69 std::vector<LayerImpl*> dummyRenderSurfaceLayerList; | 69 std::vector<LayerImpl*> dummyRenderSurfaceLayerList; |
| 70 int dummyMaxTextureSize = 512; | 70 int dummyMaxTextureSize = 512; |
| 71 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); | 71 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); |
| 72 | 72 |
| 73 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 73 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
| 74 DCHECK(!rootLayer->bounds().IsEmpty()); | 74 DCHECK(!rootLayer->bounds().IsEmpty()); |
| 75 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLa
yerList); | 75 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLa
yerList); |
| 76 } | 76 } |
| 77 | 77 |
| 78 scoped_ptr<LayerImpl> createTreeForFixedPositionTests() | 78 scoped_ptr<LayerImpl> createTreeForFixedPositionTests() |
| 79 { | 79 { |
| 80 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 80 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
| 81 scoped_ptr<LayerImpl> child = LayerImpl::create(2); | 81 scoped_ptr<LayerImpl> child = LayerImpl::create(2); |
| 82 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3); | 82 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3); |
| 83 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4); | 83 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4); |
| 84 | 84 |
| 85 gfx::Transform IdentityMatrix; | 85 gfx::Transform IdentityMatrix; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 scoped_refptr<Layer> child = Layer::create(); | 144 scoped_refptr<Layer> child = Layer::create(); |
| 145 scoped_refptr<Layer> grandChild = Layer::create(); | 145 scoped_refptr<Layer> grandChild = Layer::create(); |
| 146 parent->addChild(child); | 146 parent->addChild(child); |
| 147 child->addChild(grandChild); | 147 child->addChild(grandChild); |
| 148 | 148 |
| 149 gfx::Transform identityMatrix; | 149 gfx::Transform identityMatrix; |
| 150 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 150 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 151 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false); | 151 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false); |
| 152 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false); | 152 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false); |
| 153 | 153 |
| 154 executeCalculateDrawTransformsAndVisibility(parent.get()); | 154 executeCalculateDrawProperties(parent.get()); |
| 155 | 155 |
| 156 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); | 156 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); |
| 157 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform(
)); | 157 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform(
)); |
| 158 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; | 158 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; |
| 159 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTrans
form()); | 159 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTrans
form()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer) | 162 TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer) |
| 163 { | 163 { |
| 164 gfx::Transform identityMatrix; | 164 gfx::Transform identityMatrix; |
| 165 scoped_refptr<Layer> layer = Layer::create(); | 165 scoped_refptr<Layer> layer = Layer::create(); |
| 166 | 166 |
| 167 scoped_refptr<Layer> root = Layer::create(); | 167 scoped_refptr<Layer> root = Layer::create(); |
| 168 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false); | 168 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false); |
| 169 root->addChild(layer); | 169 root->addChild(layer); |
| 170 | 170 |
| 171 // Case 1: setting the sublayer transform should not affect this layer's dra
w transform or screen-space transform. | 171 // Case 1: setting the sublayer transform should not affect this layer's dra
w transform or screen-space transform. |
| 172 gfx::Transform arbitraryTranslation; | 172 gfx::Transform arbitraryTranslation; |
| 173 arbitraryTranslation.Translate(10, 20); | 173 arbitraryTranslation.Translate(10, 20); |
| 174 setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslati
on, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 174 setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslati
on, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 175 executeCalculateDrawTransformsAndVisibility(root.get()); | 175 executeCalculateDrawProperties(root.get()); |
| 176 gfx::Transform expectedDrawTransform = identityMatrix; | 176 gfx::Transform expectedDrawTransform = identityMatrix; |
| 177 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, layer->drawTransform(
)); | 177 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, layer->drawTransform(
)); |
| 178 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform(
)); | 178 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform(
)); |
| 179 | 179 |
| 180 // Case 2: Setting the bounds of the layer should not affect either the draw
transform or the screenspace transform. | 180 // Case 2: Setting the bounds of the layer should not affect either the draw
transform or the screenspace transform. |
| 181 gfx::Transform translationToCenter; | 181 gfx::Transform translationToCenter; |
| 182 translationToCenter.Translate(5, 6); | 182 translationToCenter.Translate(5, 6); |
| 183 setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false); | 183 setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false); |
| 184 executeCalculateDrawTransformsAndVisibility(root.get()); | 184 executeCalculateDrawProperties(root.get()); |
| 185 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); | 185 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); |
| 186 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform(
)); | 186 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform(
)); |
| 187 | 187 |
| 188 // Case 3: The anchor point by itself (without a layer transform) should hav
e no effect on the transforms. | 188 // Case 3: The anchor point by itself (without a layer transform) should hav
e no effect on the transforms. |
| 189 setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gf
x::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false); | 189 setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gf
x::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false); |
| 190 executeCalculateDrawTransformsAndVisibility(root.get()); | 190 executeCalculateDrawProperties(root.get()); |
| 191 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); | 191 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform()); |
| 192 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform(
)); | 192 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform(
)); |
| 193 | 193 |
| 194 // Case 4: A change in actual position affects both the draw transform and s
creen space transform. | 194 // Case 4: A change in actual position affects both the draw transform and s
creen space transform. |
| 195 gfx::Transform positionTransform; | 195 gfx::Transform positionTransform; |
| 196 positionTransform.Translate(0, 1.2); | 196 positionTransform.Translate(0, 1.2); |
| 197 setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gf
x::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false); | 197 setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gf
x::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false); |
| 198 executeCalculateDrawTransformsAndVisibility(root.get()); | 198 executeCalculateDrawProperties(root.get()); |
| 199 EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->drawTransform()); | 199 EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->drawTransform()); |
| 200 EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransfo
rm()); | 200 EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransfo
rm()); |
| 201 | 201 |
| 202 // Case 5: In the correct sequence of transforms, the layer transform should
pre-multiply the translationToCenter. This is easily tested by | 202 // Case 5: In the correct sequence of transforms, the layer transform should
pre-multiply the translationToCenter. This is easily tested by |
| 203 // using a scale transform, because scale and translation are not co
mmutative. | 203 // using a scale transform, because scale and translation are not co
mmutative. |
| 204 gfx::Transform layerTransform; | 204 gfx::Transform layerTransform; |
| 205 layerTransform.Scale3d(2, 2, 1); | 205 layerTransform.Scale3d(2, 2, 1); |
| 206 setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false); | 206 setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false); |
| 207 executeCalculateDrawTransformsAndVisibility(root.get()); | 207 executeCalculateDrawProperties(root.get()); |
| 208 EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->drawTransform()); | 208 EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->drawTransform()); |
| 209 EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform(
)); | 209 EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform(
)); |
| 210 | 210 |
| 211 // Case 6: The layer transform should occur with respect to the anchor point
. | 211 // Case 6: The layer transform should occur with respect to the anchor point
. |
| 212 gfx::Transform translationToAnchor; | 212 gfx::Transform translationToAnchor; |
| 213 translationToAnchor.Translate(5, 0); | 213 translationToAnchor.Translate(5, 0); |
| 214 gfx::Transform expectedResult = translationToAnchor * layerTransform * MathU
til::inverse(translationToAnchor); | 214 gfx::Transform expectedResult = translationToAnchor * layerTransform * MathU
til::inverse(translationToAnchor); |
| 215 setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gf
x::PointF(0.5, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false); | 215 setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gf
x::PointF(0.5, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false); |
| 216 executeCalculateDrawTransformsAndVisibility(root.get()); | 216 executeCalculateDrawProperties(root.get()); |
| 217 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); | 217 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); |
| 218 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform(
)); | 218 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform(
)); |
| 219 | 219 |
| 220 // Case 7: Verify that position pre-multiplies the layer transform. | 220 // Case 7: Verify that position pre-multiplies the layer transform. |
| 221 // The current implementation of calculateDrawTransforms does this i
mplicitly, but it is | 221 // The current implementation of calculateDrawProperties does this i
mplicitly, but it is |
| 222 // still worth testing to detect accidental regressions. | 222 // still worth testing to detect accidental regressions. |
| 223 expectedResult = positionTransform * translationToAnchor * layerTransform *
MathUtil::inverse(translationToAnchor); | 223 expectedResult = positionTransform * translationToAnchor * layerTransform *
MathUtil::inverse(translationToAnchor); |
| 224 setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gf
x::PointF(0.5, 0), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false); | 224 setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gf
x::PointF(0.5, 0), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false); |
| 225 executeCalculateDrawTransformsAndVisibility(root.get()); | 225 executeCalculateDrawProperties(root.get()); |
| 226 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); | 226 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform()); |
| 227 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform(
)); | 227 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform(
)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) | 230 TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy) |
| 231 { | 231 { |
| 232 gfx::Transform identityMatrix; | 232 gfx::Transform identityMatrix; |
| 233 scoped_refptr<Layer> root = Layer::create(); | 233 scoped_refptr<Layer> root = Layer::create(); |
| 234 scoped_refptr<Layer> parent = Layer::create(); | 234 scoped_refptr<Layer> parent = Layer::create(); |
| 235 scoped_refptr<Layer> child = Layer::create(); | 235 scoped_refptr<Layer> child = Layer::create(); |
| 236 scoped_refptr<Layer> grandChild = Layer::create(); | 236 scoped_refptr<Layer> grandChild = Layer::create(); |
| 237 root->addChild(parent); | 237 root->addChild(parent); |
| 238 parent->addChild(child); | 238 parent->addChild(child); |
| 239 child->addChild(grandChild); | 239 child->addChild(grandChild); |
| 240 | 240 |
| 241 // One-time setup of root layer | 241 // One-time setup of root layer |
| 242 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false); | 242 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false); |
| 243 | 243 |
| 244 // Case 1: parent's anchorPoint should not affect child or grandChild. | 244 // Case 1: parent's anchorPoint should not affect child or grandChild. |
| 245 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false); | 245 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false); |
| 246 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); | 246 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); |
| 247 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); | 247 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); |
| 248 executeCalculateDrawTransformsAndVisibility(root.get()); | 248 executeCalculateDrawProperties(root.get()); |
| 249 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); | 249 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); |
| 250 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform(
)); | 250 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform(
)); |
| 251 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; | 251 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; |
| 252 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTrans
form()); | 252 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTrans
form()); |
| 253 | 253 |
| 254 // Case 2: parent's position affects child and grandChild. | 254 // Case 2: parent's position affects child and grandChild. |
| 255 gfx::Transform parentPositionTransform; | 255 gfx::Transform parentPositionTransform; |
| 256 parentPositionTransform.Translate(0, 1.2); | 256 parentPositionTransform.Translate(0, 1.2); |
| 257 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false); | 257 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false); |
| 258 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); | 258 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); |
| 259 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); | 259 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); |
| 260 executeCalculateDrawTransformsAndVisibility(root.get()); | 260 executeCalculateDrawProperties(root.get()); |
| 261 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->drawTransfor
m()); | 261 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->drawTransfor
m()); |
| 262 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->screenSpaceT
ransform()); | 262 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->screenSpaceT
ransform()); |
| 263 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->drawTra
nsform()); | 263 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->drawTra
nsform()); |
| 264 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenS
paceTransform()); | 264 EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenS
paceTransform()); |
| 265 | 265 |
| 266 // Case 3: parent's local transform affects child and grandchild | 266 // Case 3: parent's local transform affects child and grandchild |
| 267 gfx::Transform parentLayerTransform; | 267 gfx::Transform parentLayerTransform; |
| 268 parentLayerTransform.Scale3d(2, 2, 1); | 268 parentLayerTransform.Scale3d(2, 2, 1); |
| 269 gfx::Transform parentTranslationToAnchor; | 269 gfx::Transform parentTranslationToAnchor; |
| 270 parentTranslationToAnchor.Translate(2.5, 3); | 270 parentTranslationToAnchor.Translate(2.5, 3); |
| 271 gfx::Transform parentCompositeTransform = parentTranslationToAnchor * parent
LayerTransform * MathUtil::inverse(parentTranslationToAnchor); | 271 gfx::Transform parentCompositeTransform = parentTranslationToAnchor * parent
LayerTransform * MathUtil::inverse(parentTranslationToAnchor); |
| 272 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMat
rix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false); | 272 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMat
rix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false); |
| 273 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); | 273 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); |
| 274 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); | 274 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); |
| 275 executeCalculateDrawTransformsAndVisibility(root.get()); | 275 executeCalculateDrawProperties(root.get()); |
| 276 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransfo
rm()); | 276 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransfo
rm()); |
| 277 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); | 277 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); |
| 278 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTr
ansform()); | 278 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTr
ansform()); |
| 279 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screen
SpaceTransform()); | 279 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screen
SpaceTransform()); |
| 280 | 280 |
| 281 // Case 4: parent's sublayerMatrix affects child and grandchild | 281 // Case 4: parent's sublayerMatrix affects child and grandchild |
| 282 // scaling is used here again so that the correct sequence of transf
orms is properly tested. | 282 // scaling is used here again so that the correct sequence of transf
orms is properly tested. |
| 283 // Note that preserves3D is false, but the sublayer matrix should re
tain its 3D properties when given to child. | 283 // Note that preserves3D is false, but the sublayer matrix should re
tain its 3D properties when given to child. |
| 284 // But then, the child also does not preserve3D. When it gives its h
ierarchy to the grandChild, it should be flattened to 2D. | 284 // But then, the child also does not preserve3D. When it gives its h
ierarchy to the grandChild, it should be flattened to 2D. |
| 285 gfx::Transform parentSublayerMatrix; | 285 gfx::Transform parentSublayerMatrix; |
| 286 parentSublayerMatrix.Scale3d(10, 10, 3.3); | 286 parentSublayerMatrix.Scale3d(10, 10, 3.3); |
| 287 gfx::Transform parentTranslationToCenter; | 287 gfx::Transform parentTranslationToCenter; |
| 288 parentTranslationToCenter.Translate(5, 6); | 288 parentTranslationToCenter.Translate(5, 6); |
| 289 // Sublayer matrix is applied to the center of the parent layer. | 289 // Sublayer matrix is applied to the center of the parent layer. |
| 290 parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform
* MathUtil::inverse(parentTranslationToAnchor) | 290 parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform
* MathUtil::inverse(parentTranslationToAnchor) |
| 291 * parentTranslationToCenter * parentSublayerMatrix * MathUtil::inver
se(parentTranslationToCenter); | 291 * parentTranslationToCenter * parentSublayerMatrix * MathUtil::inver
se(parentTranslationToCenter); |
| 292 gfx::Transform flattenedCompositeTransform = MathUtil::to2dTransform(parentC
ompositeTransform); | 292 gfx::Transform flattenedCompositeTransform = MathUtil::to2dTransform(parentC
ompositeTransform); |
| 293 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false)
; | 293 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false)
; |
| 294 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); | 294 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); |
| 295 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); | 295 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); |
| 296 executeCalculateDrawTransformsAndVisibility(root.get()); | 296 executeCalculateDrawProperties(root.get()); |
| 297 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransfo
rm()); | 297 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransfo
rm()); |
| 298 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); | 298 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); |
| 299 EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->dra
wTransform()); | 299 EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->dra
wTransform()); |
| 300 EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->scr
eenSpaceTransform()); | 300 EXPECT_TRANSFORMATION_MATRIX_EQ(flattenedCompositeTransform, grandChild->scr
eenSpaceTransform()); |
| 301 | 301 |
| 302 // Case 5: same as Case 4, except that child does preserve 3D, so the grandC
hild should receive the non-flattened composite transform. | 302 // Case 5: same as Case 4, except that child does preserve 3D, so the grandC
hild should receive the non-flattened composite transform. |
| 303 // | 303 // |
| 304 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false)
; | 304 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false)
; |
| 305 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), true); | 305 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), true); |
| 306 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); | 306 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false); |
| 307 executeCalculateDrawTransformsAndVisibility(root.get()); | 307 executeCalculateDrawProperties(root.get()); |
| 308 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransfo
rm()); | 308 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransfo
rm()); |
| 309 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); | 309 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); |
| 310 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTr
ansform()); | 310 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->drawTr
ansform()); |
| 311 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screen
SpaceTransform()); | 311 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, grandChild->screen
SpaceTransform()); |
| 312 } | 312 } |
| 313 | 313 |
| 314 TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) | 314 TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) |
| 315 { | 315 { |
| 316 scoped_refptr<Layer> root = Layer::create(); | 316 scoped_refptr<Layer> root = Layer::create(); |
| 317 scoped_refptr<Layer> parent = Layer::create(); | 317 scoped_refptr<Layer> parent = Layer::create(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 343 gfx::Transform surfaceSublayerTransform; | 343 gfx::Transform surfaceSublayerTransform; |
| 344 surfaceSublayerTransform.Scale(parentCompositeScale.x(), parentCompositeScal
e.y()); | 344 surfaceSublayerTransform.Scale(parentCompositeScale.x(), parentCompositeScal
e.y()); |
| 345 gfx::Transform surfaceSublayerCompositeTransform = parentCompositeTransform
* MathUtil::inverse(surfaceSublayerTransform); | 345 gfx::Transform surfaceSublayerCompositeTransform = parentCompositeTransform
* MathUtil::inverse(surfaceSublayerTransform); |
| 346 | 346 |
| 347 // Child's render surface should not exist yet. | 347 // Child's render surface should not exist yet. |
| 348 ASSERT_FALSE(child->renderSurface()); | 348 ASSERT_FALSE(child->renderSurface()); |
| 349 | 349 |
| 350 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(100, 120), fals
e); | 350 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(100, 120), fals
e); |
| 351 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); | 351 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); |
| 352 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(8, 10), false); | 352 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(8, 10), false); |
| 353 executeCalculateDrawTransformsAndVisibility(root.get()); | 353 executeCalculateDrawProperties(root.get()); |
| 354 | 354 |
| 355 // Render surface should have been created now. | 355 // Render surface should have been created now. |
| 356 ASSERT_TRUE(child->renderSurface()); | 356 ASSERT_TRUE(child->renderSurface()); |
| 357 ASSERT_EQ(child, child->renderTarget()); | 357 ASSERT_EQ(child, child->renderTarget()); |
| 358 | 358 |
| 359 // The child layer's draw transform should refer to its new render surface. | 359 // The child layer's draw transform should refer to its new render surface. |
| 360 // The screen-space transform, however, should still refer to the root. | 360 // The screen-space transform, however, should still refer to the root. |
| 361 EXPECT_TRANSFORMATION_MATRIX_EQ(surfaceSublayerTransform, child->drawTransfo
rm()); | 361 EXPECT_TRANSFORMATION_MATRIX_EQ(surfaceSublayerTransform, child->drawTransfo
rm()); |
| 362 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); | 362 EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpace
Transform()); |
| 363 | 363 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 surfaceSublayerTransform.Scale(parentCompositeScale.x(), parentCompositeScal
e.y()); | 407 surfaceSublayerTransform.Scale(parentCompositeScale.x(), parentCompositeScal
e.y()); |
| 408 gfx::Transform replicaCompositeTransform = parentCompositeTransform * replic
aLayerTransform * MathUtil::inverse(surfaceSublayerTransform); | 408 gfx::Transform replicaCompositeTransform = parentCompositeTransform * replic
aLayerTransform * MathUtil::inverse(surfaceSublayerTransform); |
| 409 | 409 |
| 410 // Child's render surface should not exist yet. | 410 // Child's render surface should not exist yet. |
| 411 ASSERT_FALSE(child->renderSurface()); | 411 ASSERT_FALSE(child->renderSurface()); |
| 412 | 412 |
| 413 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false)
; | 413 setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSubla
yerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false)
; |
| 414 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); | 414 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false); |
| 415 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(-0.5, -0.5), gfx::Size(1, 1), false); | 415 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(-0.5, -0.5), gfx::Size(1, 1), false); |
| 416 setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, iden
tityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false); | 416 setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, iden
tityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false); |
| 417 executeCalculateDrawTransformsAndVisibility(root.get()); | 417 executeCalculateDrawProperties(root.get()); |
| 418 | 418 |
| 419 // Render surface should have been created now. | 419 // Render surface should have been created now. |
| 420 ASSERT_TRUE(child->renderSurface()); | 420 ASSERT_TRUE(child->renderSurface()); |
| 421 ASSERT_EQ(child, child->renderTarget()); | 421 ASSERT_EQ(child, child->renderTarget()); |
| 422 | 422 |
| 423 EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarg
et()->renderSurface()->replicaDrawTransform()); | 423 EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarg
et()->renderSurface()->replicaDrawTransform()); |
| 424 EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarg
et()->renderSurface()->replicaScreenSpaceTransform()); | 424 EXPECT_TRANSFORMATION_MATRIX_EQ(replicaCompositeTransform, child->renderTarg
et()->renderSurface()->replicaScreenSpaceTransform()); |
| 425 } | 425 } |
| 426 | 426 |
| 427 TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) | 427 TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerT
ransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 510 setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerT
ransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 511 setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTran
sform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 511 setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTran
sform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 512 setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 512 setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 513 setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 513 setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 514 setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublaye
rTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 514 setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublaye
rTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 515 setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 515 setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 516 setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 516 setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 517 setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, subl
ayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false); | 517 setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, subl
ayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false); |
| 518 setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, subl
ayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false); | 518 setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, subl
ayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false); |
| 519 | 519 |
| 520 executeCalculateDrawTransformsAndVisibility(root.get()); | 520 executeCalculateDrawProperties(root.get()); |
| 521 | 521 |
| 522 // Only layers that are associated with render surfaces should have an actua
l renderSurface() value. | 522 // Only layers that are associated with render surfaces should have an actua
l renderSurface() value. |
| 523 // | 523 // |
| 524 ASSERT_TRUE(root->renderSurface()); | 524 ASSERT_TRUE(root->renderSurface()); |
| 525 ASSERT_FALSE(childOfRoot->renderSurface()); | 525 ASSERT_FALSE(childOfRoot->renderSurface()); |
| 526 ASSERT_FALSE(grandChildOfRoot->renderSurface()); | 526 ASSERT_FALSE(grandChildOfRoot->renderSurface()); |
| 527 | 527 |
| 528 ASSERT_TRUE(renderSurface1->renderSurface()); | 528 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 529 ASSERT_FALSE(childOfRS1->renderSurface()); | 529 ASSERT_FALSE(childOfRS1->renderSurface()); |
| 530 ASSERT_FALSE(grandChildOfRS1->renderSurface()); | 530 ASSERT_FALSE(grandChildOfRS1->renderSurface()); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 // No layers in this test should preserve 3d. | 632 // No layers in this test should preserve 3d. |
| 633 ASSERT_FALSE(root->preserves3D()); | 633 ASSERT_FALSE(root->preserves3D()); |
| 634 ASSERT_FALSE(child->preserves3D()); | 634 ASSERT_FALSE(child->preserves3D()); |
| 635 ASSERT_FALSE(grandChild->preserves3D()); | 635 ASSERT_FALSE(grandChild->preserves3D()); |
| 636 | 636 |
| 637 gfx::Transform expectedChildDrawTransform = rotationAboutYAxis; | 637 gfx::Transform expectedChildDrawTransform = rotationAboutYAxis; |
| 638 gfx::Transform expectedChildScreenSpaceTransform = rotationAboutYAxis; | 638 gfx::Transform expectedChildScreenSpaceTransform = rotationAboutYAxis; |
| 639 gfx::Transform expectedGrandChildDrawTransform = rotationAboutYAxis; // draw
s onto child's renderSurface | 639 gfx::Transform expectedGrandChildDrawTransform = rotationAboutYAxis; // draw
s onto child's renderSurface |
| 640 gfx::Transform expectedGrandChildScreenSpaceTransform = MathUtil::to2dTransf
orm(rotationAboutYAxis) * rotationAboutYAxis; | 640 gfx::Transform expectedGrandChildScreenSpaceTransform = MathUtil::to2dTransf
orm(rotationAboutYAxis) * rotationAboutYAxis; |
| 641 | 641 |
| 642 executeCalculateDrawTransformsAndVisibility(root.get()); | 642 executeCalculateDrawProperties(root.get()); |
| 643 | 643 |
| 644 // The child's drawTransform should have been taken by its surface. | 644 // The child's drawTransform should have been taken by its surface. |
| 645 ASSERT_TRUE(child->renderSurface()); | 645 ASSERT_TRUE(child->renderSurface()); |
| 646 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildDrawTransform, child->renderSur
face()->drawTransform()); | 646 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildDrawTransform, child->renderSur
face()->drawTransform()); |
| 647 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildScreenSpaceTransform, child->re
nderSurface()->screenSpaceTransform()); | 647 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildScreenSpaceTransform, child->re
nderSurface()->screenSpaceTransform()); |
| 648 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); | 648 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); |
| 649 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildScreenSpaceTransform, child->sc
reenSpaceTransform()); | 649 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildScreenSpaceTransform, child->sc
reenSpaceTransform()); |
| 650 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildDrawTransform, grandChild-
>drawTransform()); | 650 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildDrawTransform, grandChild-
>drawTransform()); |
| 651 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildScreenSpaceTransform, gran
dChild->screenSpaceTransform()); | 651 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildScreenSpaceTransform, gran
dChild->screenSpaceTransform()); |
| 652 } | 652 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 666 // The child height is zero, but has non-zero width that should be accounted
for while computing drawTransforms. | 666 // The child height is zero, but has non-zero width that should be accounted
for while computing drawTransforms. |
| 667 const gfx::Transform identityMatrix; | 667 const gfx::Transform identityMatrix; |
| 668 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(), gfx::PointF(), gfx::Size(100, 100), false); | 668 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(), gfx::PointF(), gfx::Size(100, 100), false); |
| 669 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 0), false); | 669 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 0), false); |
| 670 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 670 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
| 671 | 671 |
| 672 root->addChild(child); | 672 root->addChild(child); |
| 673 child->addChild(grandChild); | 673 child->addChild(grandChild); |
| 674 child->setForceRenderSurface(true); | 674 child->setForceRenderSurface(true); |
| 675 | 675 |
| 676 executeCalculateDrawTransformsAndVisibility(root.get()); | 676 executeCalculateDrawProperties(root.get()); |
| 677 | 677 |
| 678 ASSERT_TRUE(child->renderSurface()); | 678 ASSERT_TRUE(child->renderSurface()); |
| 679 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->renderSurface()->draw
Transform()); // This is the real test, the rest are sanity checks. | 679 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->renderSurface()->draw
Transform()); // This is the real test, the rest are sanity checks. |
| 680 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); | 680 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); |
| 681 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; | 681 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; |
| 682 } | 682 } |
| 683 | 683 |
| 684 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipped
Layer) | 684 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipped
Layer) |
| 685 { | 685 { |
| 686 scoped_refptr<Layer> parent = Layer::create(); | 686 scoped_refptr<Layer> parent = Layer::create(); |
| 687 scoped_refptr<Layer> renderSurface1 = Layer::create(); | 687 scoped_refptr<Layer> renderSurface1 = Layer::create(); |
| 688 scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new La
yerWithForcedDrawsContent()); | 688 scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new La
yerWithForcedDrawsContent()); |
| 689 | 689 |
| 690 const gfx::Transform identityMatrix; | 690 const gfx::Transform identityMatrix; |
| 691 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 691 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
| 692 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 692 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
| 693 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(30, 30), gfx::Size(10, 10), false); | 693 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(30, 30), gfx::Size(10, 10), false); |
| 694 | 694 |
| 695 parent->addChild(renderSurface1); | 695 parent->addChild(renderSurface1); |
| 696 parent->setMasksToBounds(true); | 696 parent->setMasksToBounds(true); |
| 697 renderSurface1->addChild(child); | 697 renderSurface1->addChild(child); |
| 698 renderSurface1->setForceRenderSurface(true); | 698 renderSurface1->setForceRenderSurface(true); |
| 699 | 699 |
| 700 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 700 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 701 int dummyMaxTextureSize = 512; | 701 int dummyMaxTextureSize = 512; |
| 702 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 702 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 703 | 703 |
| 704 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate | 704 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate |
| 705 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible | 705 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible |
| 706 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). | 706 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). |
| 707 ASSERT_TRUE(parent->renderSurface()); | 707 ASSERT_TRUE(parent->renderSurface()); |
| 708 ASSERT_FALSE(renderSurface1->renderSurface()); | 708 ASSERT_FALSE(renderSurface1->renderSurface()); |
| 709 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 709 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
| 710 } | 710 } |
| 711 | 711 |
| 712 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) | 712 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) |
| 713 { | 713 { |
| 714 scoped_refptr<Layer> parent = Layer::create(); | 714 scoped_refptr<Layer> parent = Layer::create(); |
| 715 scoped_refptr<Layer> renderSurface1 = Layer::create(); | 715 scoped_refptr<Layer> renderSurface1 = Layer::create(); |
| 716 scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new La
yerWithForcedDrawsContent()); | 716 scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new La
yerWithForcedDrawsContent()); |
| 717 | 717 |
| 718 const gfx::Transform identityMatrix; | 718 const gfx::Transform identityMatrix; |
| 719 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 719 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
| 720 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 720 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
| 721 | 721 |
| 722 parent->addChild(renderSurface1); | 722 parent->addChild(renderSurface1); |
| 723 renderSurface1->addChild(child); | 723 renderSurface1->addChild(child); |
| 724 renderSurface1->setForceRenderSurface(true); | 724 renderSurface1->setForceRenderSurface(true); |
| 725 renderSurface1->setOpacity(0); | 725 renderSurface1->setOpacity(0); |
| 726 | 726 |
| 727 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 727 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 728 int dummyMaxTextureSize = 512; | 728 int dummyMaxTextureSize = 512; |
| 729 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 729 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 730 | 730 |
| 731 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. | 731 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. |
| 732 // Also, the drawable content rect should not have been extended by the chil
dren. | 732 // Also, the drawable content rect should not have been extended by the chil
dren. |
| 733 ASSERT_TRUE(parent->renderSurface()); | 733 ASSERT_TRUE(parent->renderSurface()); |
| 734 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); | 734 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); |
| 735 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 735 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
| 736 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 736 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| 737 EXPECT_EQ(gfx::Rect(), parent->drawableContentRect()); | 737 EXPECT_EQ(gfx::Rect(), parent->drawableContentRect()); |
| 738 } | 738 } |
| 739 | 739 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 751 | 751 |
| 752 parent->addChild(renderSurface1); | 752 parent->addChild(renderSurface1); |
| 753 renderSurface1->addChild(child); | 753 renderSurface1->addChild(child); |
| 754 | 754 |
| 755 // Sanity check before the actual test | 755 // Sanity check before the actual test |
| 756 EXPECT_FALSE(parent->renderSurface()); | 756 EXPECT_FALSE(parent->renderSurface()); |
| 757 EXPECT_FALSE(renderSurface1->renderSurface()); | 757 EXPECT_FALSE(renderSurface1->renderSurface()); |
| 758 | 758 |
| 759 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 759 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 760 int dummyMaxTextureSize = 512; | 760 int dummyMaxTextureSize = 512; |
| 761 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 761 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 762 | 762 |
| 763 // The root layer always creates a renderSurface | 763 // The root layer always creates a renderSurface |
| 764 EXPECT_TRUE(parent->renderSurface()); | 764 EXPECT_TRUE(parent->renderSurface()); |
| 765 EXPECT_TRUE(renderSurface1->renderSurface()); | 765 EXPECT_TRUE(renderSurface1->renderSurface()); |
| 766 EXPECT_EQ(2U, renderSurfaceLayerList.size()); | 766 EXPECT_EQ(2U, renderSurfaceLayerList.size()); |
| 767 | 767 |
| 768 renderSurfaceLayerList.clear(); | 768 renderSurfaceLayerList.clear(); |
| 769 renderSurface1->setForceRenderSurface(false); | 769 renderSurface1->setForceRenderSurface(false); |
| 770 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 770 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 771 EXPECT_TRUE(parent->renderSurface()); | 771 EXPECT_TRUE(parent->renderSurface()); |
| 772 EXPECT_FALSE(renderSurface1->renderSurface()); | 772 EXPECT_FALSE(renderSurface1->renderSurface()); |
| 773 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 773 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
| 774 } | 774 } |
| 775 | 775 |
| 776 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) | 776 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) |
| 777 { | 777 { |
| 778 // This test checks for correct scroll compensation when the fixed-position
container | 778 // This test checks for correct scroll compensation when the fixed-position
container |
| 779 // is the direct parent of the fixed-position layer. | 779 // is the direct parent of the fixed-position layer. |
| 780 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 780 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 781 LayerImpl* child = root->children()[0]; | 781 LayerImpl* child = root->children()[0]; |
| 782 LayerImpl* grandChild = child->children()[0]; | 782 LayerImpl* grandChild = child->children()[0]; |
| 783 | 783 |
| 784 child->setIsContainerForFixedPositionLayers(true); | 784 child->setIsContainerForFixedPositionLayers(true); |
| 785 grandChild->setFixedToContainerLayer(true); | 785 grandChild->setFixedToContainerLayer(true); |
| 786 | 786 |
| 787 // Case 1: scrollDelta of 0, 0 | 787 // Case 1: scrollDelta of 0, 0 |
| 788 child->setScrollDelta(gfx::Vector2d(0, 0)); | 788 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 789 executeCalculateDrawTransformsAndVisibility(root.get()); | 789 executeCalculateDrawProperties(root.get()); |
| 790 | 790 |
| 791 gfx::Transform expectedChildTransform; | 791 gfx::Transform expectedChildTransform; |
| 792 gfx::Transform expectedGrandChildTransform = expectedChildTransform; | 792 gfx::Transform expectedGrandChildTransform = expectedChildTransform; |
| 793 | 793 |
| 794 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 794 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 795 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 795 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 796 | 796 |
| 797 // Case 2: scrollDelta of 10, 10 | 797 // Case 2: scrollDelta of 10, 10 |
| 798 child->setScrollDelta(gfx::Vector2d(10, 10)); | 798 child->setScrollDelta(gfx::Vector2d(10, 10)); |
| 799 executeCalculateDrawTransformsAndVisibility(root.get()); | 799 executeCalculateDrawProperties(root.get()); |
| 800 | 800 |
| 801 // Here the child is affected by scrollDelta, but the fixed position grandCh
ild should not be affected. | 801 // Here the child is affected by scrollDelta, but the fixed position grandCh
ild should not be affected. |
| 802 expectedChildTransform.MakeIdentity(); | 802 expectedChildTransform.MakeIdentity(); |
| 803 expectedChildTransform.Translate(-10, -10); | 803 expectedChildTransform.Translate(-10, -10); |
| 804 | 804 |
| 805 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 805 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 806 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 806 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 807 } | 807 } |
| 808 | 808 |
| 809 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
ransformedDirectContainer) | 809 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
ransformedDirectContainer) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 823 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. | 823 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. |
| 824 gfx::Transform nonUniformScale; | 824 gfx::Transform nonUniformScale; |
| 825 nonUniformScale.Scale(2, 8); | 825 nonUniformScale.Scale(2, 8); |
| 826 child->setTransform(nonUniformScale); | 826 child->setTransform(nonUniformScale); |
| 827 | 827 |
| 828 child->setIsContainerForFixedPositionLayers(true); | 828 child->setIsContainerForFixedPositionLayers(true); |
| 829 grandChild->setFixedToContainerLayer(true); | 829 grandChild->setFixedToContainerLayer(true); |
| 830 | 830 |
| 831 // Case 1: scrollDelta of 0, 0 | 831 // Case 1: scrollDelta of 0, 0 |
| 832 child->setScrollDelta(gfx::Vector2d(0, 0)); | 832 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 833 executeCalculateDrawTransformsAndVisibility(root.get()); | 833 executeCalculateDrawProperties(root.get()); |
| 834 | 834 |
| 835 gfx::Transform expectedChildTransform; | 835 gfx::Transform expectedChildTransform; |
| 836 expectedChildTransform.PreconcatTransform(nonUniformScale); | 836 expectedChildTransform.PreconcatTransform(nonUniformScale); |
| 837 | 837 |
| 838 gfx::Transform expectedGrandChildTransform = expectedChildTransform; | 838 gfx::Transform expectedGrandChildTransform = expectedChildTransform; |
| 839 | 839 |
| 840 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 840 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 841 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 841 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 842 | 842 |
| 843 // Case 2: scrollDelta of 10, 20 | 843 // Case 2: scrollDelta of 10, 20 |
| 844 child->setScrollDelta(gfx::Vector2d(10, 20)); | 844 child->setScrollDelta(gfx::Vector2d(10, 20)); |
| 845 executeCalculateDrawTransformsAndVisibility(root.get()); | 845 executeCalculateDrawProperties(root.get()); |
| 846 | 846 |
| 847 // The child should be affected by scrollDelta, but the fixed position grand
Child should not be affected. | 847 // The child should be affected by scrollDelta, but the fixed position grand
Child should not be affected. |
| 848 expectedChildTransform.MakeIdentity(); | 848 expectedChildTransform.MakeIdentity(); |
| 849 expectedChildTransform.Translate(-10, -20); // scrollDelta | 849 expectedChildTransform.Translate(-10, -20); // scrollDelta |
| 850 expectedChildTransform.PreconcatTransform(nonUniformScale); | 850 expectedChildTransform.PreconcatTransform(nonUniformScale); |
| 851 | 851 |
| 852 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 852 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 853 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 853 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 854 } | 854 } |
| 855 | 855 |
| 856 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainer) | 856 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainer) |
| 857 { | 857 { |
| 858 // This test checks for correct scroll compensation when the fixed-position
container | 858 // This test checks for correct scroll compensation when the fixed-position
container |
| 859 // is NOT the direct parent of the fixed-position layer. | 859 // is NOT the direct parent of the fixed-position layer. |
| 860 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 860 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 861 LayerImpl* child = root->children()[0]; | 861 LayerImpl* child = root->children()[0]; |
| 862 LayerImpl* grandChild = child->children()[0]; | 862 LayerImpl* grandChild = child->children()[0]; |
| 863 LayerImpl* greatGrandChild = grandChild->children()[0]; | 863 LayerImpl* greatGrandChild = grandChild->children()[0]; |
| 864 | 864 |
| 865 child->setIsContainerForFixedPositionLayers(true); | 865 child->setIsContainerForFixedPositionLayers(true); |
| 866 grandChild->setPosition(gfx::PointF(8, 6)); | 866 grandChild->setPosition(gfx::PointF(8, 6)); |
| 867 greatGrandChild->setFixedToContainerLayer(true); | 867 greatGrandChild->setFixedToContainerLayer(true); |
| 868 | 868 |
| 869 // Case 1: scrollDelta of 0, 0 | 869 // Case 1: scrollDelta of 0, 0 |
| 870 child->setScrollDelta(gfx::Vector2d(0, 0)); | 870 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 871 executeCalculateDrawTransformsAndVisibility(root.get()); | 871 executeCalculateDrawProperties(root.get()); |
| 872 | 872 |
| 873 gfx::Transform expectedChildTransform; | 873 gfx::Transform expectedChildTransform; |
| 874 gfx::Transform expectedGrandChildTransform; | 874 gfx::Transform expectedGrandChildTransform; |
| 875 expectedGrandChildTransform.Translate(8, 6); | 875 expectedGrandChildTransform.Translate(8, 6); |
| 876 | 876 |
| 877 gfx::Transform expectedGreatGrandChildTransform = expectedGrandChildTransfor
m; | 877 gfx::Transform expectedGreatGrandChildTransform = expectedGrandChildTransfor
m; |
| 878 | 878 |
| 879 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 879 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 880 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 880 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 881 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 881 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 882 | 882 |
| 883 // Case 2: scrollDelta of 10, 10 | 883 // Case 2: scrollDelta of 10, 10 |
| 884 child->setScrollDelta(gfx::Vector2d(10, 10)); | 884 child->setScrollDelta(gfx::Vector2d(10, 10)); |
| 885 executeCalculateDrawTransformsAndVisibility(root.get()); | 885 executeCalculateDrawProperties(root.get()); |
| 886 | 886 |
| 887 // Here the child and grandChild are affected by scrollDelta, but the fixed
position greatGrandChild should not be affected. | 887 // Here the child and grandChild are affected by scrollDelta, but the fixed
position greatGrandChild should not be affected. |
| 888 expectedChildTransform.MakeIdentity(); | 888 expectedChildTransform.MakeIdentity(); |
| 889 expectedChildTransform.Translate(-10, -10); | 889 expectedChildTransform.Translate(-10, -10); |
| 890 expectedGrandChildTransform.MakeIdentity(); | 890 expectedGrandChildTransform.MakeIdentity(); |
| 891 expectedGrandChildTransform.Translate(-2, -4); | 891 expectedGrandChildTransform.Translate(-2, -4); |
| 892 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 892 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 893 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 893 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 894 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 894 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 895 } | 895 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 908 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); | 908 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); |
| 909 | 909 |
| 910 child->setIsContainerForFixedPositionLayers(true); | 910 child->setIsContainerForFixedPositionLayers(true); |
| 911 child->setTransform(rotationAboutZ); | 911 child->setTransform(rotationAboutZ); |
| 912 grandChild->setPosition(gfx::PointF(8, 6)); | 912 grandChild->setPosition(gfx::PointF(8, 6)); |
| 913 grandChild->setTransform(rotationAboutZ); | 913 grandChild->setTransform(rotationAboutZ); |
| 914 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. | 914 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. |
| 915 | 915 |
| 916 // Case 1: scrollDelta of 0, 0 | 916 // Case 1: scrollDelta of 0, 0 |
| 917 child->setScrollDelta(gfx::Vector2d(0, 0)); | 917 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 918 executeCalculateDrawTransformsAndVisibility(root.get()); | 918 executeCalculateDrawProperties(root.get()); |
| 919 | 919 |
| 920 gfx::Transform expectedChildTransform; | 920 gfx::Transform expectedChildTransform; |
| 921 expectedChildTransform.PreconcatTransform(rotationAboutZ); | 921 expectedChildTransform.PreconcatTransform(rotationAboutZ); |
| 922 | 922 |
| 923 gfx::Transform expectedGrandChildTransform; | 923 gfx::Transform expectedGrandChildTransform; |
| 924 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited | 924 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited |
| 925 expectedGrandChildTransform.Translate(8, 6); // translation because of posit
ion occurs before layer's local transform. | 925 expectedGrandChildTransform.Translate(8, 6); // translation because of posit
ion occurs before layer's local transform. |
| 926 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChil
d's local transform | 926 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChil
d's local transform |
| 927 | 927 |
| 928 gfx::Transform expectedGreatGrandChildTransform = expectedGrandChildTransfor
m; | 928 gfx::Transform expectedGreatGrandChildTransform = expectedGrandChildTransfor
m; |
| 929 | 929 |
| 930 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 930 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 931 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 931 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 932 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 932 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 933 | 933 |
| 934 // Case 2: scrollDelta of 10, 20 | 934 // Case 2: scrollDelta of 10, 20 |
| 935 child->setScrollDelta(gfx::Vector2d(10, 20)); | 935 child->setScrollDelta(gfx::Vector2d(10, 20)); |
| 936 executeCalculateDrawTransformsAndVisibility(root.get()); | 936 executeCalculateDrawProperties(root.get()); |
| 937 | 937 |
| 938 // Here the child and grandChild are affected by scrollDelta, but the fixed
position greatGrandChild should not be affected. | 938 // Here the child and grandChild are affected by scrollDelta, but the fixed
position greatGrandChild should not be affected. |
| 939 expectedChildTransform.MakeIdentity(); | 939 expectedChildTransform.MakeIdentity(); |
| 940 expectedChildTransform.Translate(-10, -20); // scrollDelta | 940 expectedChildTransform.Translate(-10, -20); // scrollDelta |
| 941 expectedChildTransform.PreconcatTransform(rotationAboutZ); | 941 expectedChildTransform.PreconcatTransform(rotationAboutZ); |
| 942 | 942 |
| 943 expectedGrandChildTransform.MakeIdentity(); | 943 expectedGrandChildTransform.MakeIdentity(); |
| 944 expectedGrandChildTransform.Translate(-10, -20); // child's scrollDelta is i
nherited | 944 expectedGrandChildTransform.Translate(-10, -20); // child's scrollDelta is i
nherited |
| 945 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited | 945 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited |
| 946 expectedGrandChildTransform.Translate(8, 6); // translation because of posit
ion occurs before layer's local transform. | 946 expectedGrandChildTransform.Translate(8, 6); // translation because of posit
ion occurs before layer's local transform. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 968 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); | 968 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); |
| 969 | 969 |
| 970 child->setIsContainerForFixedPositionLayers(true); | 970 child->setIsContainerForFixedPositionLayers(true); |
| 971 child->setTransform(rotationAboutZ); | 971 child->setTransform(rotationAboutZ); |
| 972 grandChild->setPosition(gfx::PointF(8, 6)); | 972 grandChild->setPosition(gfx::PointF(8, 6)); |
| 973 grandChild->setTransform(rotationAboutZ); | 973 grandChild->setTransform(rotationAboutZ); |
| 974 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. | 974 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. |
| 975 | 975 |
| 976 // Case 1: scrollDelta of 0, 0 | 976 // Case 1: scrollDelta of 0, 0 |
| 977 child->setScrollDelta(gfx::Vector2d(0, 0)); | 977 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 978 executeCalculateDrawTransformsAndVisibility(root.get()); | 978 executeCalculateDrawProperties(root.get()); |
| 979 | 979 |
| 980 gfx::Transform expectedChildTransform; | 980 gfx::Transform expectedChildTransform; |
| 981 expectedChildTransform.PreconcatTransform(rotationAboutZ); | 981 expectedChildTransform.PreconcatTransform(rotationAboutZ); |
| 982 | 982 |
| 983 gfx::Transform expectedGrandChildTransform; | 983 gfx::Transform expectedGrandChildTransform; |
| 984 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited | 984 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited |
| 985 expectedGrandChildTransform.Translate(8, 6); // translation because of posit
ion occurs before layer's local transform. | 985 expectedGrandChildTransform.Translate(8, 6); // translation because of posit
ion occurs before layer's local transform. |
| 986 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChil
d's local transform | 986 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChil
d's local transform |
| 987 | 987 |
| 988 gfx::Transform expectedGreatGrandChildTransform = expectedGrandChildTransfor
m; | 988 gfx::Transform expectedGreatGrandChildTransform = expectedGrandChildTransfor
m; |
| 989 | 989 |
| 990 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 990 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 991 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 991 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 992 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 992 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 993 | 993 |
| 994 // Case 2: scrollDelta of 10, 20 | 994 // Case 2: scrollDelta of 10, 20 |
| 995 child->setScrollDelta(gfx::Vector2d(10, 0)); | 995 child->setScrollDelta(gfx::Vector2d(10, 0)); |
| 996 grandChild->setScrollDelta(gfx::Vector2d(5, 0)); | 996 grandChild->setScrollDelta(gfx::Vector2d(5, 0)); |
| 997 executeCalculateDrawTransformsAndVisibility(root.get()); | 997 executeCalculateDrawProperties(root.get()); |
| 998 | 998 |
| 999 // Here the child and grandChild are affected by scrollDelta, but the fixed
position greatGrandChild should not be affected. | 999 // Here the child and grandChild are affected by scrollDelta, but the fixed
position greatGrandChild should not be affected. |
| 1000 expectedChildTransform.MakeIdentity(); | 1000 expectedChildTransform.MakeIdentity(); |
| 1001 expectedChildTransform.Translate(-10, 0); // scrollDelta | 1001 expectedChildTransform.Translate(-10, 0); // scrollDelta |
| 1002 expectedChildTransform.PreconcatTransform(rotationAboutZ); | 1002 expectedChildTransform.PreconcatTransform(rotationAboutZ); |
| 1003 | 1003 |
| 1004 expectedGrandChildTransform.MakeIdentity(); | 1004 expectedGrandChildTransform.MakeIdentity(); |
| 1005 expectedGrandChildTransform.Translate(-10, 0); // child's scrollDelta is inh
erited | 1005 expectedGrandChildTransform.Translate(-10, 0); // child's scrollDelta is inh
erited |
| 1006 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited | 1006 expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's l
ocal transform is inherited |
| 1007 expectedGrandChildTransform.Translate(-5, 0); // grandChild's scrollDelta | 1007 expectedGrandChildTransform.Translate(-5, 0); // grandChild's scrollDelta |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1029 grandChild->setForceRenderSurface(true); | 1029 grandChild->setForceRenderSurface(true); |
| 1030 greatGrandChild->setFixedToContainerLayer(true); | 1030 greatGrandChild->setFixedToContainerLayer(true); |
| 1031 greatGrandChild->setDrawsContent(true); | 1031 greatGrandChild->setDrawsContent(true); |
| 1032 | 1032 |
| 1033 gfx::Transform rotationAboutZ; | 1033 gfx::Transform rotationAboutZ; |
| 1034 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); | 1034 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); |
| 1035 grandChild->setTransform(rotationAboutZ); | 1035 grandChild->setTransform(rotationAboutZ); |
| 1036 | 1036 |
| 1037 // Case 1: scrollDelta of 0, 0 | 1037 // Case 1: scrollDelta of 0, 0 |
| 1038 child->setScrollDelta(gfx::Vector2d(0, 0)); | 1038 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 1039 executeCalculateDrawTransformsAndVisibility(root.get()); | 1039 executeCalculateDrawProperties(root.get()); |
| 1040 | 1040 |
| 1041 gfx::Transform expectedChildTransform; | 1041 gfx::Transform expectedChildTransform; |
| 1042 gfx::Transform expectedSurfaceDrawTransform; | 1042 gfx::Transform expectedSurfaceDrawTransform; |
| 1043 expectedSurfaceDrawTransform.Translate(8, 6); | 1043 expectedSurfaceDrawTransform.Translate(8, 6); |
| 1044 expectedSurfaceDrawTransform.PreconcatTransform(rotationAboutZ); | 1044 expectedSurfaceDrawTransform.PreconcatTransform(rotationAboutZ); |
| 1045 gfx::Transform expectedGrandChildTransform; | 1045 gfx::Transform expectedGrandChildTransform; |
| 1046 gfx::Transform expectedGreatGrandChildTransform; | 1046 gfx::Transform expectedGreatGrandChildTransform; |
| 1047 ASSERT_TRUE(grandChild->renderSurface()); | 1047 ASSERT_TRUE(grandChild->renderSurface()); |
| 1048 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1048 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 1049 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, grandChild->re
nderSurface()->drawTransform()); | 1049 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, grandChild->re
nderSurface()->drawTransform()); |
| 1050 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1050 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1051 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1051 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 1052 | 1052 |
| 1053 // Case 2: scrollDelta of 10, 30 | 1053 // Case 2: scrollDelta of 10, 30 |
| 1054 child->setScrollDelta(gfx::Vector2d(10, 30)); | 1054 child->setScrollDelta(gfx::Vector2d(10, 30)); |
| 1055 executeCalculateDrawTransformsAndVisibility(root.get()); | 1055 executeCalculateDrawProperties(root.get()); |
| 1056 | 1056 |
| 1057 // Here the grandChild remains unchanged, because it scrolls along with the | 1057 // Here the grandChild remains unchanged, because it scrolls along with the |
| 1058 // renderSurface, and the translation is actually in the renderSurface. But,
the fixed | 1058 // renderSurface, and the translation is actually in the renderSurface. But,
the fixed |
| 1059 // position greatGrandChild is more awkward: its actually being drawn with r
espect to | 1059 // position greatGrandChild is more awkward: its actually being drawn with r
espect to |
| 1060 // the renderSurface, but it needs to remain fixed with resepct to a contain
er beyond | 1060 // the renderSurface, but it needs to remain fixed with resepct to a contain
er beyond |
| 1061 // that surface. So, the net result is that, unlike previous tests where the
fixed | 1061 // that surface. So, the net result is that, unlike previous tests where the
fixed |
| 1062 // position layer's transform remains unchanged, here the fixed position lay
er's | 1062 // position layer's transform remains unchanged, here the fixed position lay
er's |
| 1063 // transform explicitly contains the translation that cancels out the scroll
. | 1063 // transform explicitly contains the translation that cancels out the scroll
. |
| 1064 expectedChildTransform.MakeIdentity(); | 1064 expectedChildTransform.MakeIdentity(); |
| 1065 expectedChildTransform.Translate(-10, -30); // scrollDelta | 1065 expectedChildTransform.Translate(-10, -30); // scrollDelta |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 // clip away layers that we want to test. | 1119 // clip away layers that we want to test. |
| 1120 gfx::Transform rotationAboutZ; | 1120 gfx::Transform rotationAboutZ; |
| 1121 rotationAboutZ.Translate(50, 50); | 1121 rotationAboutZ.Translate(50, 50); |
| 1122 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); | 1122 MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90); |
| 1123 rotationAboutZ.Translate(-50, -50); | 1123 rotationAboutZ.Translate(-50, -50); |
| 1124 grandChild->setTransform(rotationAboutZ); | 1124 grandChild->setTransform(rotationAboutZ); |
| 1125 greatGrandChild->setTransform(rotationAboutZ); | 1125 greatGrandChild->setTransform(rotationAboutZ); |
| 1126 | 1126 |
| 1127 // Case 1: scrollDelta of 0, 0 | 1127 // Case 1: scrollDelta of 0, 0 |
| 1128 child->setScrollDelta(gfx::Vector2d(0, 0)); | 1128 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 1129 executeCalculateDrawTransformsAndVisibility(root.get()); | 1129 executeCalculateDrawProperties(root.get()); |
| 1130 | 1130 |
| 1131 gfx::Transform expectedChildTransform; | 1131 gfx::Transform expectedChildTransform; |
| 1132 | 1132 |
| 1133 gfx::Transform expectedGrandChildSurfaceDrawTransform; | 1133 gfx::Transform expectedGrandChildSurfaceDrawTransform; |
| 1134 expectedGrandChildSurfaceDrawTransform.Translate(8, 6); | 1134 expectedGrandChildSurfaceDrawTransform.Translate(8, 6); |
| 1135 expectedGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAboutZ); | 1135 expectedGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAboutZ); |
| 1136 | 1136 |
| 1137 gfx::Transform expectedGrandChildTransform; | 1137 gfx::Transform expectedGrandChildTransform; |
| 1138 | 1138 |
| 1139 gfx::Transform expectedGreatGrandChildSurfaceDrawTransform; | 1139 gfx::Transform expectedGreatGrandChildSurfaceDrawTransform; |
| 1140 expectedGreatGrandChildSurfaceDrawTransform.Translate(40, 60); | 1140 expectedGreatGrandChildSurfaceDrawTransform.Translate(40, 60); |
| 1141 expectedGreatGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAbout
Z); | 1141 expectedGreatGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAbout
Z); |
| 1142 | 1142 |
| 1143 gfx::Transform expectedGreatGrandChildTransform; | 1143 gfx::Transform expectedGreatGrandChildTransform; |
| 1144 | 1144 |
| 1145 gfx::Transform expectedFixedPositionChildTransform; | 1145 gfx::Transform expectedFixedPositionChildTransform; |
| 1146 | 1146 |
| 1147 ASSERT_TRUE(grandChild->renderSurface()); | 1147 ASSERT_TRUE(grandChild->renderSurface()); |
| 1148 ASSERT_TRUE(greatGrandChild->renderSurface()); | 1148 ASSERT_TRUE(greatGrandChild->renderSurface()); |
| 1149 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1149 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 1150 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceDrawTransform, gran
dChild->renderSurface()->drawTransform()); | 1150 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildSurfaceDrawTransform, gran
dChild->renderSurface()->drawTransform()); |
| 1151 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1151 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1152 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceDrawTransform,
greatGrandChild->renderSurface()->drawTransform()); | 1152 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildSurfaceDrawTransform,
greatGrandChild->renderSurface()->drawTransform()); |
| 1153 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1153 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 1154 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo
sitionChild->drawTransform()); | 1154 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo
sitionChild->drawTransform()); |
| 1155 | 1155 |
| 1156 // Case 2: scrollDelta of 10, 30 | 1156 // Case 2: scrollDelta of 10, 30 |
| 1157 child->setScrollDelta(gfx::Vector2d(10, 30)); | 1157 child->setScrollDelta(gfx::Vector2d(10, 30)); |
| 1158 executeCalculateDrawTransformsAndVisibility(root.get()); | 1158 executeCalculateDrawProperties(root.get()); |
| 1159 | 1159 |
| 1160 expectedChildTransform.MakeIdentity(); | 1160 expectedChildTransform.MakeIdentity(); |
| 1161 expectedChildTransform.Translate(-10, -30); // scrollDelta | 1161 expectedChildTransform.Translate(-10, -30); // scrollDelta |
| 1162 | 1162 |
| 1163 expectedGrandChildSurfaceDrawTransform.MakeIdentity(); | 1163 expectedGrandChildSurfaceDrawTransform.MakeIdentity(); |
| 1164 expectedGrandChildSurfaceDrawTransform.Translate(-10, -30); // scrollDelta | 1164 expectedGrandChildSurfaceDrawTransform.Translate(-10, -30); // scrollDelta |
| 1165 expectedGrandChildSurfaceDrawTransform.Translate(8, 6); | 1165 expectedGrandChildSurfaceDrawTransform.Translate(8, 6); |
| 1166 expectedGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAboutZ); | 1166 expectedGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAboutZ); |
| 1167 | 1167 |
| 1168 // grandChild, greatGrandChild, and greatGrandChild's surface are not expect
ed to | 1168 // grandChild, greatGrandChild, and greatGrandChild's surface are not expect
ed to |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 LayerImpl* child = root->children()[0]; | 1203 LayerImpl* child = root->children()[0]; |
| 1204 LayerImpl* grandChild = child->children()[0]; | 1204 LayerImpl* grandChild = child->children()[0]; |
| 1205 | 1205 |
| 1206 child->setIsContainerForFixedPositionLayers(true); | 1206 child->setIsContainerForFixedPositionLayers(true); |
| 1207 child->setForceRenderSurface(true); | 1207 child->setForceRenderSurface(true); |
| 1208 grandChild->setFixedToContainerLayer(true); | 1208 grandChild->setFixedToContainerLayer(true); |
| 1209 grandChild->setDrawsContent(true); | 1209 grandChild->setDrawsContent(true); |
| 1210 | 1210 |
| 1211 // Case 1: scrollDelta of 0, 0 | 1211 // Case 1: scrollDelta of 0, 0 |
| 1212 child->setScrollDelta(gfx::Vector2d(0, 0)); | 1212 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 1213 executeCalculateDrawTransformsAndVisibility(root.get()); | 1213 executeCalculateDrawProperties(root.get()); |
| 1214 | 1214 |
| 1215 gfx::Transform expectedSurfaceDrawTransform; | 1215 gfx::Transform expectedSurfaceDrawTransform; |
| 1216 expectedSurfaceDrawTransform.Translate(0, 0); | 1216 expectedSurfaceDrawTransform.Translate(0, 0); |
| 1217 gfx::Transform expectedChildTransform; | 1217 gfx::Transform expectedChildTransform; |
| 1218 gfx::Transform expectedGrandChildTransform; | 1218 gfx::Transform expectedGrandChildTransform; |
| 1219 ASSERT_TRUE(child->renderSurface()); | 1219 ASSERT_TRUE(child->renderSurface()); |
| 1220 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS
urface()->drawTransform()); | 1220 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS
urface()->drawTransform()); |
| 1221 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1221 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 1222 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1222 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1223 | 1223 |
| 1224 // Case 2: scrollDelta of 10, 10 | 1224 // Case 2: scrollDelta of 10, 10 |
| 1225 child->setScrollDelta(gfx::Vector2d(10, 10)); | 1225 child->setScrollDelta(gfx::Vector2d(10, 10)); |
| 1226 executeCalculateDrawTransformsAndVisibility(root.get()); | 1226 executeCalculateDrawProperties(root.get()); |
| 1227 | 1227 |
| 1228 // The surface is translated by scrollDelta, the child transform doesn't cha
nge | 1228 // The surface is translated by scrollDelta, the child transform doesn't cha
nge |
| 1229 // because it scrolls along with the surface, but the fixed position grandCh
ild | 1229 // because it scrolls along with the surface, but the fixed position grandCh
ild |
| 1230 // needs to compensate for the scroll translation. | 1230 // needs to compensate for the scroll translation. |
| 1231 expectedSurfaceDrawTransform.MakeIdentity(); | 1231 expectedSurfaceDrawTransform.MakeIdentity(); |
| 1232 expectedSurfaceDrawTransform.Translate(-10, -10); | 1232 expectedSurfaceDrawTransform.Translate(-10, -10); |
| 1233 expectedGrandChildTransform.MakeIdentity(); | 1233 expectedGrandChildTransform.MakeIdentity(); |
| 1234 expectedGrandChildTransform.Translate(10, 10); | 1234 expectedGrandChildTransform.Translate(10, 10); |
| 1235 | 1235 |
| 1236 ASSERT_TRUE(child->renderSurface()); | 1236 ASSERT_TRUE(child->renderSurface()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1249 LayerImpl* grandChild = child->children()[0]; | 1249 LayerImpl* grandChild = child->children()[0]; |
| 1250 | 1250 |
| 1251 child->setIsContainerForFixedPositionLayers(true); | 1251 child->setIsContainerForFixedPositionLayers(true); |
| 1252 grandChild->setFixedToContainerLayer(true); | 1252 grandChild->setFixedToContainerLayer(true); |
| 1253 | 1253 |
| 1254 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). | 1254 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). |
| 1255 grandChild->setIsContainerForFixedPositionLayers(true); | 1255 grandChild->setIsContainerForFixedPositionLayers(true); |
| 1256 | 1256 |
| 1257 // Case 1: scrollDelta of 0, 0 | 1257 // Case 1: scrollDelta of 0, 0 |
| 1258 child->setScrollDelta(gfx::Vector2d(0, 0)); | 1258 child->setScrollDelta(gfx::Vector2d(0, 0)); |
| 1259 executeCalculateDrawTransformsAndVisibility(root.get()); | 1259 executeCalculateDrawProperties(root.get()); |
| 1260 | 1260 |
| 1261 gfx::Transform expectedChildTransform; | 1261 gfx::Transform expectedChildTransform; |
| 1262 gfx::Transform expectedGrandChildTransform; | 1262 gfx::Transform expectedGrandChildTransform; |
| 1263 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1263 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 1264 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1264 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1265 | 1265 |
| 1266 // Case 2: scrollDelta of 10, 10 | 1266 // Case 2: scrollDelta of 10, 10 |
| 1267 child->setScrollDelta(gfx::Vector2d(10, 10)); | 1267 child->setScrollDelta(gfx::Vector2d(10, 10)); |
| 1268 executeCalculateDrawTransformsAndVisibility(root.get()); | 1268 executeCalculateDrawProperties(root.get()); |
| 1269 | 1269 |
| 1270 // Here the child is affected by scrollDelta, but the fixed position grandCh
ild should not be affected. | 1270 // Here the child is affected by scrollDelta, but the fixed position grandCh
ild should not be affected. |
| 1271 expectedChildTransform.MakeIdentity(); | 1271 expectedChildTransform.MakeIdentity(); |
| 1272 expectedChildTransform.Translate(-10, -10); | 1272 expectedChildTransform.Translate(-10, -10); |
| 1273 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1273 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 1274 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1274 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
asNoContainer) | 1277 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
asNoContainer) |
| 1278 { | 1278 { |
| 1279 // This test checks scroll compensation when a fixed-position layer does not
find any | 1279 // This test checks scroll compensation when a fixed-position layer does not
find any |
| 1280 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should | 1280 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should |
| 1281 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. | 1281 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. |
| 1282 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1282 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 1283 LayerImpl* child = root->children()[0]; | 1283 LayerImpl* child = root->children()[0]; |
| 1284 LayerImpl* grandChild = child->children()[0]; | 1284 LayerImpl* grandChild = child->children()[0]; |
| 1285 | 1285 |
| 1286 gfx::Transform rotationByZ; | 1286 gfx::Transform rotationByZ; |
| 1287 MathUtil::rotateEulerAngles(&rotationByZ, 0, 0, 90); | 1287 MathUtil::rotateEulerAngles(&rotationByZ, 0, 0, 90); |
| 1288 | 1288 |
| 1289 root->setTransform(rotationByZ); | 1289 root->setTransform(rotationByZ); |
| 1290 grandChild->setFixedToContainerLayer(true); | 1290 grandChild->setFixedToContainerLayer(true); |
| 1291 | 1291 |
| 1292 // Case 1: root scrollDelta of 0, 0 | 1292 // Case 1: root scrollDelta of 0, 0 |
| 1293 root->setScrollDelta(gfx::Vector2d(0, 0)); | 1293 root->setScrollDelta(gfx::Vector2d(0, 0)); |
| 1294 executeCalculateDrawTransformsAndVisibility(root.get()); | 1294 executeCalculateDrawProperties(root.get()); |
| 1295 | 1295 |
| 1296 gfx::Transform identityMatrix; | 1296 gfx::Transform identityMatrix; |
| 1297 | 1297 |
| 1298 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); | 1298 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform()); |
| 1299 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; | 1299 EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform())
; |
| 1300 | 1300 |
| 1301 // Case 2: root scrollDelta of 10, 10 | 1301 // Case 2: root scrollDelta of 10, 10 |
| 1302 root->setScrollDelta(gfx::Vector2d(10, 20)); | 1302 root->setScrollDelta(gfx::Vector2d(10, 20)); |
| 1303 executeCalculateDrawTransformsAndVisibility(root.get()); | 1303 executeCalculateDrawProperties(root.get()); |
| 1304 | 1304 |
| 1305 // The child is affected by scrollDelta, but it is already implcitly account
ed for by | 1305 // The child is affected by scrollDelta, but it is already implcitly account
ed for by |
| 1306 // the child's target surface (i.e. the root renderSurface). The grandChild
is not | 1306 // the child's target surface (i.e. the root renderSurface). The grandChild
is not |
| 1307 // affected by the scrollDelta, so its drawTransform needs to explicitly | 1307 // affected by the scrollDelta, so its drawTransform needs to explicitly |
| 1308 // inverse-compensate for the scroll that's embedded in the target surface. | 1308 // inverse-compensate for the scroll that's embedded in the target surface. |
| 1309 gfx::Transform expectedGrandChildTransform; | 1309 gfx::Transform expectedGrandChildTransform; |
| 1310 expectedGrandChildTransform.PreconcatTransform(MathUtil::inverse(rotationByZ
)); | 1310 expectedGrandChildTransform.PreconcatTransform(MathUtil::inverse(rotationByZ
)); |
| 1311 expectedGrandChildTransform.Translate(10, 20); // explicit canceling out the
scrollDelta that gets embedded in the fixed position layer's surface. | 1311 expectedGrandChildTransform.Translate(10, 20); // explicit canceling out the
scrollDelta that gets embedded in the fixed position layer's surface. |
| 1312 expectedGrandChildTransform.PreconcatTransform(rotationByZ); | 1312 expectedGrandChildTransform.PreconcatTransform(rotationByZ); |
| 1313 | 1313 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false); | 1355 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false); |
| 1356 | 1356 |
| 1357 child->setMasksToBounds(true); | 1357 child->setMasksToBounds(true); |
| 1358 child->setOpacity(0.4f); | 1358 child->setOpacity(0.4f); |
| 1359 child->setForceRenderSurface(true); | 1359 child->setForceRenderSurface(true); |
| 1360 grandChild->setOpacity(0.5); | 1360 grandChild->setOpacity(0.5); |
| 1361 greatGrandChild->setOpacity(0.4f); | 1361 greatGrandChild->setOpacity(0.4f); |
| 1362 | 1362 |
| 1363 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1363 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 1364 int dummyMaxTextureSize = 512; | 1364 int dummyMaxTextureSize = 512; |
| 1365 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1365 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1366 | 1366 |
| 1367 ASSERT_EQ(2U, renderSurfaceLayerList.size()); | 1367 ASSERT_EQ(2U, renderSurfaceLayerList.size()); |
| 1368 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1368 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| 1369 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); | 1369 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) | 1372 TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) |
| 1373 { | 1373 { |
| 1374 // When a renderSurface has a clipRect, it is used to clip the contentRect | 1374 // When a renderSurface has a clipRect, it is used to clip the contentRect |
| 1375 // of the surface. When the renderSurface is animating its transforms, then | 1375 // of the surface. When the renderSurface is animating its transforms, then |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1402 setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix,
gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 1402 setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix,
gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
| 1403 | 1403 |
| 1404 parent->setMasksToBounds(true); | 1404 parent->setMasksToBounds(true); |
| 1405 child->setOpacity(0.4f); | 1405 child->setOpacity(0.4f); |
| 1406 child->setForceRenderSurface(true); | 1406 child->setForceRenderSurface(true); |
| 1407 grandChild->setOpacity(0.4f); | 1407 grandChild->setOpacity(0.4f); |
| 1408 grandChild->setForceRenderSurface(true); | 1408 grandChild->setForceRenderSurface(true); |
| 1409 | 1409 |
| 1410 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1410 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 1411 int dummyMaxTextureSize = 512; | 1411 int dummyMaxTextureSize = 512; |
| 1412 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1412 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1413 | 1413 |
| 1414 // Without an animation, we should cull child and grandChild from the render
SurfaceLayerList. | 1414 // Without an animation, we should cull child and grandChild from the render
SurfaceLayerList. |
| 1415 ASSERT_EQ(1U, renderSurfaceLayerList.size()); | 1415 ASSERT_EQ(1U, renderSurfaceLayerList.size()); |
| 1416 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1416 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| 1417 | 1417 |
| 1418 // Now put an animating transform on child. | 1418 // Now put an animating transform on child. |
| 1419 addAnimatedTransformToController(*child->layerAnimationController(), 10, 30,
0); | 1419 addAnimatedTransformToController(*child->layerAnimationController(), 10, 30,
0); |
| 1420 | 1420 |
| 1421 parent->clearRenderSurface(); | 1421 parent->clearRenderSurface(); |
| 1422 child->clearRenderSurface(); | 1422 child->clearRenderSurface(); |
| 1423 grandChild->clearRenderSurface(); | 1423 grandChild->clearRenderSurface(); |
| 1424 renderSurfaceLayerList.clear(); | 1424 renderSurfaceLayerList.clear(); |
| 1425 | 1425 |
| 1426 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1426 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1427 | 1427 |
| 1428 // With an animating transform, we should keep child and grandChild in the r
enderSurfaceLayerList. | 1428 // With an animating transform, we should keep child and grandChild in the r
enderSurfaceLayerList. |
| 1429 ASSERT_EQ(3U, renderSurfaceLayerList.size()); | 1429 ASSERT_EQ(3U, renderSurfaceLayerList.size()); |
| 1430 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1430 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| 1431 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); | 1431 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); |
| 1432 EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); | 1432 EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); |
| 1433 } | 1433 } |
| 1434 | 1434 |
| 1435 TEST(LayerTreeHostCommonTest, verifyIsClippedIsSetCorrectly) | 1435 TEST(LayerTreeHostCommonTest, verifyIsClippedIsSetCorrectly) |
| 1436 { | 1436 { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1468 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 1469 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1469 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 1470 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1470 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 1471 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1471 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 1472 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1472 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 1473 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1473 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 1474 | 1474 |
| 1475 // Case 1: nothing is clipped except the root renderSurface. | 1475 // Case 1: nothing is clipped except the root renderSurface. |
| 1476 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1476 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 1477 int dummyMaxTextureSize = 512; | 1477 int dummyMaxTextureSize = 512; |
| 1478 LayerTreeHostCommon::calculateDrawTransforms(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1478 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1479 | 1479 |
| 1480 ASSERT_TRUE(root->renderSurface()); | 1480 ASSERT_TRUE(root->renderSurface()); |
| 1481 ASSERT_TRUE(child2->renderSurface()); | 1481 ASSERT_TRUE(child2->renderSurface()); |
| 1482 | 1482 |
| 1483 EXPECT_FALSE(root->isClipped()); | 1483 EXPECT_FALSE(root->isClipped()); |
| 1484 EXPECT_TRUE(root->renderSurface()->isClipped()); | 1484 EXPECT_TRUE(root->renderSurface()->isClipped()); |
| 1485 EXPECT_FALSE(parent->isClipped()); | 1485 EXPECT_FALSE(parent->isClipped()); |
| 1486 EXPECT_FALSE(child1->isClipped()); | 1486 EXPECT_FALSE(child1->isClipped()); |
| 1487 EXPECT_FALSE(child2->isClipped()); | 1487 EXPECT_FALSE(child2->isClipped()); |
| 1488 EXPECT_FALSE(child2->renderSurface()->isClipped()); | 1488 EXPECT_FALSE(child2->renderSurface()->isClipped()); |
| 1489 EXPECT_FALSE(grandChild->isClipped()); | 1489 EXPECT_FALSE(grandChild->isClipped()); |
| 1490 EXPECT_FALSE(leafNode1->isClipped()); | 1490 EXPECT_FALSE(leafNode1->isClipped()); |
| 1491 EXPECT_FALSE(leafNode2->isClipped()); | 1491 EXPECT_FALSE(leafNode2->isClipped()); |
| 1492 | 1492 |
| 1493 // Case 2: parent masksToBounds, so the parent, child1, and child2's | 1493 // Case 2: parent masksToBounds, so the parent, child1, and child2's |
| 1494 // surface are clipped. But layers that contribute to child2's surface are | 1494 // surface are clipped. But layers that contribute to child2's surface are |
| 1495 // not clipped explicitly because child2's surface already accounts for | 1495 // not clipped explicitly because child2's surface already accounts for |
| 1496 // that clip. | 1496 // that clip. |
| 1497 renderSurfaceLayerList.clear(); | 1497 renderSurfaceLayerList.clear(); |
| 1498 parent->setMasksToBounds(true); | 1498 parent->setMasksToBounds(true); |
| 1499 LayerTreeHostCommon::calculateDrawTransforms(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1499 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1500 | 1500 |
| 1501 ASSERT_TRUE(root->renderSurface()); | 1501 ASSERT_TRUE(root->renderSurface()); |
| 1502 ASSERT_TRUE(child2->renderSurface()); | 1502 ASSERT_TRUE(child2->renderSurface()); |
| 1503 | 1503 |
| 1504 EXPECT_FALSE(root->isClipped()); | 1504 EXPECT_FALSE(root->isClipped()); |
| 1505 EXPECT_TRUE(root->renderSurface()->isClipped()); | 1505 EXPECT_TRUE(root->renderSurface()->isClipped()); |
| 1506 EXPECT_TRUE(parent->isClipped()); | 1506 EXPECT_TRUE(parent->isClipped()); |
| 1507 EXPECT_TRUE(child1->isClipped()); | 1507 EXPECT_TRUE(child1->isClipped()); |
| 1508 EXPECT_FALSE(child2->isClipped()); | 1508 EXPECT_FALSE(child2->isClipped()); |
| 1509 EXPECT_TRUE(child2->renderSurface()->isClipped()); | 1509 EXPECT_TRUE(child2->renderSurface()->isClipped()); |
| 1510 EXPECT_TRUE(grandChild->isClipped()); | 1510 EXPECT_TRUE(grandChild->isClipped()); |
| 1511 EXPECT_TRUE(leafNode1->isClipped()); | 1511 EXPECT_TRUE(leafNode1->isClipped()); |
| 1512 EXPECT_FALSE(leafNode2->isClipped()); | 1512 EXPECT_FALSE(leafNode2->isClipped()); |
| 1513 | 1513 |
| 1514 // Case 3: child2 masksToBounds. The layer and subtree are clipped, and | 1514 // Case 3: child2 masksToBounds. The layer and subtree are clipped, and |
| 1515 // child2's renderSurface is not clipped. | 1515 // child2's renderSurface is not clipped. |
| 1516 renderSurfaceLayerList.clear(); | 1516 renderSurfaceLayerList.clear(); |
| 1517 parent->setMasksToBounds(false); | 1517 parent->setMasksToBounds(false); |
| 1518 child2->setMasksToBounds(true); | 1518 child2->setMasksToBounds(true); |
| 1519 LayerTreeHostCommon::calculateDrawTransforms(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1519 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1520 | 1520 |
| 1521 ASSERT_TRUE(root->renderSurface()); | 1521 ASSERT_TRUE(root->renderSurface()); |
| 1522 ASSERT_TRUE(child2->renderSurface()); | 1522 ASSERT_TRUE(child2->renderSurface()); |
| 1523 | 1523 |
| 1524 EXPECT_FALSE(root->isClipped()); | 1524 EXPECT_FALSE(root->isClipped()); |
| 1525 EXPECT_TRUE(root->renderSurface()->isClipped()); | 1525 EXPECT_TRUE(root->renderSurface()->isClipped()); |
| 1526 EXPECT_FALSE(parent->isClipped()); | 1526 EXPECT_FALSE(parent->isClipped()); |
| 1527 EXPECT_FALSE(child1->isClipped()); | 1527 EXPECT_FALSE(child1->isClipped()); |
| 1528 EXPECT_TRUE(child2->isClipped()); | 1528 EXPECT_TRUE(child2->isClipped()); |
| 1529 EXPECT_FALSE(child2->renderSurface()->isClipped()); | 1529 EXPECT_FALSE(child2->renderSurface()->isClipped()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 | 1568 |
| 1569 // Force everyone to be a render surface. | 1569 // Force everyone to be a render surface. |
| 1570 child->setOpacity(0.4f); | 1570 child->setOpacity(0.4f); |
| 1571 grandChild1->setOpacity(0.5); | 1571 grandChild1->setOpacity(0.5); |
| 1572 grandChild2->setOpacity(0.5); | 1572 grandChild2->setOpacity(0.5); |
| 1573 grandChild3->setOpacity(0.5); | 1573 grandChild3->setOpacity(0.5); |
| 1574 grandChild4->setOpacity(0.5); | 1574 grandChild4->setOpacity(0.5); |
| 1575 | 1575 |
| 1576 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1576 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 1577 int dummyMaxTextureSize = 512; | 1577 int dummyMaxTextureSize = 512; |
| 1578 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1578 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1579 | 1579 |
| 1580 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(5, 5), gfx::Size(10, 10)), grandChild1->
drawableContentRect()); | 1580 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(5, 5), gfx::Size(10, 10)), grandChild1->
drawableContentRect()); |
| 1581 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); | 1581 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); |
| 1582 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); | 1582 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); |
| 1583 EXPECT_TRUE(grandChild4->drawableContentRect().IsEmpty()); | 1583 EXPECT_TRUE(grandChild4->drawableContentRect().IsEmpty()); |
| 1584 } | 1584 } |
| 1585 | 1585 |
| 1586 TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) | 1586 TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) |
| 1587 { | 1587 { |
| 1588 // Verify that renderSurfaces (and their layers) get the appropriate clipRec
ts when their parent masksToBounds is true. | 1588 // Verify that renderSurfaces (and their layers) get the appropriate clipRec
ts when their parent masksToBounds is true. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 grandChild1->setForceRenderSurface(true); | 1638 grandChild1->setForceRenderSurface(true); |
| 1639 grandChild2->setOpacity(0.5); | 1639 grandChild2->setOpacity(0.5); |
| 1640 grandChild2->setForceRenderSurface(true); | 1640 grandChild2->setForceRenderSurface(true); |
| 1641 grandChild3->setOpacity(0.5); | 1641 grandChild3->setOpacity(0.5); |
| 1642 grandChild3->setForceRenderSurface(true); | 1642 grandChild3->setForceRenderSurface(true); |
| 1643 grandChild4->setOpacity(0.5); | 1643 grandChild4->setOpacity(0.5); |
| 1644 grandChild4->setForceRenderSurface(true); | 1644 grandChild4->setForceRenderSurface(true); |
| 1645 | 1645 |
| 1646 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1646 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 1647 int dummyMaxTextureSize = 512; | 1647 int dummyMaxTextureSize = 512; |
| 1648 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1648 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1649 | 1649 |
| 1650 ASSERT_TRUE(grandChild1->renderSurface()); | 1650 ASSERT_TRUE(grandChild1->renderSurface()); |
| 1651 ASSERT_TRUE(grandChild2->renderSurface()); | 1651 ASSERT_TRUE(grandChild2->renderSurface()); |
| 1652 ASSERT_TRUE(grandChild3->renderSurface()); | 1652 ASSERT_TRUE(grandChild3->renderSurface()); |
| 1653 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. | 1653 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. |
| 1654 | 1654 |
| 1655 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. | 1655 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. |
| 1656 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild1->
renderSurface()->clipRect()); | 1656 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild1->
renderSurface()->clipRect()); |
| 1657 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild2->
renderSurface()->clipRect()); | 1657 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild2->
renderSurface()->clipRect()); |
| 1658 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild3->
renderSurface()->clipRect()); | 1658 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild3->
renderSurface()->clipRect()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform
, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1703 setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform
, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1704 setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerT
ransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1704 setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerT
ransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1705 setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerT
ransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1705 setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerT
ransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1706 setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTran
sform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1706 setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTran
sform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1707 setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1707 setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1708 setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1708 setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTrans
form, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1709 setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublaye
rTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false)
; | 1709 setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublaye
rTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false)
; |
| 1710 setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1710 setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1711 setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); | 1711 setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayer
Transform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false); |
| 1712 | 1712 |
| 1713 executeCalculateDrawTransformsAndVisibility(parent.get()); | 1713 executeCalculateDrawProperties(parent.get()); |
| 1714 | 1714 |
| 1715 // Only layers that are associated with render surfaces should have an actua
l renderSurface() value. | 1715 // Only layers that are associated with render surfaces should have an actua
l renderSurface() value. |
| 1716 // | 1716 // |
| 1717 ASSERT_TRUE(parent->renderSurface()); | 1717 ASSERT_TRUE(parent->renderSurface()); |
| 1718 ASSERT_FALSE(childOfRoot->renderSurface()); | 1718 ASSERT_FALSE(childOfRoot->renderSurface()); |
| 1719 ASSERT_FALSE(grandChildOfRoot->renderSurface()); | 1719 ASSERT_FALSE(grandChildOfRoot->renderSurface()); |
| 1720 | 1720 |
| 1721 ASSERT_TRUE(renderSurface1->renderSurface()); | 1721 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 1722 ASSERT_FALSE(childOfRS1->renderSurface()); | 1722 ASSERT_FALSE(childOfRS1->renderSurface()); |
| 1723 ASSERT_FALSE(grandChildOfRS1->renderSurface()); | 1723 ASSERT_FALSE(grandChildOfRS1->renderSurface()); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 root->addChild(child1); | 2066 root->addChild(child1); |
| 2067 root->addChild(child2); | 2067 root->addChild(child2); |
| 2068 root->addChild(child3); | 2068 root->addChild(child3); |
| 2069 | 2069 |
| 2070 gfx::Transform identityMatrix; | 2070 gfx::Transform identityMatrix; |
| 2071 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2071 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2072 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false); | 2072 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false); |
| 2073 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); | 2073 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); |
| 2074 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); | 2074 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); |
| 2075 | 2075 |
| 2076 executeCalculateDrawTransformsAndVisibility(root.get()); | 2076 executeCalculateDrawProperties(root.get()); |
| 2077 | 2077 |
| 2078 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); | 2078 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); |
| 2079 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); | 2079 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); |
| 2080 | 2080 |
| 2081 // Layers that do not draw content should have empty visibleContentRects. | 2081 // Layers that do not draw content should have empty visibleContentRects. |
| 2082 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); | 2082 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); |
| 2083 | 2083 |
| 2084 // layer visibleContentRects are clipped by their targetSurface | 2084 // layer visibleContentRects are clipped by their targetSurface |
| 2085 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect()); | 2085 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect()); |
| 2086 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visibleContentRect()); | 2086 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visibleContentRect()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2105 child->addChild(grandChild3); | 2105 child->addChild(grandChild3); |
| 2106 | 2106 |
| 2107 gfx::Transform identityMatrix; | 2107 gfx::Transform identityMatrix; |
| 2108 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2108 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2109 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2109 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2110 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); | 2110 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); |
| 2111 setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); | 2111 setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); |
| 2112 setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); | 2112 setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatr
ix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); |
| 2113 | 2113 |
| 2114 child->setMasksToBounds(true); | 2114 child->setMasksToBounds(true); |
| 2115 executeCalculateDrawTransformsAndVisibility(root.get()); | 2115 executeCalculateDrawProperties(root.get()); |
| 2116 | 2116 |
| 2117 ASSERT_FALSE(child->renderSurface()); | 2117 ASSERT_FALSE(child->renderSurface()); |
| 2118 | 2118 |
| 2119 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); | 2119 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); |
| 2120 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); | 2120 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); |
| 2121 | 2121 |
| 2122 // Layers that do not draw content should have empty visibleContentRects. | 2122 // Layers that do not draw content should have empty visibleContentRects. |
| 2123 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); | 2123 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); |
| 2124 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), child->visibleContentRect()); | 2124 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), child->visibleContentRect()); |
| 2125 | 2125 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2147 renderSurface1->addChild(child3); | 2147 renderSurface1->addChild(child3); |
| 2148 | 2148 |
| 2149 gfx::Transform identityMatrix; | 2149 gfx::Transform identityMatrix; |
| 2150 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2150 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2151 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); | 2151 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); |
| 2152 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); | 2152 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); |
| 2153 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); | 2153 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); |
| 2154 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); | 2154 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); |
| 2155 | 2155 |
| 2156 renderSurface1->setForceRenderSurface(true); | 2156 renderSurface1->setForceRenderSurface(true); |
| 2157 executeCalculateDrawTransformsAndVisibility(root.get()); | 2157 executeCalculateDrawProperties(root.get()); |
| 2158 | 2158 |
| 2159 ASSERT_TRUE(renderSurface1->renderSurface()); | 2159 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2160 | 2160 |
| 2161 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); | 2161 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); |
| 2162 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); | 2162 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); |
| 2163 | 2163 |
| 2164 // Layers that do not draw content should have empty visibleContentRects. | 2164 // Layers that do not draw content should have empty visibleContentRects. |
| 2165 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); | 2165 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); |
| 2166 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2166 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| 2167 | 2167 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2192 | 2192 |
| 2193 gfx::Transform identityMatrix; | 2193 gfx::Transform identityMatrix; |
| 2194 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2194 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2195 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); | 2195 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); |
| 2196 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); | 2196 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); |
| 2197 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); | 2197 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); |
| 2198 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); | 2198 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); |
| 2199 | 2199 |
| 2200 root->setMasksToBounds(true); | 2200 root->setMasksToBounds(true); |
| 2201 renderSurface1->setForceRenderSurface(true); | 2201 renderSurface1->setForceRenderSurface(true); |
| 2202 executeCalculateDrawTransformsAndVisibility(root.get()); | 2202 executeCalculateDrawProperties(root.get()); |
| 2203 | 2203 |
| 2204 ASSERT_TRUE(renderSurface1->renderSurface()); | 2204 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2205 | 2205 |
| 2206 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); | 2206 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); |
| 2207 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); | 2207 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); |
| 2208 | 2208 |
| 2209 // Layers that do not draw content should have empty visibleContentRects. | 2209 // Layers that do not draw content should have empty visibleContentRects. |
| 2210 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); | 2210 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); |
| 2211 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2211 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| 2212 | 2212 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2244 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2245 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); | 2245 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); |
| 2246 setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(7, 13), false); | 2246 setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(7, 13), false); |
| 2247 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); | 2247 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false); |
| 2248 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); | 2248 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false); |
| 2249 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); | 2249 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false); |
| 2250 | 2250 |
| 2251 root->setMasksToBounds(true); | 2251 root->setMasksToBounds(true); |
| 2252 renderSurface1->setForceRenderSurface(true); | 2252 renderSurface1->setForceRenderSurface(true); |
| 2253 renderSurface2->setForceRenderSurface(true); | 2253 renderSurface2->setForceRenderSurface(true); |
| 2254 executeCalculateDrawTransformsAndVisibility(root.get()); | 2254 executeCalculateDrawProperties(root.get()); |
| 2255 | 2255 |
| 2256 ASSERT_TRUE(renderSurface1->renderSurface()); | 2256 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2257 ASSERT_TRUE(renderSurface2->renderSurface()); | 2257 ASSERT_TRUE(renderSurface2->renderSurface()); |
| 2258 | 2258 |
| 2259 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); | 2259 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); |
| 2260 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); | 2260 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); |
| 2261 | 2261 |
| 2262 // Layers that do not draw content should have empty visibleContentRects. | 2262 // Layers that do not draw content should have empty visibleContentRects. |
| 2263 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); | 2263 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); |
| 2264 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2264 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2296 renderSurface1->addChild(child1); | 2296 renderSurface1->addChild(child1); |
| 2297 | 2297 |
| 2298 gfx::Transform identityMatrix; | 2298 gfx::Transform identityMatrix; |
| 2299 gfx::Transform childRotation; | 2299 gfx::Transform childRotation; |
| 2300 childRotation.Rotate(45); | 2300 childRotation.Rotate(45); |
| 2301 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2301 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2302 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); | 2302 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); |
| 2303 setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gf
x::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false); | 2303 setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gf
x::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false); |
| 2304 | 2304 |
| 2305 renderSurface1->setForceRenderSurface(true); | 2305 renderSurface1->setForceRenderSurface(true); |
| 2306 executeCalculateDrawTransformsAndVisibility(root.get()); | 2306 executeCalculateDrawProperties(root.get()); |
| 2307 | 2307 |
| 2308 ASSERT_TRUE(renderSurface1->renderSurface()); | 2308 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2309 | 2309 |
| 2310 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); | 2310 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableCon
tentRect()); |
| 2311 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); | 2311 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect()); |
| 2312 | 2312 |
| 2313 // Layers that do not draw content should have empty visibleContentRects. | 2313 // Layers that do not draw content should have empty visibleContentRects. |
| 2314 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); | 2314 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect()); |
| 2315 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2315 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| 2316 | 2316 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2337 | 2337 |
| 2338 gfx::Transform identityMatrix; | 2338 gfx::Transform identityMatrix; |
| 2339 gfx::Transform childRotation; | 2339 gfx::Transform childRotation; |
| 2340 childRotation.Rotate(45); | 2340 childRotation.Rotate(45); |
| 2341 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false); | 2341 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false); |
| 2342 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); | 2342 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false); |
| 2343 setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gf
x::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false); | 2343 setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gf
x::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false); |
| 2344 | 2344 |
| 2345 root->setMasksToBounds(true); | 2345 root->setMasksToBounds(true); |
| 2346 renderSurface1->setForceRenderSurface(true); | 2346 renderSurface1->setForceRenderSurface(true); |
| 2347 executeCalculateDrawTransformsAndVisibility(root.get()); | 2347 executeCalculateDrawProperties(root.get()); |
| 2348 | 2348 |
| 2349 ASSERT_TRUE(renderSurface1->renderSurface()); | 2349 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2350 | 2350 |
| 2351 // The clipped surface clamps the drawableContentRect that encloses the rota
ted layer. | 2351 // The clipped surface clamps the drawableContentRect that encloses the rota
ted layer. |
| 2352 int diagonalRadius = ceil(sqrt(2.0) * 25); | 2352 int diagonalRadius = ceil(sqrt(2.0) * 25); |
| 2353 gfx::Rect unclippedSurfaceContent = gfx::Rect(50 - diagonalRadius, 50 - diag
onalRadius, diagonalRadius * 2, diagonalRadius * 2); | 2353 gfx::Rect unclippedSurfaceContent = gfx::Rect(50 - diagonalRadius, 50 - diag
onalRadius, diagonalRadius * 2, diagonalRadius * 2); |
| 2354 gfx::Rect expectedSurfaceDrawableContent = gfx::IntersectRects(unclippedSurf
aceContent, gfx::Rect(0, 0, 50, 50)); | 2354 gfx::Rect expectedSurfaceDrawableContent = gfx::IntersectRects(unclippedSurf
aceContent, gfx::Rect(0, 0, 50, 50)); |
| 2355 EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface
()->drawableContentRect()); | 2355 EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface
()->drawableContentRect()); |
| 2356 | 2356 |
| 2357 // On the clipped surface, only a quarter of the child1 is visible, but whe
n rotating | 2357 // On the clipped surface, only a quarter of the child1 is visible, but whe
n rotating |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 root->setContentsScale(deviceScaleFactor); | 2391 root->setContentsScale(deviceScaleFactor); |
| 2392 renderSurface1->setContentsScale(deviceScaleFactor); | 2392 renderSurface1->setContentsScale(deviceScaleFactor); |
| 2393 renderSurface2->setContentsScale(deviceScaleFactor); | 2393 renderSurface2->setContentsScale(deviceScaleFactor); |
| 2394 child1->setContentsScale(deviceScaleFactor); | 2394 child1->setContentsScale(deviceScaleFactor); |
| 2395 child2->setContentsScale(deviceScaleFactor); | 2395 child2->setContentsScale(deviceScaleFactor); |
| 2396 child3->setContentsScale(deviceScaleFactor); | 2396 child3->setContentsScale(deviceScaleFactor); |
| 2397 | 2397 |
| 2398 root->setMasksToBounds(true); | 2398 root->setMasksToBounds(true); |
| 2399 renderSurface1->setForceRenderSurface(true); | 2399 renderSurface1->setForceRenderSurface(true); |
| 2400 renderSurface2->setForceRenderSurface(true); | 2400 renderSurface2->setForceRenderSurface(true); |
| 2401 executeCalculateDrawTransformsAndVisibility(root.get(), deviceScaleFactor); | 2401 executeCalculateDrawProperties(root.get(), deviceScaleFactor); |
| 2402 | 2402 |
| 2403 ASSERT_TRUE(renderSurface1->renderSurface()); | 2403 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2404 ASSERT_TRUE(renderSurface2->renderSurface()); | 2404 ASSERT_TRUE(renderSurface2->renderSurface()); |
| 2405 | 2405 |
| 2406 // DrawableContentRects for all layers and surfaces are scaled by deviceScal
eFactor. | 2406 // DrawableContentRects for all layers and surfaces are scaled by deviceScal
eFactor. |
| 2407 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->renderSurface()->drawableCon
tentRect()); | 2407 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->renderSurface()->drawableCon
tentRect()); |
| 2408 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->drawableContentRect()); | 2408 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->drawableContentRect()); |
| 2409 EXPECT_RECT_EQ(gfx::Rect(10, 10, 190, 190), renderSurface1->renderSurface()-
>drawableContentRect()); | 2409 EXPECT_RECT_EQ(gfx::Rect(10, 10, 190, 190), renderSurface1->renderSurface()-
>drawableContentRect()); |
| 2410 | 2410 |
| 2411 // renderSurface2 lives in the "unclipped universe" of renderSurface1, and | 2411 // renderSurface2 lives in the "unclipped universe" of renderSurface1, and |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2480 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2481 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2481 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2482 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2482 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2483 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); | 2483 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); |
| 2484 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2484 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
| 2485 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2485 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
| 2486 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2486 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
| 2487 | 2487 |
| 2488 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2488 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 2489 int dummyMaxTextureSize = 512; | 2489 int dummyMaxTextureSize = 512; |
| 2490 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2490 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2491 | 2491 |
| 2492 // Verify which renderSurfaces were created. | 2492 // Verify which renderSurfaces were created. |
| 2493 EXPECT_FALSE(frontFacingChild->renderSurface()); | 2493 EXPECT_FALSE(frontFacingChild->renderSurface()); |
| 2494 EXPECT_FALSE(backFacingChild->renderSurface()); | 2494 EXPECT_FALSE(backFacingChild->renderSurface()); |
| 2495 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2495 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
| 2496 EXPECT_TRUE(backFacingSurface->renderSurface()); | 2496 EXPECT_TRUE(backFacingSurface->renderSurface()); |
| 2497 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); | 2497 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); |
| 2498 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); | 2498 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); |
| 2499 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); | 2499 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); |
| 2500 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); | 2500 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2579 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2579 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2580 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); //
surface transform style is preserve-3d. | 2580 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); //
surface transform style is preserve-3d. |
| 2581 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // s
urface transform style is preserve-3d. | 2581 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // s
urface transform style is preserve-3d. |
| 2582 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); | 2582 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); |
| 2583 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2583 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
| 2584 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2584 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
| 2585 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2585 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
| 2586 | 2586 |
| 2587 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2587 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 2588 int dummyMaxTextureSize = 512; | 2588 int dummyMaxTextureSize = 512; |
| 2589 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2589 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2590 | 2590 |
| 2591 // Verify which renderSurfaces were created. | 2591 // Verify which renderSurfaces were created. |
| 2592 EXPECT_FALSE(frontFacingChild->renderSurface()); | 2592 EXPECT_FALSE(frontFacingChild->renderSurface()); |
| 2593 EXPECT_FALSE(backFacingChild->renderSurface()); | 2593 EXPECT_FALSE(backFacingChild->renderSurface()); |
| 2594 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2594 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
| 2595 EXPECT_FALSE(backFacingSurface->renderSurface()); | 2595 EXPECT_FALSE(backFacingSurface->renderSurface()); |
| 2596 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); | 2596 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); |
| 2597 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); | 2597 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); |
| 2598 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); | 2598 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); |
| 2599 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); | 2599 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2659 | 2659 |
| 2660 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2660 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2661 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2661 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2662 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2662 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2663 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false
); | 2663 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false
); |
| 2664 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2664 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2665 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2665 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2666 | 2666 |
| 2667 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2667 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 2668 int dummyMaxTextureSize = 512; | 2668 int dummyMaxTextureSize = 512; |
| 2669 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2669 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2670 | 2670 |
| 2671 EXPECT_FALSE(child->renderSurface()); | 2671 EXPECT_FALSE(child->renderSurface()); |
| 2672 EXPECT_TRUE(animatingSurface->renderSurface()); | 2672 EXPECT_TRUE(animatingSurface->renderSurface()); |
| 2673 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); | 2673 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); |
| 2674 EXPECT_FALSE(animatingChild->renderSurface()); | 2674 EXPECT_FALSE(animatingChild->renderSurface()); |
| 2675 EXPECT_FALSE(child2->renderSurface()); | 2675 EXPECT_FALSE(child2->renderSurface()); |
| 2676 | 2676 |
| 2677 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. | 2677 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. |
| 2678 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 2678 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
| 2679 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 2679 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2725 backfaceMatrix.Translate(-50, -50); | 2725 backfaceMatrix.Translate(-50, -50); |
| 2726 | 2726 |
| 2727 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // parent trans
form style is preserve3d. | 2727 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // parent trans
form style is preserve3d. |
| 2728 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. | 2728 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. |
| 2729 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. | 2729 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. |
| 2730 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2730 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2731 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2731 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2732 | 2732 |
| 2733 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2733 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 2734 int dummyMaxTextureSize = 512; | 2734 int dummyMaxTextureSize = 512; |
| 2735 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2735 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2736 | 2736 |
| 2737 // Verify which renderSurfaces were created. | 2737 // Verify which renderSurfaces were created. |
| 2738 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2738 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
| 2739 EXPECT_FALSE(backFacingSurface->renderSurface()); // because it should be cu
lled | 2739 EXPECT_FALSE(backFacingSurface->renderSurface()); // because it should be cu
lled |
| 2740 EXPECT_FALSE(child1->renderSurface()); | 2740 EXPECT_FALSE(child1->renderSurface()); |
| 2741 EXPECT_FALSE(child2->renderSurface()); | 2741 EXPECT_FALSE(child2->renderSurface()); |
| 2742 | 2742 |
| 2743 // Verify the renderSurfaceLayerList. The back-facing surface should be cull
ed. | 2743 // Verify the renderSurfaceLayerList. The back-facing surface should be cull
ed. |
| 2744 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 2744 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
| 2745 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 2745 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2775 | 2775 |
| 2776 gfx::Transform identityMatrix; | 2776 gfx::Transform identityMatrix; |
| 2777 gfx::PointF anchor(0, 0); | 2777 gfx::PointF anchor(0, 0); |
| 2778 gfx::PointF position(0, 0); | 2778 gfx::PointF position(0, 0); |
| 2779 gfx::Size bounds(100, 100); | 2779 gfx::Size bounds(100, 100); |
| 2780 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2780 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 2781 root->setDrawsContent(true); | 2781 root->setDrawsContent(true); |
| 2782 | 2782 |
| 2783 std::vector<LayerImpl*> renderSurfaceLayerList; | 2783 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2784 int dummyMaxTextureSize = 512; | 2784 int dummyMaxTextureSize = 512; |
| 2785 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2785 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2786 | 2786 |
| 2787 // Sanity check the scenario we just created. | 2787 // Sanity check the scenario we just created. |
| 2788 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2788 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2789 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2789 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2790 | 2790 |
| 2791 // Hit testing for a point outside the layer should return a null pointer. | 2791 // Hit testing for a point outside the layer should return a null pointer. |
| 2792 gfx::Point testPoint(101, 101); | 2792 gfx::Point testPoint(101, 101); |
| 2793 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2793 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 2794 EXPECT_FALSE(resultLayer); | 2794 EXPECT_FALSE(resultLayer); |
| 2795 | 2795 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2822 | 2822 |
| 2823 gfx::Transform identityMatrix; | 2823 gfx::Transform identityMatrix; |
| 2824 gfx::PointF anchor(0, 0); | 2824 gfx::PointF anchor(0, 0); |
| 2825 gfx::PointF position(0, 0); | 2825 gfx::PointF position(0, 0); |
| 2826 gfx::Size bounds(100, 100); | 2826 gfx::Size bounds(100, 100); |
| 2827 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 2827 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
| 2828 root->setDrawsContent(true); | 2828 root->setDrawsContent(true); |
| 2829 | 2829 |
| 2830 std::vector<LayerImpl*> renderSurfaceLayerList; | 2830 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2831 int dummyMaxTextureSize = 512; | 2831 int dummyMaxTextureSize = 512; |
| 2832 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2832 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2833 | 2833 |
| 2834 // Sanity check the scenario we just created. | 2834 // Sanity check the scenario we just created. |
| 2835 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2835 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2836 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2836 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2837 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); | 2837 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); |
| 2838 | 2838 |
| 2839 // Hit testing any point should not hit the layer. If the invertible matrix
is | 2839 // Hit testing any point should not hit the layer. If the invertible matrix
is |
| 2840 // accidentally ignored and treated like an identity, then the hit testing w
ill | 2840 // accidentally ignored and treated like an identity, then the hit testing w
ill |
| 2841 // incorrectly hit the layer when it shouldn't. | 2841 // incorrectly hit the layer when it shouldn't. |
| 2842 gfx::Point testPoint(1, 1); | 2842 gfx::Point testPoint(1, 1); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2874 | 2874 |
| 2875 gfx::Transform identityMatrix; | 2875 gfx::Transform identityMatrix; |
| 2876 gfx::PointF anchor(0, 0); | 2876 gfx::PointF anchor(0, 0); |
| 2877 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. | 2877 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. |
| 2878 gfx::Size bounds(100, 100); | 2878 gfx::Size bounds(100, 100); |
| 2879 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2879 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 2880 root->setDrawsContent(true); | 2880 root->setDrawsContent(true); |
| 2881 | 2881 |
| 2882 std::vector<LayerImpl*> renderSurfaceLayerList; | 2882 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2883 int dummyMaxTextureSize = 512; | 2883 int dummyMaxTextureSize = 512; |
| 2884 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2884 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2885 | 2885 |
| 2886 // Sanity check the scenario we just created. | 2886 // Sanity check the scenario we just created. |
| 2887 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2887 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2888 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2888 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2889 | 2889 |
| 2890 // Hit testing for a point outside the layer should return a null pointer. | 2890 // Hit testing for a point outside the layer should return a null pointer. |
| 2891 gfx::Point testPoint(49, 49); | 2891 gfx::Point testPoint(49, 49); |
| 2892 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2892 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 2893 EXPECT_FALSE(resultLayer); | 2893 EXPECT_FALSE(resultLayer); |
| 2894 | 2894 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2919 MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45); | 2919 MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45); |
| 2920 rotation45DegreesAboutCenter.Translate(-50, -50); | 2920 rotation45DegreesAboutCenter.Translate(-50, -50); |
| 2921 gfx::PointF anchor(0, 0); | 2921 gfx::PointF anchor(0, 0); |
| 2922 gfx::PointF position(0, 0); | 2922 gfx::PointF position(0, 0); |
| 2923 gfx::Size bounds(100, 100); | 2923 gfx::Size bounds(100, 100); |
| 2924 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); | 2924 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); |
| 2925 root->setDrawsContent(true); | 2925 root->setDrawsContent(true); |
| 2926 | 2926 |
| 2927 std::vector<LayerImpl*> renderSurfaceLayerList; | 2927 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2928 int dummyMaxTextureSize = 512; | 2928 int dummyMaxTextureSize = 512; |
| 2929 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2929 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2930 | 2930 |
| 2931 // Sanity check the scenario we just created. | 2931 // Sanity check the scenario we just created. |
| 2932 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2932 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2933 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2933 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2934 | 2934 |
| 2935 // Hit testing for points outside the layer. | 2935 // Hit testing for points outside the layer. |
| 2936 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 2936 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
| 2937 gfx::Point testPoint(99, 99); | 2937 gfx::Point testPoint(99, 99); |
| 2938 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2938 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 2939 EXPECT_FALSE(resultLayer); | 2939 EXPECT_FALSE(resultLayer); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2973 translationByZ.Translate3d(0, 0, -1); | 2973 translationByZ.Translate3d(0, 0, -1); |
| 2974 | 2974 |
| 2975 gfx::PointF anchor(0, 0); | 2975 gfx::PointF anchor(0, 0); |
| 2976 gfx::PointF position(0, 0); | 2976 gfx::PointF position(0, 0); |
| 2977 gfx::Size bounds(100, 100); | 2977 gfx::Size bounds(100, 100); |
| 2978 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); | 2978 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); |
| 2979 root->setDrawsContent(true); | 2979 root->setDrawsContent(true); |
| 2980 | 2980 |
| 2981 std::vector<LayerImpl*> renderSurfaceLayerList; | 2981 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2982 int dummyMaxTextureSize = 512; | 2982 int dummyMaxTextureSize = 512; |
| 2983 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2983 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2984 | 2984 |
| 2985 // Sanity check the scenario we just created. | 2985 // Sanity check the scenario we just created. |
| 2986 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2986 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2987 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2987 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2988 | 2988 |
| 2989 // Hit testing for points outside the layer. | 2989 // Hit testing for points outside the layer. |
| 2990 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 2990 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
| 2991 gfx::Point testPoint(24, 24); | 2991 gfx::Point testPoint(24, 24); |
| 2992 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2992 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 2993 EXPECT_FALSE(resultLayer); | 2993 EXPECT_FALSE(resultLayer); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3036 // override contentBounds and contentsScale | 3036 // override contentBounds and contentsScale |
| 3037 testLayer->setContentBounds(gfx::Size(100, 100)); | 3037 testLayer->setContentBounds(gfx::Size(100, 100)); |
| 3038 testLayer->setContentsScale(2, 2); | 3038 testLayer->setContentsScale(2, 2); |
| 3039 | 3039 |
| 3040 testLayer->setDrawsContent(true); | 3040 testLayer->setDrawsContent(true); |
| 3041 root->addChild(testLayer.Pass()); | 3041 root->addChild(testLayer.Pass()); |
| 3042 } | 3042 } |
| 3043 | 3043 |
| 3044 std::vector<LayerImpl*> renderSurfaceLayerList; | 3044 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3045 int dummyMaxTextureSize = 512; | 3045 int dummyMaxTextureSize = 512; |
| 3046 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3046 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3047 | 3047 |
| 3048 // Sanity check the scenario we just created. | 3048 // Sanity check the scenario we just created. |
| 3049 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3049 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
| 3050 LayerImpl* testLayer = root->children()[0]; | 3050 LayerImpl* testLayer = root->children()[0]; |
| 3051 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); | 3051 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); |
| 3052 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3052 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3053 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3053 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3054 | 3054 |
| 3055 // Hit testing for a point outside the layer should return a null pointer (t
he root layer does not draw content, so it will not be hit tested either). | 3055 // Hit testing for a point outside the layer should return a null pointer (t
he root layer does not draw content, so it will not be hit tested either). |
| 3056 gfx::Point testPoint(101, 101); | 3056 gfx::Point testPoint(101, 101); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3098 position = gfx::PointF(-50, -50); | 3098 position = gfx::PointF(-50, -50); |
| 3099 bounds = gfx::Size(300, 300); | 3099 bounds = gfx::Size(300, 300); |
| 3100 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3100 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 3101 child->setDrawsContent(true); | 3101 child->setDrawsContent(true); |
| 3102 clippingLayer->addChild(child.Pass()); | 3102 clippingLayer->addChild(child.Pass()); |
| 3103 root->addChild(clippingLayer.Pass()); | 3103 root->addChild(clippingLayer.Pass()); |
| 3104 } | 3104 } |
| 3105 | 3105 |
| 3106 std::vector<LayerImpl*> renderSurfaceLayerList; | 3106 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3107 int dummyMaxTextureSize = 512; | 3107 int dummyMaxTextureSize = 512; |
| 3108 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3108 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3109 | 3109 |
| 3110 // Sanity check the scenario we just created. | 3110 // Sanity check the scenario we just created. |
| 3111 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3111 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3112 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3112 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3113 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3113 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 3114 | 3114 |
| 3115 // Hit testing for a point outside the layer should return a null pointer. | 3115 // Hit testing for a point outside the layer should return a null pointer. |
| 3116 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 3116 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
| 3117 gfx::Point testPoint(24, 24); | 3117 gfx::Point testPoint(24, 24); |
| 3118 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3118 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3186 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); | 3186 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); |
| 3187 rotatedLeaf->setDrawsContent(true); | 3187 rotatedLeaf->setDrawsContent(true); |
| 3188 | 3188 |
| 3189 grandChild->addChild(rotatedLeaf.Pass()); | 3189 grandChild->addChild(rotatedLeaf.Pass()); |
| 3190 child->addChild(grandChild.Pass()); | 3190 child->addChild(grandChild.Pass()); |
| 3191 root->addChild(child.Pass()); | 3191 root->addChild(child.Pass()); |
| 3192 } | 3192 } |
| 3193 | 3193 |
| 3194 std::vector<LayerImpl*> renderSurfaceLayerList; | 3194 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3195 int dummyMaxTextureSize = 512; | 3195 int dummyMaxTextureSize = 512; |
| 3196 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3196 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3197 | 3197 |
| 3198 // Sanity check the scenario we just created. | 3198 // Sanity check the scenario we just created. |
| 3199 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. | 3199 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. |
| 3200 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 3200 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
| 3201 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); | 3201 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); |
| 3202 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. | 3202 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. |
| 3203 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); | 3203 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); |
| 3204 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); | 3204 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); |
| 3205 | 3205 |
| 3206 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. | 3206 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3266 position = gfx::PointF(60, 60); // 70, 70 in screen space | 3266 position = gfx::PointF(60, 60); // 70, 70 in screen space |
| 3267 bounds = gfx::Size(20, 20); | 3267 bounds = gfx::Size(20, 20); |
| 3268 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3268 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 3269 child->setDrawsContent(true); | 3269 child->setDrawsContent(true); |
| 3270 intermediateLayer->addChild(child.Pass()); | 3270 intermediateLayer->addChild(child.Pass()); |
| 3271 root->addChild(intermediateLayer.Pass()); | 3271 root->addChild(intermediateLayer.Pass()); |
| 3272 } | 3272 } |
| 3273 | 3273 |
| 3274 std::vector<LayerImpl*> renderSurfaceLayerList; | 3274 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3275 int dummyMaxTextureSize = 512; | 3275 int dummyMaxTextureSize = 512; |
| 3276 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3276 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3277 | 3277 |
| 3278 // Sanity check the scenario we just created. | 3278 // Sanity check the scenario we just created. |
| 3279 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3279 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3280 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3280 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3281 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3281 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 3282 | 3282 |
| 3283 // Hit testing for a point outside the layer should return a null pointer. | 3283 // Hit testing for a point outside the layer should return a null pointer. |
| 3284 gfx::Point testPoint(69, 69); | 3284 gfx::Point testPoint(69, 69); |
| 3285 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3285 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 3286 EXPECT_FALSE(resultLayer); | 3286 EXPECT_FALSE(resultLayer); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3344 root->addChild(child1.Pass()); | 3344 root->addChild(child1.Pass()); |
| 3345 root->addChild(child2.Pass()); | 3345 root->addChild(child2.Pass()); |
| 3346 } | 3346 } |
| 3347 | 3347 |
| 3348 LayerImpl* child1 = root->children()[0]; | 3348 LayerImpl* child1 = root->children()[0]; |
| 3349 LayerImpl* child2 = root->children()[1]; | 3349 LayerImpl* child2 = root->children()[1]; |
| 3350 LayerImpl* grandChild1 = child1->children()[0]; | 3350 LayerImpl* grandChild1 = child1->children()[0]; |
| 3351 | 3351 |
| 3352 std::vector<LayerImpl*> renderSurfaceLayerList; | 3352 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3353 int dummyMaxTextureSize = 512; | 3353 int dummyMaxTextureSize = 512; |
| 3354 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3354 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3355 | 3355 |
| 3356 // Sanity check the scenario we just created. | 3356 // Sanity check the scenario we just created. |
| 3357 ASSERT_TRUE(child1); | 3357 ASSERT_TRUE(child1); |
| 3358 ASSERT_TRUE(child2); | 3358 ASSERT_TRUE(child2); |
| 3359 ASSERT_TRUE(grandChild1); | 3359 ASSERT_TRUE(grandChild1); |
| 3360 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3360 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3361 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); | 3361 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); |
| 3362 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer | 3362 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer |
| 3363 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 | 3363 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 |
| 3364 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 | 3364 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3450 root->addChild(child1.Pass()); | 3450 root->addChild(child1.Pass()); |
| 3451 root->addChild(child2.Pass()); | 3451 root->addChild(child2.Pass()); |
| 3452 } | 3452 } |
| 3453 | 3453 |
| 3454 LayerImpl* child1 = root->children()[0]; | 3454 LayerImpl* child1 = root->children()[0]; |
| 3455 LayerImpl* child2 = root->children()[1]; | 3455 LayerImpl* child2 = root->children()[1]; |
| 3456 LayerImpl* grandChild1 = child1->children()[0]; | 3456 LayerImpl* grandChild1 = child1->children()[0]; |
| 3457 | 3457 |
| 3458 std::vector<LayerImpl*> renderSurfaceLayerList; | 3458 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3459 int dummyMaxTextureSize = 512; | 3459 int dummyMaxTextureSize = 512; |
| 3460 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3460 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3461 | 3461 |
| 3462 // Sanity check the scenario we just created. | 3462 // Sanity check the scenario we just created. |
| 3463 ASSERT_TRUE(child1); | 3463 ASSERT_TRUE(child1); |
| 3464 ASSERT_TRUE(child2); | 3464 ASSERT_TRUE(child2); |
| 3465 ASSERT_TRUE(grandChild1); | 3465 ASSERT_TRUE(grandChild1); |
| 3466 ASSERT_TRUE(child1->renderSurface()); | 3466 ASSERT_TRUE(child1->renderSurface()); |
| 3467 ASSERT_TRUE(child2->renderSurface()); | 3467 ASSERT_TRUE(child2->renderSurface()); |
| 3468 ASSERT_TRUE(grandChild1->renderSurface()); | 3468 ASSERT_TRUE(grandChild1->renderSurface()); |
| 3469 ASSERT_EQ(4u, renderSurfaceLayerList.size()); | 3469 ASSERT_EQ(4u, renderSurfaceLayerList.size()); |
| 3470 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. | 3470 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3534 gfx::Transform identityMatrix; | 3534 gfx::Transform identityMatrix; |
| 3535 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3535 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
| 3536 gfx::PointF anchor(0, 0); | 3536 gfx::PointF anchor(0, 0); |
| 3537 gfx::PointF position(0, 0); | 3537 gfx::PointF position(0, 0); |
| 3538 gfx::Size bounds(100, 100); | 3538 gfx::Size bounds(100, 100); |
| 3539 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3539 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3540 root->setDrawsContent(true); | 3540 root->setDrawsContent(true); |
| 3541 | 3541 |
| 3542 std::vector<LayerImpl*> renderSurfaceLayerList; | 3542 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3543 int dummyMaxTextureSize = 512; | 3543 int dummyMaxTextureSize = 512; |
| 3544 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3544 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3545 | 3545 |
| 3546 // Sanity check the scenario we just created. | 3546 // Sanity check the scenario we just created. |
| 3547 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3547 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3548 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3548 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3549 | 3549 |
| 3550 // Hit checking for any point should return a null pointer for a layer witho
ut any touch event handler regions. | 3550 // Hit checking for any point should return a null pointer for a layer witho
ut any touch event handler regions. |
| 3551 gfx::Point testPoint(11, 11); | 3551 gfx::Point testPoint(11, 11); |
| 3552 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3552 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
| 3553 EXPECT_FALSE(resultLayer); | 3553 EXPECT_FALSE(resultLayer); |
| 3554 | 3554 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3598 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
| 3599 gfx::PointF anchor(0, 0); | 3599 gfx::PointF anchor(0, 0); |
| 3600 gfx::PointF position(0, 0); | 3600 gfx::PointF position(0, 0); |
| 3601 gfx::Size bounds(100, 100); | 3601 gfx::Size bounds(100, 100); |
| 3602 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 3602 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
| 3603 root->setDrawsContent(true); | 3603 root->setDrawsContent(true); |
| 3604 root->setTouchEventHandlerRegion(touchHandlerRegion); | 3604 root->setTouchEventHandlerRegion(touchHandlerRegion); |
| 3605 | 3605 |
| 3606 std::vector<LayerImpl*> renderSurfaceLayerList; | 3606 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3607 int dummyMaxTextureSize = 512; | 3607 int dummyMaxTextureSize = 512; |
| 3608 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3608 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3609 | 3609 |
| 3610 // Sanity check the scenario we just created. | 3610 // Sanity check the scenario we just created. |
| 3611 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3611 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3612 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3612 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3613 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); | 3613 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); |
| 3614 | 3614 |
| 3615 // Hit checking any point should not hit the touch handler region on the lay
er. If the invertible matrix is | 3615 // Hit checking any point should not hit the touch handler region on the lay
er. If the invertible matrix is |
| 3616 // accidentally ignored and treated like an identity, then the hit testing w
ill | 3616 // accidentally ignored and treated like an identity, then the hit testing w
ill |
| 3617 // incorrectly hit the layer when it shouldn't. | 3617 // incorrectly hit the layer when it shouldn't. |
| 3618 gfx::Point testPoint(1, 1); | 3618 gfx::Point testPoint(1, 1); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3652 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3652 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
| 3653 gfx::PointF anchor(0, 0); | 3653 gfx::PointF anchor(0, 0); |
| 3654 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. | 3654 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. |
| 3655 gfx::Size bounds(100, 100); | 3655 gfx::Size bounds(100, 100); |
| 3656 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3656 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3657 root->setDrawsContent(true); | 3657 root->setDrawsContent(true); |
| 3658 root->setTouchEventHandlerRegion(touchHandlerRegion); | 3658 root->setTouchEventHandlerRegion(touchHandlerRegion); |
| 3659 | 3659 |
| 3660 std::vector<LayerImpl*> renderSurfaceLayerList; | 3660 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3661 int dummyMaxTextureSize = 512; | 3661 int dummyMaxTextureSize = 512; |
| 3662 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3662 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3663 | 3663 |
| 3664 // Sanity check the scenario we just created. | 3664 // Sanity check the scenario we just created. |
| 3665 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3665 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3666 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3666 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3667 | 3667 |
| 3668 // Hit checking for a point outside the layer should return a null pointer. | 3668 // Hit checking for a point outside the layer should return a null pointer. |
| 3669 gfx::Point testPoint(49, 49); | 3669 gfx::Point testPoint(49, 49); |
| 3670 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3670 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
| 3671 EXPECT_FALSE(resultLayer); | 3671 EXPECT_FALSE(resultLayer); |
| 3672 | 3672 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3722 testLayer->setContentBounds(gfx::Size(100, 100)); | 3722 testLayer->setContentBounds(gfx::Size(100, 100)); |
| 3723 testLayer->setContentsScale(2, 2); | 3723 testLayer->setContentsScale(2, 2); |
| 3724 | 3724 |
| 3725 testLayer->setDrawsContent(true); | 3725 testLayer->setDrawsContent(true); |
| 3726 testLayer->setTouchEventHandlerRegion(touchHandlerRegion); | 3726 testLayer->setTouchEventHandlerRegion(touchHandlerRegion); |
| 3727 root->addChild(testLayer.Pass()); | 3727 root->addChild(testLayer.Pass()); |
| 3728 } | 3728 } |
| 3729 | 3729 |
| 3730 std::vector<LayerImpl*> renderSurfaceLayerList; | 3730 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3731 int dummyMaxTextureSize = 512; | 3731 int dummyMaxTextureSize = 512; |
| 3732 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3732 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3733 | 3733 |
| 3734 // Sanity check the scenario we just created. | 3734 // Sanity check the scenario we just created. |
| 3735 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3735 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
| 3736 LayerImpl* testLayer = root->children()[0]; | 3736 LayerImpl* testLayer = root->children()[0]; |
| 3737 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); | 3737 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); |
| 3738 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3738 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3739 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3739 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3740 | 3740 |
| 3741 // Hit checking for a point outside the layer should return a null pointer (
the root layer does not draw content, so it will not be tested either). | 3741 // Hit checking for a point outside the layer should return a null pointer (
the root layer does not draw content, so it will not be tested either). |
| 3742 gfx::Point testPoint(76, 76); | 3742 gfx::Point testPoint(76, 76); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3796 } | 3796 } |
| 3797 | 3797 |
| 3798 std::vector<LayerImpl*> renderSurfaceLayerList; | 3798 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3799 int dummyMaxTextureSize = 512; | 3799 int dummyMaxTextureSize = 512; |
| 3800 float deviceScaleFactor = 3.0f; | 3800 float deviceScaleFactor = 3.0f; |
| 3801 float pageScaleFactor = 5.0f; | 3801 float pageScaleFactor = 5.0f; |
| 3802 gfx::Transform pageScaleTransform; | 3802 gfx::Transform pageScaleTransform; |
| 3803 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor); | 3803 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor); |
| 3804 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor
through implTransform. | 3804 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor
through implTransform. |
| 3805 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound
s(), deviceScaleFactor * pageScaleFactor)); | 3805 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound
s(), deviceScaleFactor * pageScaleFactor)); |
| 3806 LayerTreeHostCommon::calculateDrawTransforms(root.get(), scaledBoundsForRoot
, deviceScaleFactor, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3806 LayerTreeHostCommon::calculateDrawProperties(root.get(), scaledBoundsForRoot
, deviceScaleFactor, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3807 | 3807 |
| 3808 // Sanity check the scenario we just created. | 3808 // Sanity check the scenario we just created. |
| 3809 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3809 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
| 3810 LayerImpl* testLayer = root->children()[0]; | 3810 LayerImpl* testLayer = root->children()[0]; |
| 3811 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3811 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3812 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3812 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3813 | 3813 |
| 3814 // Check whether the child layer fits into the root after scaled. | 3814 // Check whether the child layer fits into the root after scaled. |
| 3815 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont
entRect());; | 3815 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont
entRect());; |
| 3816 | 3816 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3878 bounds = gfx::Size(300, 300); | 3878 bounds = gfx::Size(300, 300); |
| 3879 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3879 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 3880 child->setDrawsContent(true); | 3880 child->setDrawsContent(true); |
| 3881 child->setTouchEventHandlerRegion(touchHandlerRegion); | 3881 child->setTouchEventHandlerRegion(touchHandlerRegion); |
| 3882 clippingLayer->addChild(child.Pass()); | 3882 clippingLayer->addChild(child.Pass()); |
| 3883 root->addChild(clippingLayer.Pass()); | 3883 root->addChild(clippingLayer.Pass()); |
| 3884 } | 3884 } |
| 3885 | 3885 |
| 3886 std::vector<LayerImpl*> renderSurfaceLayerList; | 3886 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3887 int dummyMaxTextureSize = 512; | 3887 int dummyMaxTextureSize = 512; |
| 3888 LayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3888 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3889 | 3889 |
| 3890 // Sanity check the scenario we just created. | 3890 // Sanity check the scenario we just created. |
| 3891 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3891 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3892 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3892 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3893 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3893 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 3894 | 3894 |
| 3895 // Hit checking for a point outside the layer should return a null pointer. | 3895 // Hit checking for a point outside the layer should return a null pointer. |
| 3896 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 3896 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
| 3897 gfx::Point testPoint(24, 24); | 3897 gfx::Point testPoint(24, 24); |
| 3898 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3898 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3961 parent->addChild(child); | 3961 parent->addChild(child); |
| 3962 parent->addChild(childEmpty); | 3962 parent->addChild(childEmpty); |
| 3963 parent->addChild(childNoScale); | 3963 parent->addChild(childNoScale); |
| 3964 | 3964 |
| 3965 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 3965 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 3966 int dummyMaxTextureSize = 512; | 3966 int dummyMaxTextureSize = 512; |
| 3967 | 3967 |
| 3968 const double deviceScaleFactor = 2.5; | 3968 const double deviceScaleFactor = 2.5; |
| 3969 const double pageScaleFactor = 1; | 3969 const double pageScaleFactor = 1; |
| 3970 | 3970 |
| 3971 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 3971 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 3972 | 3972 |
| 3973 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); | 3973 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); |
| 3974 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); | 3974 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); |
| 3975 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, childEmpty); | 3975 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, childEmpty); |
| 3976 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 3976 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
| 3977 | 3977 |
| 3978 EXPECT_EQ(1u, renderSurfaceLayerList.size()); | 3978 EXPECT_EQ(1u, renderSurfaceLayerList.size()); |
| 3979 | 3979 |
| 3980 // Verify parent transforms | 3980 // Verify parent transforms |
| 3981 gfx::Transform expectedParentTransform; | 3981 gfx::Transform expectedParentTransform; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4043 | 4043 |
| 4044 parent->addChild(child); | 4044 parent->addChild(child); |
| 4045 parent->addChild(childNoScale); | 4045 parent->addChild(childNoScale); |
| 4046 | 4046 |
| 4047 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4047 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 4048 int dummyMaxTextureSize = 512; | 4048 int dummyMaxTextureSize = 512; |
| 4049 | 4049 |
| 4050 const float deviceScaleFactor = 1.7f; | 4050 const float deviceScaleFactor = 1.7f; |
| 4051 const float pageScaleFactor = 1; | 4051 const float pageScaleFactor = 1; |
| 4052 | 4052 |
| 4053 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4053 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 4054 | 4054 |
| 4055 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); | 4055 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); |
| 4056 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); | 4056 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); |
| 4057 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4057 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
| 4058 | 4058 |
| 4059 EXPECT_EQ(1u, renderSurfaceLayerList.size()); | 4059 EXPECT_EQ(1u, renderSurfaceLayerList.size()); |
| 4060 | 4060 |
| 4061 // Verify parent transforms | 4061 // Verify parent transforms |
| 4062 gfx::Transform expectedParentTransform; | 4062 gfx::Transform expectedParentTransform; |
| 4063 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); | 4063 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4148 int dummyMaxTextureSize = 512; | 4148 int dummyMaxTextureSize = 512; |
| 4149 | 4149 |
| 4150 double deviceScaleFactor = 2.5; | 4150 double deviceScaleFactor = 2.5; |
| 4151 double pageScaleFactor = 1.5; | 4151 double pageScaleFactor = 1.5; |
| 4152 | 4152 |
| 4153 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4153 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
| 4154 gfx::Transform pageScaleMatrix; | 4154 gfx::Transform pageScaleMatrix; |
| 4155 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4155 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
| 4156 parent->setSublayerTransform(pageScaleMatrix); | 4156 parent->setSublayerTransform(pageScaleMatrix); |
| 4157 | 4157 |
| 4158 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4158 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 4159 | 4159 |
| 4160 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4160 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
| 4161 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 4161 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
| 4162 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); | 4162 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
| 4163 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4163 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
| 4164 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); | 4164 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); |
| 4165 | 4165 |
| 4166 // The parent is scaled up and shouldn't need to scale during draw. The chil
d that can scale its contents should | 4166 // The parent is scaled up and shouldn't need to scale during draw. The chil
d that can scale its contents should |
| 4167 // also not need to scale during draw. This shouldn't change if the child ha
s empty bounds. The other children should. | 4167 // also not need to scale during draw. This shouldn't change if the child ha
s empty bounds. The other children should. |
| 4168 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(0, 0)); | 4168 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(0, 0)); |
| 4169 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(1, 1)); | 4169 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(1, 1)); |
| 4170 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(0, 0)); | 4170 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(0, 0)); |
| 4171 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(1, 1)); | 4171 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(1, 1)); |
| 4172 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(0, 0)); | 4172 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(0, 0)); |
| 4173 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(1, 1)); | 4173 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(1, 1)); |
| 4174 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(0, 0)); | 4174 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(0, 0)); |
| 4175 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(1, 1)); | 4175 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(1, 1)); |
| 4176 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(0, 0)); | 4176 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(0, 0)); |
| 4177 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(1, 1)); | 4177 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(1, 1)); |
| 4178 | 4178 |
| 4179 // If the transform changes, we expect the contentsScale to remain unchanged
. | 4179 // If the transform changes, we expect the contentsScale to remain unchanged
. |
| 4180 childScale->setTransform(identityMatrix); | 4180 childScale->setTransform(identityMatrix); |
| 4181 childEmpty->setTransform(identityMatrix); | 4181 childEmpty->setTransform(identityMatrix); |
| 4182 | 4182 |
| 4183 renderSurfaceLayerList.clear(); | 4183 renderSurfaceLayerList.clear(); |
| 4184 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4184 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 4185 | 4185 |
| 4186 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4186 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
| 4187 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 4187 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
| 4188 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); | 4188 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
| 4189 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4189 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
| 4190 | 4190 |
| 4191 // But if the deviceScaleFactor or pageScaleFactor changes, then it should b
e updated, but using the initial transform. | 4191 // But if the deviceScaleFactor or pageScaleFactor changes, then it should b
e updated, but using the initial transform. |
| 4192 deviceScaleFactor = 2.25; | 4192 deviceScaleFactor = 2.25; |
| 4193 pageScaleFactor = 1.25; | 4193 pageScaleFactor = 1.25; |
| 4194 | 4194 |
| 4195 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4195 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
| 4196 pageScaleMatrix = identityMatrix; | 4196 pageScaleMatrix = identityMatrix; |
| 4197 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4197 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
| 4198 parent->setSublayerTransform(pageScaleMatrix); | 4198 parent->setSublayerTransform(pageScaleMatrix); |
| 4199 | 4199 |
| 4200 renderSurfaceLayerList.clear(); | 4200 renderSurfaceLayerList.clear(); |
| 4201 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4201 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 4202 | 4202 |
| 4203 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4203 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
| 4204 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 4204 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
| 4205 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); | 4205 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
| 4206 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4206 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
| 4207 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); | 4207 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); |
| 4208 } | 4208 } |
| 4209 | 4209 |
| 4210 TEST(LayerTreeHostCommonTest, verifySmallContentsScale) | 4210 TEST(LayerTreeHostCommonTest, verifySmallContentsScale) |
| 4211 { | 4211 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4236 int dummyMaxTextureSize = 512; | 4236 int dummyMaxTextureSize = 512; |
| 4237 | 4237 |
| 4238 double deviceScaleFactor = 2.5; | 4238 double deviceScaleFactor = 2.5; |
| 4239 double pageScaleFactor = 0.01; | 4239 double pageScaleFactor = 0.01; |
| 4240 | 4240 |
| 4241 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4241 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
| 4242 gfx::Transform pageScaleMatrix; | 4242 gfx::Transform pageScaleMatrix; |
| 4243 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4243 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
| 4244 parent->setSublayerTransform(pageScaleMatrix); | 4244 parent->setSublayerTransform(pageScaleMatrix); |
| 4245 | 4245 |
| 4246 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4246 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 4247 | 4247 |
| 4248 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4248 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
| 4249 // The child's scale is < 1, so we should not save and use that scale factor
. | 4249 // The child's scale is < 1, so we should not save and use that scale factor
. |
| 4250 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * 1, childScale
); | 4250 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * 1, childScale
); |
| 4251 | 4251 |
| 4252 // When chilld's total scale becomes >= 1, we should save and use that scale
factor. | 4252 // When chilld's total scale becomes >= 1, we should save and use that scale
factor. |
| 4253 childScaleMatrix.MakeIdentity(); | 4253 childScaleMatrix.MakeIdentity(); |
| 4254 const double finalChildScale = 0.75; | 4254 const double finalChildScale = 0.75; |
| 4255 childScaleMatrix.Scale(finalChildScale, finalChildScale); | 4255 childScaleMatrix.Scale(finalChildScale, finalChildScale); |
| 4256 childScale->setTransform(childScaleMatrix); | 4256 childScale->setTransform(childScaleMatrix); |
| 4257 | 4257 |
| 4258 renderSurfaceLayerList.clear(); | 4258 renderSurfaceLayerList.clear(); |
| 4259 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4259 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 4260 | 4260 |
| 4261 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4261 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
| 4262 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * finalChildScale, childScale); | 4262 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * finalChildScale, childScale); |
| 4263 } | 4263 } |
| 4264 | 4264 |
| 4265 TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces) | 4265 TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces) |
| 4266 { | 4266 { |
| 4267 MockContentLayerClient delegate; | 4267 MockContentLayerClient delegate; |
| 4268 gfx::Transform identityMatrix; | 4268 gfx::Transform identityMatrix; |
| 4269 | 4269 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4333 int dummyMaxTextureSize = 512; | 4333 int dummyMaxTextureSize = 512; |
| 4334 | 4334 |
| 4335 double deviceScaleFactor = 5; | 4335 double deviceScaleFactor = 5; |
| 4336 double pageScaleFactor = 7; | 4336 double pageScaleFactor = 7; |
| 4337 | 4337 |
| 4338 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4338 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
| 4339 gfx::Transform pageScaleMatrix; | 4339 gfx::Transform pageScaleMatrix; |
| 4340 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4340 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
| 4341 parent->setSublayerTransform(pageScaleMatrix); | 4341 parent->setSublayerTransform(pageScaleMatrix); |
| 4342 | 4342 |
| 4343 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4343 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); |
| 4344 | 4344 |
| 4345 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4345 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
| 4346 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, surfaceScale); | 4346 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, surfaceScale); |
| 4347 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScale); | 4347 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScale); |
| 4348 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, surfaceNoAutoScale); | 4348 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, surfaceNoAutoScale); |
| 4349 | 4349 |
| 4350 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceScaleChildScale); | 4350 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceScaleChildScale); |
| 4351 EXPECT_CONTENTS_SCALE_EQ(1, surfaceScaleChildNoScale); | 4351 EXPECT_CONTENTS_SCALE_EQ(1, surfaceScaleChildNoScale); |
| 4352 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceNoScaleChildScale); | 4352 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceNoScaleChildScale); |
| 4353 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScaleChildNoScale); | 4353 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScaleChildNoScale); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4427 setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); | 4427 setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); |
| 4428 | 4428 |
| 4429 parent->addChild(childScale); | 4429 parent->addChild(childScale); |
| 4430 | 4430 |
| 4431 // Now put an animating transform on child. | 4431 // Now put an animating transform on child. |
| 4432 int animationId = addAnimatedTransformToController(*childScale->layerAnimati
onController(), 10, 30, 0); | 4432 int animationId = addAnimatedTransformToController(*childScale->layerAnimati
onController(), 10, 30, 0); |
| 4433 | 4433 |
| 4434 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4434 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 4435 int dummyMaxTextureSize = 512; | 4435 int dummyMaxTextureSize = 512; |
| 4436 | 4436 |
| 4437 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4437 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 4438 | 4438 |
| 4439 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); | 4439 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); |
| 4440 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. | 4440 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. |
| 4441 EXPECT_CONTENTS_SCALE_EQ(1, childScale); | 4441 EXPECT_CONTENTS_SCALE_EQ(1, childScale); |
| 4442 | 4442 |
| 4443 // Remove the animation, now it can save a raster scale. | 4443 // Remove the animation, now it can save a raster scale. |
| 4444 childScale->layerAnimationController()->removeAnimation(animationId); | 4444 childScale->layerAnimationController()->removeAnimation(animationId); |
| 4445 | 4445 |
| 4446 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4446 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 4447 | 4447 |
| 4448 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); | 4448 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); |
| 4449 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. | 4449 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. |
| 4450 EXPECT_CONTENTS_SCALE_EQ(initialParentScale * initialChildScale, childScale)
; | 4450 EXPECT_CONTENTS_SCALE_EQ(initialParentScale * initialChildScale, childScale)
; |
| 4451 } | 4451 } |
| 4452 | 4452 |
| 4453 | 4453 |
| 4454 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) | 4454 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) |
| 4455 { | 4455 { |
| 4456 MockContentLayerClient delegate; | 4456 MockContentLayerClient delegate; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4478 | 4478 |
| 4479 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4479 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 4480 int dummyMaxTextureSize = 512; | 4480 int dummyMaxTextureSize = 512; |
| 4481 | 4481 |
| 4482 const double deviceScaleFactor = 1.5; | 4482 const double deviceScaleFactor = 1.5; |
| 4483 parent->setContentsScale(deviceScaleFactor); | 4483 parent->setContentsScale(deviceScaleFactor); |
| 4484 child->setContentsScale(deviceScaleFactor); | 4484 child->setContentsScale(deviceScaleFactor); |
| 4485 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); | 4485 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); |
| 4486 replica->setContentsScale(deviceScaleFactor); | 4486 replica->setContentsScale(deviceScaleFactor); |
| 4487 | 4487 |
| 4488 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4488 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 4489 | 4489 |
| 4490 // We should have two render surfaces. The root's render surface and child's | 4490 // We should have two render surfaces. The root's render surface and child's |
| 4491 // render surface (it needs one because it has a replica layer). | 4491 // render surface (it needs one because it has a replica layer). |
| 4492 EXPECT_EQ(2u, renderSurfaceLayerList.size()); | 4492 EXPECT_EQ(2u, renderSurfaceLayerList.size()); |
| 4493 | 4493 |
| 4494 gfx::Transform expectedParentTransform; | 4494 gfx::Transform expectedParentTransform; |
| 4495 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); | 4495 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); |
| 4496 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); | 4496 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); |
| 4497 | 4497 |
| 4498 gfx::Transform expectedDrawTransform; | 4498 gfx::Transform expectedDrawTransform; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4561 | 4561 |
| 4562 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4562 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
| 4563 int dummyMaxTextureSize = 512; | 4563 int dummyMaxTextureSize = 512; |
| 4564 | 4564 |
| 4565 const float deviceScaleFactor = 1.7f; | 4565 const float deviceScaleFactor = 1.7f; |
| 4566 parent->setContentsScale(deviceScaleFactor); | 4566 parent->setContentsScale(deviceScaleFactor); |
| 4567 child->setContentsScale(deviceScaleFactor); | 4567 child->setContentsScale(deviceScaleFactor); |
| 4568 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); | 4568 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); |
| 4569 replica->setContentsScale(deviceScaleFactor); | 4569 replica->setContentsScale(deviceScaleFactor); |
| 4570 | 4570 |
| 4571 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4571 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 4572 | 4572 |
| 4573 // We should have two render surfaces. The root's render surface and child's | 4573 // We should have two render surfaces. The root's render surface and child's |
| 4574 // render surface (it needs one because it has a replica layer). | 4574 // render surface (it needs one because it has a replica layer). |
| 4575 EXPECT_EQ(2u, renderSurfaceLayerList.size()); | 4575 EXPECT_EQ(2u, renderSurfaceLayerList.size()); |
| 4576 | 4576 |
| 4577 gfx::Transform identityTransform; | 4577 gfx::Transform identityTransform; |
| 4578 | 4578 |
| 4579 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->screenSpaceTransf
orm()); | 4579 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->screenSpaceTransf
orm()); |
| 4580 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->drawTransform()); | 4580 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->drawTransform()); |
| 4581 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, child->drawTransform()); | 4581 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, child->drawTransform()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4628 | 4628 |
| 4629 const gfx::Transform identityMatrix; | 4629 const gfx::Transform identityMatrix; |
| 4630 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(), gfx::PointF(), gfx::Size(100, 100), false); | 4630 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx
::PointF(), gfx::PointF(), gfx::Size(100, 100), false); |
| 4631 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 4631 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
| 4632 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 4632 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
| 4633 | 4633 |
| 4634 root->addChild(child); | 4634 root->addChild(child); |
| 4635 child->addChild(grandChild); | 4635 child->addChild(grandChild); |
| 4636 child->setOpacity(0.5f); | 4636 child->setOpacity(0.5f); |
| 4637 | 4637 |
| 4638 executeCalculateDrawTransformsAndVisibility(root.get()); | 4638 executeCalculateDrawProperties(root.get()); |
| 4639 | 4639 |
| 4640 EXPECT_FALSE(child->renderSurface()); | 4640 EXPECT_FALSE(child->renderSurface()); |
| 4641 } | 4641 } |
| 4642 | 4642 |
| 4643 } // namespace | 4643 } // namespace |
| 4644 } // namespace cc | 4644 } // namespace cc |
| OLD | NEW |