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

Side by Side Diff: cc/layer_tree_host_common_unittest.cc

Issue 11465007: Move LayerSorter to exist locally only in layer_tree_host_common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_common.cc ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "cc/layer_impl.h" 11 #include "cc/layer_impl.h"
12 #include "cc/layer_sorter.h"
13 #include "cc/math_util.h" 12 #include "cc/math_util.h"
14 #include "cc/proxy.h" 13 #include "cc/proxy.h"
15 #include "cc/single_thread_proxy.h" 14 #include "cc/single_thread_proxy.h"
16 #include "cc/test/animation_test_common.h" 15 #include "cc/test/animation_test_common.h"
17 #include "cc/test/geometry_test_utils.h" 16 #include "cc/test/geometry_test_utils.h"
18 #include "cc/thread.h" 17 #include "cc/thread.h"
19 #include "ui/gfx/size_conversions.h"
20 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/gfx/quad_f.h"
21 #include "ui/gfx/size_conversions.h"
22 #include "ui/gfx/transform.h" 22 #include "ui/gfx/transform.h"
23 23
24 using namespace WebKitTests; 24 using namespace WebKitTests;
25 25
26 namespace cc { 26 namespace cc {
27 namespace { 27 namespace {
28 28
29 template<typename LayerType> 29 template<typename LayerType>
30 void setLayerPropertiesForTestingInternal(LayerType* layer, const gfx::Transform & transform, const gfx::Transform& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D) 30 void setLayerPropertiesForTestingInternal(LayerType* layer, const gfx::Transform & transform, const gfx::Transform& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
31 { 31 {
(...skipping 24 matching lines...) Expand all
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::calculateDrawProperties(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayer List); 61 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayer List);
62 } 62 }
63 63
64 void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto r = 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.
67
68 gfx::Transform identityMatrix; 66 gfx::Transform identityMatrix;
69 std::vector<LayerImpl*> dummyRenderSurfaceLayerList; 67 std::vector<LayerImpl*> dummyRenderSurfaceLayerList;
70 int dummyMaxTextureSize = 512; 68 int dummyMaxTextureSize = 512;
71 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);
72 70
73 // 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.
74 DCHECK(!rootLayer->bounds().IsEmpty()); 72 DCHECK(!rootLayer->bounds().IsEmpty());
75 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLa yerList); 73 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayer List);
76 } 74 }
77 75
78 scoped_ptr<LayerImpl> createTreeForFixedPositionTests() 76 scoped_ptr<LayerImpl> createTreeForFixedPositionTests()
79 { 77 {
80 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 78 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
81 scoped_ptr<LayerImpl> child = LayerImpl::create(2); 79 scoped_ptr<LayerImpl> child = LayerImpl::create(2);
82 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3); 80 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3);
83 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4); 81 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4);
84 82
85 gfx::Transform IdentityMatrix; 83 gfx::Transform IdentityMatrix;
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 2773
2776 gfx::Transform identityMatrix; 2774 gfx::Transform identityMatrix;
2777 gfx::PointF anchor(0, 0); 2775 gfx::PointF anchor(0, 0);
2778 gfx::PointF position(0, 0); 2776 gfx::PointF position(0, 0);
2779 gfx::Size bounds(100, 100); 2777 gfx::Size bounds(100, 100);
2780 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 2778 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
2781 root->setDrawsContent(true); 2779 root->setDrawsContent(true);
2782 2780
2783 std::vector<LayerImpl*> renderSurfaceLayerList; 2781 std::vector<LayerImpl*> renderSurfaceLayerList;
2784 int dummyMaxTextureSize = 512; 2782 int dummyMaxTextureSize = 512;
2785 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 2783 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
2786 2784
2787 // Sanity check the scenario we just created. 2785 // Sanity check the scenario we just created.
2788 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 2786 ASSERT_EQ(1u, renderSurfaceLayerList.size());
2789 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 2787 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
2790 2788
2791 // Hit testing for a point outside the layer should return a null pointer. 2789 // Hit testing for a point outside the layer should return a null pointer.
2792 gfx::Point testPoint(101, 101); 2790 gfx::Point testPoint(101, 101);
2793 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList); 2791 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList);
2794 EXPECT_FALSE(resultLayer); 2792 EXPECT_FALSE(resultLayer);
2795 2793
(...skipping 26 matching lines...) Expand all
2822 2820
2823 gfx::Transform identityMatrix; 2821 gfx::Transform identityMatrix;
2824 gfx::PointF anchor(0, 0); 2822 gfx::PointF anchor(0, 0);
2825 gfx::PointF position(0, 0); 2823 gfx::PointF position(0, 0);
2826 gfx::Size bounds(100, 100); 2824 gfx::Size bounds(100, 100);
2827 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr ix, anchor, position, bounds, false); 2825 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr ix, anchor, position, bounds, false);
2828 root->setDrawsContent(true); 2826 root->setDrawsContent(true);
2829 2827
2830 std::vector<LayerImpl*> renderSurfaceLayerList; 2828 std::vector<LayerImpl*> renderSurfaceLayerList;
2831 int dummyMaxTextureSize = 512; 2829 int dummyMaxTextureSize = 512;
2832 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 2830 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
2833 2831
2834 // Sanity check the scenario we just created. 2832 // Sanity check the scenario we just created.
2835 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 2833 ASSERT_EQ(1u, renderSurfaceLayerList.size());
2836 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 2834 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
2837 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); 2835 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible());
2838 2836
2839 // Hit testing any point should not hit the layer. If the invertible matrix is 2837 // 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 2838 // accidentally ignored and treated like an identity, then the hit testing w ill
2841 // incorrectly hit the layer when it shouldn't. 2839 // incorrectly hit the layer when it shouldn't.
2842 gfx::Point testPoint(1, 1); 2840 gfx::Point testPoint(1, 1);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 2872
2875 gfx::Transform identityMatrix; 2873 gfx::Transform identityMatrix;
2876 gfx::PointF anchor(0, 0); 2874 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. 2875 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); 2876 gfx::Size bounds(100, 100);
2879 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 2877 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
2880 root->setDrawsContent(true); 2878 root->setDrawsContent(true);
2881 2879
2882 std::vector<LayerImpl*> renderSurfaceLayerList; 2880 std::vector<LayerImpl*> renderSurfaceLayerList;
2883 int dummyMaxTextureSize = 512; 2881 int dummyMaxTextureSize = 512;
2884 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 2882 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
2885 2883
2886 // Sanity check the scenario we just created. 2884 // Sanity check the scenario we just created.
2887 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 2885 ASSERT_EQ(1u, renderSurfaceLayerList.size());
2888 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 2886 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
2889 2887
2890 // Hit testing for a point outside the layer should return a null pointer. 2888 // Hit testing for a point outside the layer should return a null pointer.
2891 gfx::Point testPoint(49, 49); 2889 gfx::Point testPoint(49, 49);
2892 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList); 2890 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList);
2893 EXPECT_FALSE(resultLayer); 2891 EXPECT_FALSE(resultLayer);
2894 2892
(...skipping 24 matching lines...) Expand all
2919 MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45); 2917 MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45);
2920 rotation45DegreesAboutCenter.Translate(-50, -50); 2918 rotation45DegreesAboutCenter.Translate(-50, -50);
2921 gfx::PointF anchor(0, 0); 2919 gfx::PointF anchor(0, 0);
2922 gfx::PointF position(0, 0); 2920 gfx::PointF position(0, 0);
2923 gfx::Size bounds(100, 100); 2921 gfx::Size bounds(100, 100);
2924 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident ityMatrix, anchor, position, bounds, false); 2922 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident ityMatrix, anchor, position, bounds, false);
2925 root->setDrawsContent(true); 2923 root->setDrawsContent(true);
2926 2924
2927 std::vector<LayerImpl*> renderSurfaceLayerList; 2925 std::vector<LayerImpl*> renderSurfaceLayerList;
2928 int dummyMaxTextureSize = 512; 2926 int dummyMaxTextureSize = 512;
2929 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 2927 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
2930 2928
2931 // Sanity check the scenario we just created. 2929 // Sanity check the scenario we just created.
2932 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 2930 ASSERT_EQ(1u, renderSurfaceLayerList.size());
2933 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 2931 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
2934 2932
2935 // Hit testing for points outside the layer. 2933 // 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. 2934 // 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); 2935 gfx::Point testPoint(99, 99);
2938 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList); 2936 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList);
2939 EXPECT_FALSE(resultLayer); 2937 EXPECT_FALSE(resultLayer);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2973 translationByZ.Translate3d(0, 0, -1); 2971 translationByZ.Translate3d(0, 0, -1);
2974 2972
2975 gfx::PointF anchor(0, 0); 2973 gfx::PointF anchor(0, 0);
2976 gfx::PointF position(0, 0); 2974 gfx::PointF position(0, 0);
2977 gfx::Size bounds(100, 100); 2975 gfx::Size bounds(100, 100);
2978 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter * translationByZ, identityMatrix, anchor, position, bounds, false); 2976 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter * translationByZ, identityMatrix, anchor, position, bounds, false);
2979 root->setDrawsContent(true); 2977 root->setDrawsContent(true);
2980 2978
2981 std::vector<LayerImpl*> renderSurfaceLayerList; 2979 std::vector<LayerImpl*> renderSurfaceLayerList;
2982 int dummyMaxTextureSize = 512; 2980 int dummyMaxTextureSize = 512;
2983 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 2981 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
2984 2982
2985 // Sanity check the scenario we just created. 2983 // Sanity check the scenario we just created.
2986 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 2984 ASSERT_EQ(1u, renderSurfaceLayerList.size());
2987 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 2985 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
2988 2986
2989 // Hit testing for points outside the layer. 2987 // 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. 2988 // 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); 2989 gfx::Point testPoint(24, 24);
2992 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList); 2990 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList);
2993 EXPECT_FALSE(resultLayer); 2991 EXPECT_FALSE(resultLayer);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 // override contentBounds and contentsScale 3034 // override contentBounds and contentsScale
3037 testLayer->setContentBounds(gfx::Size(100, 100)); 3035 testLayer->setContentBounds(gfx::Size(100, 100));
3038 testLayer->setContentsScale(2, 2); 3036 testLayer->setContentsScale(2, 2);
3039 3037
3040 testLayer->setDrawsContent(true); 3038 testLayer->setDrawsContent(true);
3041 root->addChild(testLayer.Pass()); 3039 root->addChild(testLayer.Pass());
3042 } 3040 }
3043 3041
3044 std::vector<LayerImpl*> renderSurfaceLayerList; 3042 std::vector<LayerImpl*> renderSurfaceLayerList;
3045 int dummyMaxTextureSize = 512; 3043 int dummyMaxTextureSize = 512;
3046 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3044 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3047 3045
3048 // Sanity check the scenario we just created. 3046 // 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. 3047 // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25.
3050 LayerImpl* testLayer = root->children()[0]; 3048 LayerImpl* testLayer = root->children()[0];
3051 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi bleContentRect()); 3049 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi bleContentRect());
3052 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3050 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3053 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3051 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3054 3052
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). 3053 // 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); 3054 gfx::Point testPoint(101, 101);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 position = gfx::PointF(-50, -50); 3096 position = gfx::PointF(-50, -50);
3099 bounds = gfx::Size(300, 300); 3097 bounds = gfx::Size(300, 300);
3100 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false); 3098 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false);
3101 child->setDrawsContent(true); 3099 child->setDrawsContent(true);
3102 clippingLayer->addChild(child.Pass()); 3100 clippingLayer->addChild(child.Pass());
3103 root->addChild(clippingLayer.Pass()); 3101 root->addChild(clippingLayer.Pass());
3104 } 3102 }
3105 3103
3106 std::vector<LayerImpl*> renderSurfaceLayerList; 3104 std::vector<LayerImpl*> renderSurfaceLayerList;
3107 int dummyMaxTextureSize = 512; 3105 int dummyMaxTextureSize = 512;
3108 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3106 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3109 3107
3110 // Sanity check the scenario we just created. 3108 // Sanity check the scenario we just created.
3111 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3109 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3112 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3110 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3113 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); 3111 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id());
3114 3112
3115 // Hit testing for a point outside the layer should return a null pointer. 3113 // 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. 3114 // Despite the child layer being very large, it should be clipped to the roo t layer's bounds.
3117 gfx::Point testPoint(24, 24); 3115 gfx::Point testPoint(24, 24);
3118 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList); 3116 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id entityMatrix, anchor, position, bounds, false); 3184 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id entityMatrix, anchor, position, bounds, false);
3187 rotatedLeaf->setDrawsContent(true); 3185 rotatedLeaf->setDrawsContent(true);
3188 3186
3189 grandChild->addChild(rotatedLeaf.Pass()); 3187 grandChild->addChild(rotatedLeaf.Pass());
3190 child->addChild(grandChild.Pass()); 3188 child->addChild(grandChild.Pass());
3191 root->addChild(child.Pass()); 3189 root->addChild(child.Pass());
3192 } 3190 }
3193 3191
3194 std::vector<LayerImpl*> renderSurfaceLayerList; 3192 std::vector<LayerImpl*> renderSurfaceLayerList;
3195 int dummyMaxTextureSize = 512; 3193 int dummyMaxTextureSize = 512;
3196 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3194 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3197 3195
3198 // Sanity check the scenario we just created. 3196 // 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. 3197 // The grandChild is expected to create a renderSurface because it masksToBo unds and is not axis aligned.
3200 ASSERT_EQ(2u, renderSurfaceLayerList.size()); 3198 ASSERT_EQ(2u, renderSurfaceLayerList.size());
3201 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size() ); 3199 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size() );
3202 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i d()); // grandChild's surface. 3200 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i d()); // grandChild's surface.
3203 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size() ); 3201 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size() );
3204 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]-> id()); 3202 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]-> id());
3205 3203
3206 // (11, 89) is close to the the bottom left corner within the clip, but it i s not inside the layer. 3204 // (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
3266 position = gfx::PointF(60, 60); // 70, 70 in screen space 3264 position = gfx::PointF(60, 60); // 70, 70 in screen space
3267 bounds = gfx::Size(20, 20); 3265 bounds = gfx::Size(20, 20);
3268 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false); 3266 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false);
3269 child->setDrawsContent(true); 3267 child->setDrawsContent(true);
3270 intermediateLayer->addChild(child.Pass()); 3268 intermediateLayer->addChild(child.Pass());
3271 root->addChild(intermediateLayer.Pass()); 3269 root->addChild(intermediateLayer.Pass());
3272 } 3270 }
3273 3271
3274 std::vector<LayerImpl*> renderSurfaceLayerList; 3272 std::vector<LayerImpl*> renderSurfaceLayerList;
3275 int dummyMaxTextureSize = 512; 3273 int dummyMaxTextureSize = 512;
3276 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3274 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3277 3275
3278 // Sanity check the scenario we just created. 3276 // Sanity check the scenario we just created.
3279 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3277 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3280 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3278 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3281 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); 3279 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id());
3282 3280
3283 // Hit testing for a point outside the layer should return a null pointer. 3281 // Hit testing for a point outside the layer should return a null pointer.
3284 gfx::Point testPoint(69, 69); 3282 gfx::Point testPoint(69, 69);
3285 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList); 3283 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList);
3286 EXPECT_FALSE(resultLayer); 3284 EXPECT_FALSE(resultLayer);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3344 root->addChild(child1.Pass()); 3342 root->addChild(child1.Pass());
3345 root->addChild(child2.Pass()); 3343 root->addChild(child2.Pass());
3346 } 3344 }
3347 3345
3348 LayerImpl* child1 = root->children()[0]; 3346 LayerImpl* child1 = root->children()[0];
3349 LayerImpl* child2 = root->children()[1]; 3347 LayerImpl* child2 = root->children()[1];
3350 LayerImpl* grandChild1 = child1->children()[0]; 3348 LayerImpl* grandChild1 = child1->children()[0];
3351 3349
3352 std::vector<LayerImpl*> renderSurfaceLayerList; 3350 std::vector<LayerImpl*> renderSurfaceLayerList;
3353 int dummyMaxTextureSize = 512; 3351 int dummyMaxTextureSize = 512;
3354 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3352 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3355 3353
3356 // Sanity check the scenario we just created. 3354 // Sanity check the scenario we just created.
3357 ASSERT_TRUE(child1); 3355 ASSERT_TRUE(child1);
3358 ASSERT_TRUE(child2); 3356 ASSERT_TRUE(child2);
3359 ASSERT_TRUE(grandChild1); 3357 ASSERT_TRUE(grandChild1);
3360 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3358 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3361 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); 3359 ASSERT_EQ(4u, root->renderSurface()->layerList().size());
3362 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer 3360 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer
3363 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 3361 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1
3364 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 3362 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3450 root->addChild(child1.Pass()); 3448 root->addChild(child1.Pass());
3451 root->addChild(child2.Pass()); 3449 root->addChild(child2.Pass());
3452 } 3450 }
3453 3451
3454 LayerImpl* child1 = root->children()[0]; 3452 LayerImpl* child1 = root->children()[0];
3455 LayerImpl* child2 = root->children()[1]; 3453 LayerImpl* child2 = root->children()[1];
3456 LayerImpl* grandChild1 = child1->children()[0]; 3454 LayerImpl* grandChild1 = child1->children()[0];
3457 3455
3458 std::vector<LayerImpl*> renderSurfaceLayerList; 3456 std::vector<LayerImpl*> renderSurfaceLayerList;
3459 int dummyMaxTextureSize = 512; 3457 int dummyMaxTextureSize = 512;
3460 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3458 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3461 3459
3462 // Sanity check the scenario we just created. 3460 // Sanity check the scenario we just created.
3463 ASSERT_TRUE(child1); 3461 ASSERT_TRUE(child1);
3464 ASSERT_TRUE(child2); 3462 ASSERT_TRUE(child2);
3465 ASSERT_TRUE(grandChild1); 3463 ASSERT_TRUE(grandChild1);
3466 ASSERT_TRUE(child1->renderSurface()); 3464 ASSERT_TRUE(child1->renderSurface());
3467 ASSERT_TRUE(child2->renderSurface()); 3465 ASSERT_TRUE(child2->renderSurface());
3468 ASSERT_TRUE(grandChild1->renderSurface()); 3466 ASSERT_TRUE(grandChild1->renderSurface());
3469 ASSERT_EQ(4u, renderSurfaceLayerList.size()); 3467 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. 3468 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
3534 gfx::Transform identityMatrix; 3532 gfx::Transform identityMatrix;
3535 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); 3533 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
3536 gfx::PointF anchor(0, 0); 3534 gfx::PointF anchor(0, 0);
3537 gfx::PointF position(0, 0); 3535 gfx::PointF position(0, 0);
3538 gfx::Size bounds(100, 100); 3536 gfx::Size bounds(100, 100);
3539 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3537 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3540 root->setDrawsContent(true); 3538 root->setDrawsContent(true);
3541 3539
3542 std::vector<LayerImpl*> renderSurfaceLayerList; 3540 std::vector<LayerImpl*> renderSurfaceLayerList;
3543 int dummyMaxTextureSize = 512; 3541 int dummyMaxTextureSize = 512;
3544 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3542 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3545 3543
3546 // Sanity check the scenario we just created. 3544 // Sanity check the scenario we just created.
3547 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3545 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3548 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3546 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3549 3547
3550 // Hit checking for any point should return a null pointer for a layer witho ut any touch event handler regions. 3548 // 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); 3549 gfx::Point testPoint(11, 11);
3552 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou chHandlerRegion(testPoint, renderSurfaceLayerList); 3550 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou chHandlerRegion(testPoint, renderSurfaceLayerList);
3553 EXPECT_FALSE(resultLayer); 3551 EXPECT_FALSE(resultLayer);
3554 3552
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3598 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); 3596 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
3599 gfx::PointF anchor(0, 0); 3597 gfx::PointF anchor(0, 0);
3600 gfx::PointF position(0, 0); 3598 gfx::PointF position(0, 0);
3601 gfx::Size bounds(100, 100); 3599 gfx::Size bounds(100, 100);
3602 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr ix, anchor, position, bounds, false); 3600 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr ix, anchor, position, bounds, false);
3603 root->setDrawsContent(true); 3601 root->setDrawsContent(true);
3604 root->setTouchEventHandlerRegion(touchHandlerRegion); 3602 root->setTouchEventHandlerRegion(touchHandlerRegion);
3605 3603
3606 std::vector<LayerImpl*> renderSurfaceLayerList; 3604 std::vector<LayerImpl*> renderSurfaceLayerList;
3607 int dummyMaxTextureSize = 512; 3605 int dummyMaxTextureSize = 512;
3608 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3606 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3609 3607
3610 // Sanity check the scenario we just created. 3608 // Sanity check the scenario we just created.
3611 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3609 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3612 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3610 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3613 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); 3611 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible());
3614 3612
3615 // Hit checking any point should not hit the touch handler region on the lay er. If the invertible matrix is 3613 // 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 3614 // accidentally ignored and treated like an identity, then the hit testing w ill
3617 // incorrectly hit the layer when it shouldn't. 3615 // incorrectly hit the layer when it shouldn't.
3618 gfx::Point testPoint(1, 1); 3616 gfx::Point testPoint(1, 1);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3652 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); 3650 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
3653 gfx::PointF anchor(0, 0); 3651 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. 3652 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); 3653 gfx::Size bounds(100, 100);
3656 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3654 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3657 root->setDrawsContent(true); 3655 root->setDrawsContent(true);
3658 root->setTouchEventHandlerRegion(touchHandlerRegion); 3656 root->setTouchEventHandlerRegion(touchHandlerRegion);
3659 3657
3660 std::vector<LayerImpl*> renderSurfaceLayerList; 3658 std::vector<LayerImpl*> renderSurfaceLayerList;
3661 int dummyMaxTextureSize = 512; 3659 int dummyMaxTextureSize = 512;
3662 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3660 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3663 3661
3664 // Sanity check the scenario we just created. 3662 // Sanity check the scenario we just created.
3665 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3663 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3666 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3664 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3667 3665
3668 // Hit checking for a point outside the layer should return a null pointer. 3666 // Hit checking for a point outside the layer should return a null pointer.
3669 gfx::Point testPoint(49, 49); 3667 gfx::Point testPoint(49, 49);
3670 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou chHandlerRegion(testPoint, renderSurfaceLayerList); 3668 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou chHandlerRegion(testPoint, renderSurfaceLayerList);
3671 EXPECT_FALSE(resultLayer); 3669 EXPECT_FALSE(resultLayer);
3672 3670
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3722 testLayer->setContentBounds(gfx::Size(100, 100)); 3720 testLayer->setContentBounds(gfx::Size(100, 100));
3723 testLayer->setContentsScale(2, 2); 3721 testLayer->setContentsScale(2, 2);
3724 3722
3725 testLayer->setDrawsContent(true); 3723 testLayer->setDrawsContent(true);
3726 testLayer->setTouchEventHandlerRegion(touchHandlerRegion); 3724 testLayer->setTouchEventHandlerRegion(touchHandlerRegion);
3727 root->addChild(testLayer.Pass()); 3725 root->addChild(testLayer.Pass());
3728 } 3726 }
3729 3727
3730 std::vector<LayerImpl*> renderSurfaceLayerList; 3728 std::vector<LayerImpl*> renderSurfaceLayerList;
3731 int dummyMaxTextureSize = 512; 3729 int dummyMaxTextureSize = 512;
3732 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3730 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3733 3731
3734 // Sanity check the scenario we just created. 3732 // 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. 3733 // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25.
3736 LayerImpl* testLayer = root->children()[0]; 3734 LayerImpl* testLayer = root->children()[0];
3737 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi bleContentRect()); 3735 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi bleContentRect());
3738 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3736 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3739 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3737 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3740 3738
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). 3739 // 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); 3740 gfx::Point testPoint(76, 76);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 } 3794 }
3797 3795
3798 std::vector<LayerImpl*> renderSurfaceLayerList; 3796 std::vector<LayerImpl*> renderSurfaceLayerList;
3799 int dummyMaxTextureSize = 512; 3797 int dummyMaxTextureSize = 512;
3800 float deviceScaleFactor = 3.0f; 3798 float deviceScaleFactor = 3.0f;
3801 float pageScaleFactor = 5.0f; 3799 float pageScaleFactor = 5.0f;
3802 gfx::Transform pageScaleTransform; 3800 gfx::Transform pageScaleTransform;
3803 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor); 3801 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor);
3804 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor through implTransform. 3802 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor through implTransform.
3805 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound s(), deviceScaleFactor * pageScaleFactor)); 3803 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound s(), deviceScaleFactor * pageScaleFactor));
3806 LayerTreeHostCommon::calculateDrawProperties(root.get(), scaledBoundsForRoot , deviceScaleFactor, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3804 LayerTreeHostCommon::calculateDrawProperties(root.get(), scaledBoundsForRoot , deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3807 3805
3808 // Sanity check the scenario we just created. 3806 // 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. 3807 // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25.
3810 LayerImpl* testLayer = root->children()[0]; 3808 LayerImpl* testLayer = root->children()[0];
3811 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3809 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3812 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3810 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3813 3811
3814 // Check whether the child layer fits into the root after scaled. 3812 // Check whether the child layer fits into the root after scaled.
3815 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont entRect());; 3813 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont entRect());;
3816 3814
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3878 bounds = gfx::Size(300, 300); 3876 bounds = gfx::Size(300, 300);
3879 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false); 3877 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false);
3880 child->setDrawsContent(true); 3878 child->setDrawsContent(true);
3881 child->setTouchEventHandlerRegion(touchHandlerRegion); 3879 child->setTouchEventHandlerRegion(touchHandlerRegion);
3882 clippingLayer->addChild(child.Pass()); 3880 clippingLayer->addChild(child.Pass());
3883 root->addChild(clippingLayer.Pass()); 3881 root->addChild(clippingLayer.Pass());
3884 } 3882 }
3885 3883
3886 std::vector<LayerImpl*> renderSurfaceLayerList; 3884 std::vector<LayerImpl*> renderSurfaceLayerList;
3887 int dummyMaxTextureSize = 512; 3885 int dummyMaxTextureSize = 512;
3888 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3886 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
3889 3887
3890 // Sanity check the scenario we just created. 3888 // Sanity check the scenario we just created.
3891 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3889 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3892 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3890 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3893 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); 3891 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id());
3894 3892
3895 // Hit checking for a point outside the layer should return a null pointer. 3893 // 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. 3894 // Despite the child layer being very large, it should be clipped to the roo t layer's bounds.
3897 gfx::Point testPoint(24, 24); 3895 gfx::Point testPoint(24, 24);
3898 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou chHandlerRegion(testPoint, renderSurfaceLayerList); 3896 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou chHandlerRegion(testPoint, renderSurfaceLayerList);
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
4635 child->addChild(grandChild); 4633 child->addChild(grandChild);
4636 child->setOpacity(0.5f); 4634 child->setOpacity(0.5f);
4637 4635
4638 executeCalculateDrawProperties(root.get()); 4636 executeCalculateDrawProperties(root.get());
4639 4637
4640 EXPECT_FALSE(child->renderSurface()); 4638 EXPECT_FALSE(child->renderSurface());
4641 } 4639 }
4642 4640
4643 } // namespace 4641 } // namespace
4644 } // namespace cc 4642 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_common.cc ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698