| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto
r = 1, float pageScaleFactor = 1, bool canUseLCDText = false) | 64 void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto
r = 1, float pageScaleFactor = 1, bool canUseLCDText = false) |
| 65 { | 65 { |
| 66 gfx::Transform identityMatrix; | 66 gfx::Transform identityMatrix; |
| 67 std::vector<LayerImpl*> dummyRenderSurfaceLayerList; | 67 std::vector<LayerImpl*> dummyRenderSurfaceLayerList; |
| 68 int dummyMaxTextureSize = 512; | 68 int dummyMaxTextureSize = 512; |
| 69 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); | 69 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); |
| 70 | 70 |
| 71 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 71 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
| 72 DCHECK(!rootLayer->bounds().IsEmpty()); | 72 DCHECK(!rootLayer->bounds().IsEmpty()); |
| 73 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, canUseLCDText, dummyRen
derSurfaceLayerList); | 73 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, canUseLCDText, dummyRen
derSurfaceLayerList, false); |
| 74 } | 74 } |
| 75 | 75 |
| 76 scoped_ptr<LayerImpl> createTreeForFixedPositionTests(LayerTreeHostImpl* hostImp
l) | 76 scoped_ptr<LayerImpl> createTreeForFixedPositionTests(LayerTreeHostImpl* hostImp
l) |
| 77 { | 77 { |
| 78 scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl->activeTree(), 1); | 78 scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl->activeTree(), 1); |
| 79 scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl->activeTree(), 2); | 79 scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl->activeTree(), 2); |
| 80 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(hostImpl->activeTree(),
3); | 80 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(hostImpl->activeTree(),
3); |
| 81 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(hostImpl->activeTr
ee(), 4); | 81 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(hostImpl->activeTr
ee(), 4); |
| 82 | 82 |
| 83 gfx::Transform IdentityMatrix; | 83 gfx::Transform IdentityMatrix; |
| (...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2909 | 2909 |
| 2910 gfx::Transform identityMatrix; | 2910 gfx::Transform identityMatrix; |
| 2911 gfx::PointF anchor(0, 0); | 2911 gfx::PointF anchor(0, 0); |
| 2912 gfx::PointF position(0, 0); | 2912 gfx::PointF position(0, 0); |
| 2913 gfx::Size bounds(100, 100); | 2913 gfx::Size bounds(100, 100); |
| 2914 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2914 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 2915 root->setDrawsContent(true); | 2915 root->setDrawsContent(true); |
| 2916 | 2916 |
| 2917 std::vector<LayerImpl*> renderSurfaceLayerList; | 2917 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2918 int dummyMaxTextureSize = 512; | 2918 int dummyMaxTextureSize = 512; |
| 2919 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 2919 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 2920 | 2920 |
| 2921 // Sanity check the scenario we just created. | 2921 // Sanity check the scenario we just created. |
| 2922 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2922 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2923 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2923 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2924 | 2924 |
| 2925 // Hit testing for a point outside the layer should return a null pointer. | 2925 // Hit testing for a point outside the layer should return a null pointer. |
| 2926 gfx::Point testPoint(101, 101); | 2926 gfx::Point testPoint(101, 101); |
| 2927 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2927 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 2928 EXPECT_FALSE(resultLayer); | 2928 EXPECT_FALSE(resultLayer); |
| 2929 | 2929 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2958 | 2958 |
| 2959 gfx::Transform identityMatrix; | 2959 gfx::Transform identityMatrix; |
| 2960 gfx::PointF anchor(0, 0); | 2960 gfx::PointF anchor(0, 0); |
| 2961 gfx::PointF position(0, 0); | 2961 gfx::PointF position(0, 0); |
| 2962 gfx::Size bounds(100, 100); | 2962 gfx::Size bounds(100, 100); |
| 2963 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 2963 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
| 2964 root->setDrawsContent(true); | 2964 root->setDrawsContent(true); |
| 2965 | 2965 |
| 2966 std::vector<LayerImpl*> renderSurfaceLayerList; | 2966 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2967 int dummyMaxTextureSize = 512; | 2967 int dummyMaxTextureSize = 512; |
| 2968 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 2968 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 2969 | 2969 |
| 2970 // Sanity check the scenario we just created. | 2970 // Sanity check the scenario we just created. |
| 2971 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2971 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2972 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2972 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2973 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); | 2973 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); |
| 2974 | 2974 |
| 2975 // Hit testing any point should not hit the layer. If the invertible matrix
is | 2975 // Hit testing any point should not hit the layer. If the invertible matrix
is |
| 2976 // accidentally ignored and treated like an identity, then the hit testing w
ill | 2976 // accidentally ignored and treated like an identity, then the hit testing w
ill |
| 2977 // incorrectly hit the layer when it shouldn't. | 2977 // incorrectly hit the layer when it shouldn't. |
| 2978 gfx::Point testPoint(1, 1); | 2978 gfx::Point testPoint(1, 1); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3012 | 3012 |
| 3013 gfx::Transform identityMatrix; | 3013 gfx::Transform identityMatrix; |
| 3014 gfx::PointF anchor(0, 0); | 3014 gfx::PointF anchor(0, 0); |
| 3015 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. | 3015 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. |
| 3016 gfx::Size bounds(100, 100); | 3016 gfx::Size bounds(100, 100); |
| 3017 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3017 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3018 root->setDrawsContent(true); | 3018 root->setDrawsContent(true); |
| 3019 | 3019 |
| 3020 std::vector<LayerImpl*> renderSurfaceLayerList; | 3020 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3021 int dummyMaxTextureSize = 512; | 3021 int dummyMaxTextureSize = 512; |
| 3022 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3022 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3023 | 3023 |
| 3024 // Sanity check the scenario we just created. | 3024 // Sanity check the scenario we just created. |
| 3025 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3025 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3026 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3026 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3027 | 3027 |
| 3028 // Hit testing for a point outside the layer should return a null pointer. | 3028 // Hit testing for a point outside the layer should return a null pointer. |
| 3029 gfx::Point testPoint(49, 49); | 3029 gfx::Point testPoint(49, 49); |
| 3030 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3030 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 3031 EXPECT_FALSE(resultLayer); | 3031 EXPECT_FALSE(resultLayer); |
| 3032 | 3032 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3059 rotation45DegreesAboutCenter.RotateAboutZAxis(45); | 3059 rotation45DegreesAboutCenter.RotateAboutZAxis(45); |
| 3060 rotation45DegreesAboutCenter.Translate(-50, -50); | 3060 rotation45DegreesAboutCenter.Translate(-50, -50); |
| 3061 gfx::PointF anchor(0, 0); | 3061 gfx::PointF anchor(0, 0); |
| 3062 gfx::PointF position(0, 0); | 3062 gfx::PointF position(0, 0); |
| 3063 gfx::Size bounds(100, 100); | 3063 gfx::Size bounds(100, 100); |
| 3064 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); | 3064 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); |
| 3065 root->setDrawsContent(true); | 3065 root->setDrawsContent(true); |
| 3066 | 3066 |
| 3067 std::vector<LayerImpl*> renderSurfaceLayerList; | 3067 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3068 int dummyMaxTextureSize = 512; | 3068 int dummyMaxTextureSize = 512; |
| 3069 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3069 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3070 | 3070 |
| 3071 // Sanity check the scenario we just created. | 3071 // Sanity check the scenario we just created. |
| 3072 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3072 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3073 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3073 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3074 | 3074 |
| 3075 // Hit testing for points outside the layer. | 3075 // Hit testing for points outside the layer. |
| 3076 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 3076 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
| 3077 gfx::Point testPoint(99, 99); | 3077 gfx::Point testPoint(99, 99); |
| 3078 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3078 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 3079 EXPECT_FALSE(resultLayer); | 3079 EXPECT_FALSE(resultLayer); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3115 translationByZ.Translate3d(0, 0, -1); | 3115 translationByZ.Translate3d(0, 0, -1); |
| 3116 | 3116 |
| 3117 gfx::PointF anchor(0, 0); | 3117 gfx::PointF anchor(0, 0); |
| 3118 gfx::PointF position(0, 0); | 3118 gfx::PointF position(0, 0); |
| 3119 gfx::Size bounds(100, 100); | 3119 gfx::Size bounds(100, 100); |
| 3120 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); | 3120 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); |
| 3121 root->setDrawsContent(true); | 3121 root->setDrawsContent(true); |
| 3122 | 3122 |
| 3123 std::vector<LayerImpl*> renderSurfaceLayerList; | 3123 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3124 int dummyMaxTextureSize = 512; | 3124 int dummyMaxTextureSize = 512; |
| 3125 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3125 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3126 | 3126 |
| 3127 // Sanity check the scenario we just created. | 3127 // Sanity check the scenario we just created. |
| 3128 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3128 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3129 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3129 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3130 | 3130 |
| 3131 // Hit testing for points outside the layer. | 3131 // Hit testing for points outside the layer. |
| 3132 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 3132 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
| 3133 gfx::Point testPoint(24, 24); | 3133 gfx::Point testPoint(24, 24); |
| 3134 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3134 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 3135 EXPECT_FALSE(resultLayer); | 3135 EXPECT_FALSE(resultLayer); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3180 // override contentBounds and contentsScale | 3180 // override contentBounds and contentsScale |
| 3181 testLayer->setContentBounds(gfx::Size(100, 100)); | 3181 testLayer->setContentBounds(gfx::Size(100, 100)); |
| 3182 testLayer->setContentsScale(2, 2); | 3182 testLayer->setContentsScale(2, 2); |
| 3183 | 3183 |
| 3184 testLayer->setDrawsContent(true); | 3184 testLayer->setDrawsContent(true); |
| 3185 root->addChild(testLayer.Pass()); | 3185 root->addChild(testLayer.Pass()); |
| 3186 } | 3186 } |
| 3187 | 3187 |
| 3188 std::vector<LayerImpl*> renderSurfaceLayerList; | 3188 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3189 int dummyMaxTextureSize = 512; | 3189 int dummyMaxTextureSize = 512; |
| 3190 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3190 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3191 | 3191 |
| 3192 // Sanity check the scenario we just created. | 3192 // Sanity check the scenario we just created. |
| 3193 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3193 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
| 3194 LayerImpl* testLayer = root->children()[0]; | 3194 LayerImpl* testLayer = root->children()[0]; |
| 3195 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); | 3195 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); |
| 3196 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3196 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3197 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3197 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3198 | 3198 |
| 3199 // 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). | 3199 // 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). |
| 3200 gfx::Point testPoint(101, 101); | 3200 gfx::Point testPoint(101, 101); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3244 position = gfx::PointF(-50, -50); | 3244 position = gfx::PointF(-50, -50); |
| 3245 bounds = gfx::Size(300, 300); | 3245 bounds = gfx::Size(300, 300); |
| 3246 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3246 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 3247 child->setDrawsContent(true); | 3247 child->setDrawsContent(true); |
| 3248 clippingLayer->addChild(child.Pass()); | 3248 clippingLayer->addChild(child.Pass()); |
| 3249 root->addChild(clippingLayer.Pass()); | 3249 root->addChild(clippingLayer.Pass()); |
| 3250 } | 3250 } |
| 3251 | 3251 |
| 3252 std::vector<LayerImpl*> renderSurfaceLayerList; | 3252 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3253 int dummyMaxTextureSize = 512; | 3253 int dummyMaxTextureSize = 512; |
| 3254 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3254 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3255 | 3255 |
| 3256 // Sanity check the scenario we just created. | 3256 // Sanity check the scenario we just created. |
| 3257 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3257 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3258 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3258 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3259 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3259 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 3260 | 3260 |
| 3261 // Hit testing for a point outside the layer should return a null pointer. | 3261 // Hit testing for a point outside the layer should return a null pointer. |
| 3262 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 3262 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
| 3263 gfx::Point testPoint(24, 24); | 3263 gfx::Point testPoint(24, 24); |
| 3264 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3264 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3334 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); | 3334 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); |
| 3335 rotatedLeaf->setDrawsContent(true); | 3335 rotatedLeaf->setDrawsContent(true); |
| 3336 | 3336 |
| 3337 grandChild->addChild(rotatedLeaf.Pass()); | 3337 grandChild->addChild(rotatedLeaf.Pass()); |
| 3338 child->addChild(grandChild.Pass()); | 3338 child->addChild(grandChild.Pass()); |
| 3339 root->addChild(child.Pass()); | 3339 root->addChild(child.Pass()); |
| 3340 } | 3340 } |
| 3341 | 3341 |
| 3342 std::vector<LayerImpl*> renderSurfaceLayerList; | 3342 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3343 int dummyMaxTextureSize = 512; | 3343 int dummyMaxTextureSize = 512; |
| 3344 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3344 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3345 | 3345 |
| 3346 // Sanity check the scenario we just created. | 3346 // Sanity check the scenario we just created. |
| 3347 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. | 3347 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. |
| 3348 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 3348 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
| 3349 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); | 3349 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); |
| 3350 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. | 3350 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. |
| 3351 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); | 3351 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); |
| 3352 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); | 3352 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); |
| 3353 | 3353 |
| 3354 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. | 3354 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3416 position = gfx::PointF(60, 60); // 70, 70 in screen space | 3416 position = gfx::PointF(60, 60); // 70, 70 in screen space |
| 3417 bounds = gfx::Size(20, 20); | 3417 bounds = gfx::Size(20, 20); |
| 3418 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3418 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 3419 child->setDrawsContent(true); | 3419 child->setDrawsContent(true); |
| 3420 intermediateLayer->addChild(child.Pass()); | 3420 intermediateLayer->addChild(child.Pass()); |
| 3421 root->addChild(intermediateLayer.Pass()); | 3421 root->addChild(intermediateLayer.Pass()); |
| 3422 } | 3422 } |
| 3423 | 3423 |
| 3424 std::vector<LayerImpl*> renderSurfaceLayerList; | 3424 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3425 int dummyMaxTextureSize = 512; | 3425 int dummyMaxTextureSize = 512; |
| 3426 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3426 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3427 | 3427 |
| 3428 // Sanity check the scenario we just created. | 3428 // Sanity check the scenario we just created. |
| 3429 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3429 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3430 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3430 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3431 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3431 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 3432 | 3432 |
| 3433 // Hit testing for a point outside the layer should return a null pointer. | 3433 // Hit testing for a point outside the layer should return a null pointer. |
| 3434 gfx::Point testPoint(69, 69); | 3434 gfx::Point testPoint(69, 69); |
| 3435 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3435 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 3436 EXPECT_FALSE(resultLayer); | 3436 EXPECT_FALSE(resultLayer); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3496 root->addChild(child1.Pass()); | 3496 root->addChild(child1.Pass()); |
| 3497 root->addChild(child2.Pass()); | 3497 root->addChild(child2.Pass()); |
| 3498 } | 3498 } |
| 3499 | 3499 |
| 3500 LayerImpl* child1 = root->children()[0]; | 3500 LayerImpl* child1 = root->children()[0]; |
| 3501 LayerImpl* child2 = root->children()[1]; | 3501 LayerImpl* child2 = root->children()[1]; |
| 3502 LayerImpl* grandChild1 = child1->children()[0]; | 3502 LayerImpl* grandChild1 = child1->children()[0]; |
| 3503 | 3503 |
| 3504 std::vector<LayerImpl*> renderSurfaceLayerList; | 3504 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3505 int dummyMaxTextureSize = 512; | 3505 int dummyMaxTextureSize = 512; |
| 3506 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3506 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3507 | 3507 |
| 3508 // Sanity check the scenario we just created. | 3508 // Sanity check the scenario we just created. |
| 3509 ASSERT_TRUE(child1); | 3509 ASSERT_TRUE(child1); |
| 3510 ASSERT_TRUE(child2); | 3510 ASSERT_TRUE(child2); |
| 3511 ASSERT_TRUE(grandChild1); | 3511 ASSERT_TRUE(grandChild1); |
| 3512 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3512 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3513 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); | 3513 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); |
| 3514 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer | 3514 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer |
| 3515 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 | 3515 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 |
| 3516 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 | 3516 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3604 root->addChild(child1.Pass()); | 3604 root->addChild(child1.Pass()); |
| 3605 root->addChild(child2.Pass()); | 3605 root->addChild(child2.Pass()); |
| 3606 } | 3606 } |
| 3607 | 3607 |
| 3608 LayerImpl* child1 = root->children()[0]; | 3608 LayerImpl* child1 = root->children()[0]; |
| 3609 LayerImpl* child2 = root->children()[1]; | 3609 LayerImpl* child2 = root->children()[1]; |
| 3610 LayerImpl* grandChild1 = child1->children()[0]; | 3610 LayerImpl* grandChild1 = child1->children()[0]; |
| 3611 | 3611 |
| 3612 std::vector<LayerImpl*> renderSurfaceLayerList; | 3612 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3613 int dummyMaxTextureSize = 512; | 3613 int dummyMaxTextureSize = 512; |
| 3614 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3614 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3615 | 3615 |
| 3616 // Sanity check the scenario we just created. | 3616 // Sanity check the scenario we just created. |
| 3617 ASSERT_TRUE(child1); | 3617 ASSERT_TRUE(child1); |
| 3618 ASSERT_TRUE(child2); | 3618 ASSERT_TRUE(child2); |
| 3619 ASSERT_TRUE(grandChild1); | 3619 ASSERT_TRUE(grandChild1); |
| 3620 ASSERT_TRUE(child1->renderSurface()); | 3620 ASSERT_TRUE(child1->renderSurface()); |
| 3621 ASSERT_TRUE(child2->renderSurface()); | 3621 ASSERT_TRUE(child2->renderSurface()); |
| 3622 ASSERT_TRUE(grandChild1->renderSurface()); | 3622 ASSERT_TRUE(grandChild1->renderSurface()); |
| 3623 ASSERT_EQ(4u, renderSurfaceLayerList.size()); | 3623 ASSERT_EQ(4u, renderSurfaceLayerList.size()); |
| 3624 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. | 3624 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3690 gfx::Transform identityMatrix; | 3690 gfx::Transform identityMatrix; |
| 3691 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3691 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
| 3692 gfx::PointF anchor(0, 0); | 3692 gfx::PointF anchor(0, 0); |
| 3693 gfx::PointF position(0, 0); | 3693 gfx::PointF position(0, 0); |
| 3694 gfx::Size bounds(100, 100); | 3694 gfx::Size bounds(100, 100); |
| 3695 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3695 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3696 root->setDrawsContent(true); | 3696 root->setDrawsContent(true); |
| 3697 | 3697 |
| 3698 std::vector<LayerImpl*> renderSurfaceLayerList; | 3698 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3699 int dummyMaxTextureSize = 512; | 3699 int dummyMaxTextureSize = 512; |
| 3700 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3700 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3701 | 3701 |
| 3702 // Sanity check the scenario we just created. | 3702 // Sanity check the scenario we just created. |
| 3703 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3703 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3704 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3704 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3705 | 3705 |
| 3706 // Hit checking for any point should return a null pointer for a layer witho
ut any touch event handler regions. | 3706 // Hit checking for any point should return a null pointer for a layer witho
ut any touch event handler regions. |
| 3707 gfx::Point testPoint(11, 11); | 3707 gfx::Point testPoint(11, 11); |
| 3708 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3708 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
| 3709 EXPECT_FALSE(resultLayer); | 3709 EXPECT_FALSE(resultLayer); |
| 3710 | 3710 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3756 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3756 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
| 3757 gfx::PointF anchor(0, 0); | 3757 gfx::PointF anchor(0, 0); |
| 3758 gfx::PointF position(0, 0); | 3758 gfx::PointF position(0, 0); |
| 3759 gfx::Size bounds(100, 100); | 3759 gfx::Size bounds(100, 100); |
| 3760 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 3760 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
| 3761 root->setDrawsContent(true); | 3761 root->setDrawsContent(true); |
| 3762 root->setTouchEventHandlerRegion(touchHandlerRegion); | 3762 root->setTouchEventHandlerRegion(touchHandlerRegion); |
| 3763 | 3763 |
| 3764 std::vector<LayerImpl*> renderSurfaceLayerList; | 3764 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3765 int dummyMaxTextureSize = 512; | 3765 int dummyMaxTextureSize = 512; |
| 3766 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3766 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3767 | 3767 |
| 3768 // Sanity check the scenario we just created. | 3768 // Sanity check the scenario we just created. |
| 3769 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3769 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3770 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3770 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3771 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); | 3771 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); |
| 3772 | 3772 |
| 3773 // Hit checking any point should not hit the touch handler region on the lay
er. If the invertible matrix is | 3773 // Hit checking any point should not hit the touch handler region on the lay
er. If the invertible matrix is |
| 3774 // accidentally ignored and treated like an identity, then the hit testing w
ill | 3774 // accidentally ignored and treated like an identity, then the hit testing w
ill |
| 3775 // incorrectly hit the layer when it shouldn't. | 3775 // incorrectly hit the layer when it shouldn't. |
| 3776 gfx::Point testPoint(1, 1); | 3776 gfx::Point testPoint(1, 1); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3812 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3812 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
| 3813 gfx::PointF anchor(0, 0); | 3813 gfx::PointF anchor(0, 0); |
| 3814 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. | 3814 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. |
| 3815 gfx::Size bounds(100, 100); | 3815 gfx::Size bounds(100, 100); |
| 3816 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3816 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3817 root->setDrawsContent(true); | 3817 root->setDrawsContent(true); |
| 3818 root->setTouchEventHandlerRegion(touchHandlerRegion); | 3818 root->setTouchEventHandlerRegion(touchHandlerRegion); |
| 3819 | 3819 |
| 3820 std::vector<LayerImpl*> renderSurfaceLayerList; | 3820 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3821 int dummyMaxTextureSize = 512; | 3821 int dummyMaxTextureSize = 512; |
| 3822 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3822 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3823 | 3823 |
| 3824 // Sanity check the scenario we just created. | 3824 // Sanity check the scenario we just created. |
| 3825 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3825 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3826 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3826 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3827 | 3827 |
| 3828 // Hit checking for a point outside the layer should return a null pointer. | 3828 // Hit checking for a point outside the layer should return a null pointer. |
| 3829 gfx::Point testPoint(49, 49); | 3829 gfx::Point testPoint(49, 49); |
| 3830 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3830 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
| 3831 EXPECT_FALSE(resultLayer); | 3831 EXPECT_FALSE(resultLayer); |
| 3832 | 3832 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3884 testLayer->setContentBounds(gfx::Size(100, 100)); | 3884 testLayer->setContentBounds(gfx::Size(100, 100)); |
| 3885 testLayer->setContentsScale(2, 2); | 3885 testLayer->setContentsScale(2, 2); |
| 3886 | 3886 |
| 3887 testLayer->setDrawsContent(true); | 3887 testLayer->setDrawsContent(true); |
| 3888 testLayer->setTouchEventHandlerRegion(touchHandlerRegion); | 3888 testLayer->setTouchEventHandlerRegion(touchHandlerRegion); |
| 3889 root->addChild(testLayer.Pass()); | 3889 root->addChild(testLayer.Pass()); |
| 3890 } | 3890 } |
| 3891 | 3891 |
| 3892 std::vector<LayerImpl*> renderSurfaceLayerList; | 3892 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3893 int dummyMaxTextureSize = 512; | 3893 int dummyMaxTextureSize = 512; |
| 3894 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3894 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 3895 | 3895 |
| 3896 // Sanity check the scenario we just created. | 3896 // Sanity check the scenario we just created. |
| 3897 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3897 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
| 3898 LayerImpl* testLayer = root->children()[0]; | 3898 LayerImpl* testLayer = root->children()[0]; |
| 3899 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); | 3899 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); |
| 3900 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3900 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3901 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3901 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3902 | 3902 |
| 3903 // 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). | 3903 // 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). |
| 3904 gfx::Point testPoint(76, 76); | 3904 gfx::Point testPoint(76, 76); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3960 } | 3960 } |
| 3961 | 3961 |
| 3962 std::vector<LayerImpl*> renderSurfaceLayerList; | 3962 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 3963 int dummyMaxTextureSize = 512; | 3963 int dummyMaxTextureSize = 512; |
| 3964 float deviceScaleFactor = 3.0f; | 3964 float deviceScaleFactor = 3.0f; |
| 3965 float pageScaleFactor = 5.0f; | 3965 float pageScaleFactor = 5.0f; |
| 3966 gfx::Transform pageScaleTransform; | 3966 gfx::Transform pageScaleTransform; |
| 3967 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor); | 3967 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor); |
| 3968 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor
through implTransform. | 3968 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor
through implTransform. |
| 3969 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound
s(), deviceScaleFactor * pageScaleFactor)); | 3969 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound
s(), deviceScaleFactor * pageScaleFactor)); |
| 3970 LayerTreeHostCommon::calculateDrawProperties(root.get(), scaledBoundsForRoot
, deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 3970 LayerTreeHostCommon::calculateDrawProperties(root.get(), scaledBoundsForRoot
, deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList, fals
e); |
| 3971 | 3971 |
| 3972 // Sanity check the scenario we just created. | 3972 // Sanity check the scenario we just created. |
| 3973 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3973 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
| 3974 LayerImpl* testLayer = root->children()[0]; | 3974 LayerImpl* testLayer = root->children()[0]; |
| 3975 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3975 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3976 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3976 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3977 | 3977 |
| 3978 // Check whether the child layer fits into the root after scaled. | 3978 // Check whether the child layer fits into the root after scaled. |
| 3979 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont
entRect());; | 3979 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont
entRect());; |
| 3980 | 3980 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4044 bounds = gfx::Size(300, 300); | 4044 bounds = gfx::Size(300, 300); |
| 4045 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 4045 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 4046 child->setDrawsContent(true); | 4046 child->setDrawsContent(true); |
| 4047 child->setTouchEventHandlerRegion(touchHandlerRegion); | 4047 child->setTouchEventHandlerRegion(touchHandlerRegion); |
| 4048 clippingLayer->addChild(child.Pass()); | 4048 clippingLayer->addChild(child.Pass()); |
| 4049 root->addChild(clippingLayer.Pass()); | 4049 root->addChild(clippingLayer.Pass()); |
| 4050 } | 4050 } |
| 4051 | 4051 |
| 4052 std::vector<LayerImpl*> renderSurfaceLayerList; | 4052 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 4053 int dummyMaxTextureSize = 512; | 4053 int dummyMaxTextureSize = 512; |
| 4054 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); | 4054 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList, false); |
| 4055 | 4055 |
| 4056 // Sanity check the scenario we just created. | 4056 // Sanity check the scenario we just created. |
| 4057 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 4057 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 4058 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 4058 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 4059 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 4059 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 4060 | 4060 |
| 4061 // Hit checking for a point outside the layer should return a null pointer. | 4061 // Hit checking for a point outside the layer should return a null pointer. |
| 4062 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 4062 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
| 4063 gfx::Point testPoint(24, 24); | 4063 gfx::Point testPoint(24, 24); |
| 4064 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 4064 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4995 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); | 4995 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); |
| 4996 } | 4996 } |
| 4997 | 4997 |
| 4998 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, | 4998 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
| 4999 LCDTextTest, | 4999 LCDTextTest, |
| 5000 testing::Combine(testing::Bool(), | 5000 testing::Combine(testing::Bool(), |
| 5001 testing::Bool())); | 5001 testing::Bool())); |
| 5002 | 5002 |
| 5003 } // namespace | 5003 } // namespace |
| 5004 } // namespace cc | 5004 } // namespace cc |
| OLD | NEW |