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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1))); | 188 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1))); |
189 host_impl_->DidFinishImplFrame(); | 189 host_impl_->DidFinishImplFrame(); |
190 return init; | 190 return init; |
191 } | 191 } |
192 | 192 |
193 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { | 193 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { |
194 root->SetPosition(gfx::PointF()); | 194 root->SetPosition(gfx::PointF()); |
195 root->SetBounds(gfx::Size(10, 10)); | 195 root->SetBounds(gfx::Size(10, 10)); |
196 root->SetDrawsContent(true); | 196 root->SetDrawsContent(true); |
197 root->draw_properties().visible_layer_rect = gfx::Rect(0, 0, 10, 10); | 197 root->draw_properties().visible_layer_rect = gfx::Rect(0, 0, 10, 10); |
198 root->SetHasRenderSurface(true); | 198 root->SetForceRenderSurface(true); |
199 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 199 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
200 } | 200 } |
201 | 201 |
202 static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) { | 202 static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) { |
203 ASSERT_EQ(layer->ScrollDelta(), gfx::Vector2d()); | 203 ASSERT_EQ(layer->ScrollDelta(), gfx::Vector2d()); |
204 for (size_t i = 0; i < layer->children().size(); ++i) | 204 for (size_t i = 0; i < layer->children().size(); ++i) |
205 ExpectClearedScrollDeltasRecursive(layer->children()[i].get()); | 205 ExpectClearedScrollDeltasRecursive(layer->children()[i].get()); |
206 } | 206 } |
207 | 207 |
208 static ::testing::AssertionResult ScrollInfoContains( | 208 static ::testing::AssertionResult ScrollInfoContains( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 const int kOuterViewportScrollLayerId = 117; | 249 const int kOuterViewportScrollLayerId = 117; |
250 const int kContentLayerId = 118; | 250 const int kContentLayerId = 118; |
251 const int kInnerViewportScrollLayerId = 2; | 251 const int kInnerViewportScrollLayerId = 2; |
252 const int kInnerViewportClipLayerId = 4; | 252 const int kInnerViewportClipLayerId = 4; |
253 const int kPageScaleLayerId = 5; | 253 const int kPageScaleLayerId = 5; |
254 | 254 |
255 scoped_ptr<LayerImpl> root = | 255 scoped_ptr<LayerImpl> root = |
256 LayerImpl::Create(layer_tree_impl, 1); | 256 LayerImpl::Create(layer_tree_impl, 1); |
257 root->SetBounds(content_size); | 257 root->SetBounds(content_size); |
258 root->SetPosition(gfx::PointF()); | 258 root->SetPosition(gfx::PointF()); |
259 root->SetHasRenderSurface(true); | 259 root->SetForceRenderSurface(true); |
260 | 260 |
261 scoped_ptr<LayerImpl> inner_scroll = | 261 scoped_ptr<LayerImpl> inner_scroll = |
262 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); | 262 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); |
263 inner_scroll->SetIsContainerForFixedPositionLayers(true); | 263 inner_scroll->SetIsContainerForFixedPositionLayers(true); |
264 inner_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); | 264 inner_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); |
265 | 265 |
266 scoped_ptr<LayerImpl> inner_clip = | 266 scoped_ptr<LayerImpl> inner_clip = |
267 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 267 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
268 inner_clip->SetBounds( | 268 inner_clip->SetBounds( |
269 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 269 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 TEST_F(LayerTreeHostImplTest, AnimationSchedulingPendingTree) { | 1102 TEST_F(LayerTreeHostImplTest, AnimationSchedulingPendingTree) { |
1103 EXPECT_FALSE(host_impl_->CommitToActiveTree()); | 1103 EXPECT_FALSE(host_impl_->CommitToActiveTree()); |
1104 | 1104 |
1105 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 1105 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
1106 | 1106 |
1107 host_impl_->CreatePendingTree(); | 1107 host_impl_->CreatePendingTree(); |
1108 host_impl_->pending_tree()->SetRootLayer( | 1108 host_impl_->pending_tree()->SetRootLayer( |
1109 LayerImpl::Create(host_impl_->pending_tree(), 1)); | 1109 LayerImpl::Create(host_impl_->pending_tree(), 1)); |
1110 LayerImpl* root = host_impl_->pending_tree()->root_layer(); | 1110 LayerImpl* root = host_impl_->pending_tree()->root_layer(); |
1111 root->SetBounds(gfx::Size(50, 50)); | 1111 root->SetBounds(gfx::Size(50, 50)); |
1112 root->SetHasRenderSurface(true); | 1112 root->SetForceRenderSurface(true); |
1113 | 1113 |
1114 root->AddChild(LayerImpl::Create(host_impl_->pending_tree(), 2)); | 1114 root->AddChild(LayerImpl::Create(host_impl_->pending_tree(), 2)); |
1115 LayerImpl* child = root->children()[0].get(); | 1115 LayerImpl* child = root->children()[0].get(); |
1116 child->SetBounds(gfx::Size(10, 10)); | 1116 child->SetBounds(gfx::Size(10, 10)); |
1117 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1117 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1118 child->SetDrawsContent(true); | 1118 child->SetDrawsContent(true); |
1119 AddAnimatedTransformToLayer(child, 10.0, 3, 0); | 1119 AddAnimatedTransformToLayer(child, 10.0, 3, 0); |
1120 | 1120 |
1121 EXPECT_FALSE(did_request_next_frame_); | 1121 EXPECT_FALSE(did_request_next_frame_); |
1122 EXPECT_FALSE(did_request_redraw_); | 1122 EXPECT_FALSE(did_request_redraw_); |
(...skipping 29 matching lines...) Expand all Loading... |
1152 | 1152 |
1153 TEST_F(LayerTreeHostImplTest, AnimationSchedulingActiveTree) { | 1153 TEST_F(LayerTreeHostImplTest, AnimationSchedulingActiveTree) { |
1154 EXPECT_FALSE(host_impl_->CommitToActiveTree()); | 1154 EXPECT_FALSE(host_impl_->CommitToActiveTree()); |
1155 | 1155 |
1156 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 1156 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
1157 | 1157 |
1158 host_impl_->active_tree()->SetRootLayer( | 1158 host_impl_->active_tree()->SetRootLayer( |
1159 LayerImpl::Create(host_impl_->active_tree(), 1)); | 1159 LayerImpl::Create(host_impl_->active_tree(), 1)); |
1160 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 1160 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
1161 root->SetBounds(gfx::Size(50, 50)); | 1161 root->SetBounds(gfx::Size(50, 50)); |
1162 root->SetHasRenderSurface(true); | 1162 root->SetForceRenderSurface(true); |
1163 | 1163 |
1164 root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2)); | 1164 root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2)); |
1165 LayerImpl* child = root->children()[0].get(); | 1165 LayerImpl* child = root->children()[0].get(); |
1166 child->SetBounds(gfx::Size(10, 10)); | 1166 child->SetBounds(gfx::Size(10, 10)); |
1167 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); | 1167 child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
1168 child->SetDrawsContent(true); | 1168 child->SetDrawsContent(true); |
1169 | 1169 |
1170 // Add a translate from 6,7 to 8,9. | 1170 // Add a translate from 6,7 to 8,9. |
1171 TransformOperations start; | 1171 TransformOperations start; |
1172 start.AppendTranslate(6.f, 7.f, 0.f); | 1172 start.AppendTranslate(6.f, 7.f, 0.f); |
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 append_quads_called_ = false; | 2984 append_quads_called_ = false; |
2985 did_draw_called_ = false; | 2985 did_draw_called_ = false; |
2986 } | 2986 } |
2987 | 2987 |
2988 static void IgnoreResult(scoped_ptr<CopyOutputResult> result) {} | 2988 static void IgnoreResult(scoped_ptr<CopyOutputResult> result) {} |
2989 | 2989 |
2990 void AddCopyRequest() { | 2990 void AddCopyRequest() { |
2991 std::vector<scoped_ptr<CopyOutputRequest>> requests; | 2991 std::vector<scoped_ptr<CopyOutputRequest>> requests; |
2992 requests.push_back( | 2992 requests.push_back( |
2993 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreResult))); | 2993 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreResult))); |
2994 SetHasRenderSurface(true); | 2994 SetForceRenderSurface(true); |
2995 PassCopyRequests(&requests); | 2995 PassCopyRequests(&requests); |
2996 } | 2996 } |
2997 | 2997 |
2998 protected: | 2998 protected: |
2999 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) | 2999 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) |
3000 : LayerImpl(tree_impl, id), | 3000 : LayerImpl(tree_impl, id), |
3001 will_draw_returns_false_(false), | 3001 will_draw_returns_false_(false), |
3002 will_draw_called_(false), | 3002 will_draw_called_(false), |
3003 append_quads_called_(false), | 3003 append_quads_called_(false), |
3004 did_draw_called_(false) { | 3004 did_draw_called_(false) { |
(...skipping 11 matching lines...) Expand all Loading... |
3016 | 3016 |
3017 TEST_F(LayerTreeHostImplTest, WillDrawReturningFalseDoesNotCall) { | 3017 TEST_F(LayerTreeHostImplTest, WillDrawReturningFalseDoesNotCall) { |
3018 // The root layer is always drawn, so run this test on a child layer that | 3018 // The root layer is always drawn, so run this test on a child layer that |
3019 // will be masked out by the root layer's bounds. | 3019 // will be masked out by the root layer's bounds. |
3020 host_impl_->active_tree()->SetRootLayer( | 3020 host_impl_->active_tree()->SetRootLayer( |
3021 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 3021 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
3022 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>( | 3022 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>( |
3023 host_impl_->active_tree()->root_layer()); | 3023 host_impl_->active_tree()->root_layer()); |
3024 | 3024 |
3025 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); | 3025 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); |
3026 root->SetHasRenderSurface(true); | 3026 root->SetForceRenderSurface(true); |
3027 DidDrawCheckLayer* layer = | 3027 DidDrawCheckLayer* layer = |
3028 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); | 3028 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); |
3029 | 3029 |
3030 { | 3030 { |
3031 LayerTreeHostImpl::FrameData frame; | 3031 LayerTreeHostImpl::FrameData frame; |
3032 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 3032 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
3033 host_impl_->DrawLayers(&frame); | 3033 host_impl_->DrawLayers(&frame); |
3034 host_impl_->DidDrawAllLayers(frame); | 3034 host_impl_->DidDrawAllLayers(frame); |
3035 | 3035 |
3036 EXPECT_TRUE(layer->will_draw_called()); | 3036 EXPECT_TRUE(layer->will_draw_called()); |
(...skipping 20 matching lines...) Expand all Loading... |
3057 } | 3057 } |
3058 | 3058 |
3059 TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) { | 3059 TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) { |
3060 // The root layer is always drawn, so run this test on a child layer that | 3060 // The root layer is always drawn, so run this test on a child layer that |
3061 // will be masked out by the root layer's bounds. | 3061 // will be masked out by the root layer's bounds. |
3062 host_impl_->active_tree()->SetRootLayer( | 3062 host_impl_->active_tree()->SetRootLayer( |
3063 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 3063 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
3064 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>( | 3064 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>( |
3065 host_impl_->active_tree()->root_layer()); | 3065 host_impl_->active_tree()->root_layer()); |
3066 root->SetMasksToBounds(true); | 3066 root->SetMasksToBounds(true); |
3067 root->SetHasRenderSurface(true); | 3067 root->SetForceRenderSurface(true); |
3068 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); | 3068 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); |
3069 DidDrawCheckLayer* layer = | 3069 DidDrawCheckLayer* layer = |
3070 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); | 3070 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); |
3071 // Ensure visible_layer_rect for layer is empty. | 3071 // Ensure visible_layer_rect for layer is empty. |
3072 layer->SetPosition(gfx::PointF(100.f, 100.f)); | 3072 layer->SetPosition(gfx::PointF(100.f, 100.f)); |
3073 layer->SetBounds(gfx::Size(10, 10)); | 3073 layer->SetBounds(gfx::Size(10, 10)); |
3074 | 3074 |
3075 LayerTreeHostImpl::FrameData frame; | 3075 LayerTreeHostImpl::FrameData frame; |
3076 | 3076 |
3077 EXPECT_FALSE(layer->will_draw_called()); | 3077 EXPECT_FALSE(layer->will_draw_called()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3110 host_impl_->active_tree()->SetRootLayer( | 3110 host_impl_->active_tree()->SetRootLayer( |
3111 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 3111 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
3112 DidDrawCheckLayer* root = | 3112 DidDrawCheckLayer* root = |
3113 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 3113 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
3114 | 3114 |
3115 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); | 3115 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); |
3116 DidDrawCheckLayer* occluded_layer = | 3116 DidDrawCheckLayer* occluded_layer = |
3117 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); | 3117 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); |
3118 | 3118 |
3119 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | 3119 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
3120 root->SetHasRenderSurface(true); | 3120 root->SetForceRenderSurface(true); |
3121 DidDrawCheckLayer* top_layer = | 3121 DidDrawCheckLayer* top_layer = |
3122 static_cast<DidDrawCheckLayer*>(root->children()[1].get()); | 3122 static_cast<DidDrawCheckLayer*>(root->children()[1].get()); |
3123 // This layer covers the occluded_layer above. Make this layer large so it can | 3123 // This layer covers the occluded_layer above. Make this layer large so it can |
3124 // occlude. | 3124 // occlude. |
3125 top_layer->SetBounds(big_size); | 3125 top_layer->SetBounds(big_size); |
3126 top_layer->SetContentsOpaque(true); | 3126 top_layer->SetContentsOpaque(true); |
3127 | 3127 |
3128 LayerTreeHostImpl::FrameData frame; | 3128 LayerTreeHostImpl::FrameData frame; |
3129 | 3129 |
3130 EXPECT_FALSE(occluded_layer->will_draw_called()); | 3130 EXPECT_FALSE(occluded_layer->will_draw_called()); |
(...skipping 11 matching lines...) Expand all Loading... |
3142 EXPECT_TRUE(top_layer->did_draw_called()); | 3142 EXPECT_TRUE(top_layer->did_draw_called()); |
3143 } | 3143 } |
3144 | 3144 |
3145 TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) { | 3145 TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) { |
3146 host_impl_->active_tree()->SetRootLayer( | 3146 host_impl_->active_tree()->SetRootLayer( |
3147 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 3147 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
3148 DidDrawCheckLayer* root = | 3148 DidDrawCheckLayer* root = |
3149 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 3149 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
3150 | 3150 |
3151 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); | 3151 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); |
3152 root->SetHasRenderSurface(true); | 3152 root->SetForceRenderSurface(true); |
3153 DidDrawCheckLayer* layer1 = | 3153 DidDrawCheckLayer* layer1 = |
3154 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); | 3154 static_cast<DidDrawCheckLayer*>(root->children()[0].get()); |
3155 | 3155 |
3156 layer1->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | 3156 layer1->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
3157 DidDrawCheckLayer* layer2 = | 3157 DidDrawCheckLayer* layer2 = |
3158 static_cast<DidDrawCheckLayer*>(layer1->children()[0].get()); | 3158 static_cast<DidDrawCheckLayer*>(layer1->children()[0].get()); |
3159 | 3159 |
3160 layer1->SetHasRenderSurface(true); | 3160 layer1->SetForceRenderSurface(true); |
3161 layer1->SetShouldFlattenTransform(true); | 3161 layer1->SetShouldFlattenTransform(true); |
3162 | 3162 |
3163 EXPECT_FALSE(root->did_draw_called()); | 3163 EXPECT_FALSE(root->did_draw_called()); |
3164 EXPECT_FALSE(layer1->did_draw_called()); | 3164 EXPECT_FALSE(layer1->did_draw_called()); |
3165 EXPECT_FALSE(layer2->did_draw_called()); | 3165 EXPECT_FALSE(layer2->did_draw_called()); |
3166 | 3166 |
3167 LayerTreeHostImpl::FrameData frame; | 3167 LayerTreeHostImpl::FrameData frame; |
3168 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( | 3168 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( |
3169 host_impl_->active_tree()->root_layer()); | 3169 host_impl_->active_tree()->root_layer()); |
3170 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 3170 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3307 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT)); | 3307 PrepareToDrawSuccessTestCase(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT)); |
3308 cases.back().high_res_required = true; | 3308 cases.back().high_res_required = true; |
3309 cases.back().layer_between.has_missing_tile = true; | 3309 cases.back().layer_between.has_missing_tile = true; |
3310 cases.back().layer_before.has_missing_tile = true; | 3310 cases.back().layer_before.has_missing_tile = true; |
3311 cases.back().layer_before.is_animating = true; | 3311 cases.back().layer_before.is_animating = true; |
3312 | 3312 |
3313 host_impl_->active_tree()->SetRootLayer( | 3313 host_impl_->active_tree()->SetRootLayer( |
3314 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 3314 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
3315 DidDrawCheckLayer* root = | 3315 DidDrawCheckLayer* root = |
3316 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 3316 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
3317 root->SetHasRenderSurface(true); | 3317 root->SetForceRenderSurface(true); |
3318 | 3318 |
3319 LayerTreeHostImpl::FrameData frame; | 3319 LayerTreeHostImpl::FrameData frame; |
3320 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 3320 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
3321 host_impl_->DrawLayers(&frame); | 3321 host_impl_->DrawLayers(&frame); |
3322 host_impl_->DidDrawAllLayers(frame); | 3322 host_impl_->DidDrawAllLayers(frame); |
3323 host_impl_->SwapBuffers(frame); | 3323 host_impl_->SwapBuffers(frame); |
3324 | 3324 |
3325 for (size_t i = 0; i < cases.size(); ++i) { | 3325 for (size_t i = 0; i < cases.size(); ++i) { |
3326 const auto& testcase = cases[i]; | 3326 const auto& testcase = cases[i]; |
3327 std::vector<LayerImpl*> to_remove; | 3327 std::vector<LayerImpl*> to_remove; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3400 cases.back().layer_between.has_incomplete_tile = true; | 3400 cases.back().layer_between.has_incomplete_tile = true; |
3401 // 3. High res required with missing tile. | 3401 // 3. High res required with missing tile. |
3402 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS)); | 3402 cases.push_back(PrepareToDrawSuccessTestCase(DRAW_SUCCESS)); |
3403 cases.back().high_res_required = true; | 3403 cases.back().high_res_required = true; |
3404 cases.back().layer_between.has_missing_tile = true; | 3404 cases.back().layer_between.has_missing_tile = true; |
3405 | 3405 |
3406 host_impl_->active_tree()->SetRootLayer( | 3406 host_impl_->active_tree()->SetRootLayer( |
3407 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); | 3407 DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); |
3408 DidDrawCheckLayer* root = | 3408 DidDrawCheckLayer* root = |
3409 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 3409 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
3410 root->SetHasRenderSurface(true); | 3410 root->SetForceRenderSurface(true); |
3411 | 3411 |
3412 LayerTreeHostImpl::FrameData frame; | 3412 LayerTreeHostImpl::FrameData frame; |
3413 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 3413 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
3414 host_impl_->DrawLayers(&frame); | 3414 host_impl_->DrawLayers(&frame); |
3415 host_impl_->DidDrawAllLayers(frame); | 3415 host_impl_->DidDrawAllLayers(frame); |
3416 host_impl_->SwapBuffers(frame); | 3416 host_impl_->SwapBuffers(frame); |
3417 | 3417 |
3418 for (size_t i = 0; i < cases.size(); ++i) { | 3418 for (size_t i = 0; i < cases.size(); ++i) { |
3419 const auto& testcase = cases[i]; | 3419 const auto& testcase = cases[i]; |
3420 std::vector<LayerImpl*> to_remove; | 3420 std::vector<LayerImpl*> to_remove; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3461 EXPECT_EQ(testcase.expected_result, PrepareToDrawFrame(&frame)); | 3461 EXPECT_EQ(testcase.expected_result, PrepareToDrawFrame(&frame)); |
3462 host_impl_->DrawLayers(&frame); | 3462 host_impl_->DrawLayers(&frame); |
3463 host_impl_->DidDrawAllLayers(frame); | 3463 host_impl_->DidDrawAllLayers(frame); |
3464 host_impl_->SwapBuffers(frame); | 3464 host_impl_->SwapBuffers(frame); |
3465 } | 3465 } |
3466 } | 3466 } |
3467 | 3467 |
3468 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { | 3468 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { |
3469 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 3469 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
3470 root->SetScrollClipLayer(Layer::INVALID_ID); | 3470 root->SetScrollClipLayer(Layer::INVALID_ID); |
3471 root->SetHasRenderSurface(true); | 3471 root->SetForceRenderSurface(true); |
3472 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 3472 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
3473 DrawFrame(); | 3473 DrawFrame(); |
3474 | 3474 |
3475 // Scroll event is ignored because layer is not scrollable. | 3475 // Scroll event is ignored because layer is not scrollable. |
3476 EXPECT_EQ(InputHandler::SCROLL_IGNORED, | 3476 EXPECT_EQ(InputHandler::SCROLL_IGNORED, |
3477 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL)); | 3477 host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL)); |
3478 EXPECT_FALSE(did_request_redraw_); | 3478 EXPECT_FALSE(did_request_redraw_); |
3479 EXPECT_FALSE(did_request_commit_); | 3479 EXPECT_FALSE(did_request_commit_); |
3480 } | 3480 } |
3481 | 3481 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3544 LayerImpl::Create(host_impl_->active_tree(), 4); | 3544 LayerImpl::Create(host_impl_->active_tree(), 4); |
3545 scoped_ptr<LayerImpl> outer_clip = | 3545 scoped_ptr<LayerImpl> outer_clip = |
3546 LayerImpl::Create(host_impl_->active_tree(), 5); | 3546 LayerImpl::Create(host_impl_->active_tree(), 5); |
3547 | 3547 |
3548 root_clip->SetBounds(inner_viewport_size); | 3548 root_clip->SetBounds(inner_viewport_size); |
3549 root->SetScrollClipLayer(root_clip->id()); | 3549 root->SetScrollClipLayer(root_clip->id()); |
3550 root->SetBounds(outer_viewport_size); | 3550 root->SetBounds(outer_viewport_size); |
3551 root->SetPosition(gfx::PointF()); | 3551 root->SetPosition(gfx::PointF()); |
3552 root->SetDrawsContent(false); | 3552 root->SetDrawsContent(false); |
3553 root->SetIsContainerForFixedPositionLayers(true); | 3553 root->SetIsContainerForFixedPositionLayers(true); |
3554 root_clip->SetHasRenderSurface(true); | 3554 root_clip->SetForceRenderSurface(true); |
3555 outer_clip->SetBounds(outer_viewport_size); | 3555 outer_clip->SetBounds(outer_viewport_size); |
3556 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 3556 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
3557 outer_scroll->SetBounds(scroll_layer_size); | 3557 outer_scroll->SetBounds(scroll_layer_size); |
3558 outer_scroll->SetPosition(gfx::PointF()); | 3558 outer_scroll->SetPosition(gfx::PointF()); |
3559 outer_scroll->SetDrawsContent(false); | 3559 outer_scroll->SetDrawsContent(false); |
3560 outer_scroll->SetIsContainerForFixedPositionLayers(true); | 3560 outer_scroll->SetIsContainerForFixedPositionLayers(true); |
3561 | 3561 |
3562 int inner_viewport_scroll_layer_id = root->id(); | 3562 int inner_viewport_scroll_layer_id = root->id(); |
3563 int outer_viewport_scroll_layer_id = outer_scroll->id(); | 3563 int outer_viewport_scroll_layer_id = outer_scroll->id(); |
3564 int page_scale_layer_id = page_scale->id(); | 3564 int page_scale_layer_id = page_scale->id(); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4228 scroll_clip_layer->SetBounds(surface_size); | 4228 scroll_clip_layer->SetBounds(surface_size); |
4229 | 4229 |
4230 scoped_ptr<LayerImpl> scroll_layer = | 4230 scoped_ptr<LayerImpl> scroll_layer = |
4231 LayerImpl::Create(host_impl_->active_tree(), 2); | 4231 LayerImpl::Create(host_impl_->active_tree(), 2); |
4232 scroll_layer->SetScrollClipLayer(3); | 4232 scroll_layer->SetScrollClipLayer(3); |
4233 scroll_layer->SetBounds(contents_size); | 4233 scroll_layer->SetBounds(contents_size); |
4234 scroll_layer->SetPosition(gfx::PointF()); | 4234 scroll_layer->SetPosition(gfx::PointF()); |
4235 scroll_layer->AddChild(std::move(content_layer)); | 4235 scroll_layer->AddChild(std::move(content_layer)); |
4236 scroll_clip_layer->AddChild(std::move(scroll_layer)); | 4236 scroll_clip_layer->AddChild(std::move(scroll_layer)); |
4237 | 4237 |
4238 scroll_clip_layer->SetHasRenderSurface(true); | 4238 scroll_clip_layer->SetForceRenderSurface(true); |
4239 host_impl_->active_tree()->SetRootLayer(std::move(scroll_clip_layer)); | 4239 host_impl_->active_tree()->SetRootLayer(std::move(scroll_clip_layer)); |
4240 host_impl_->SetViewportSize(surface_size); | 4240 host_impl_->SetViewportSize(surface_size); |
4241 DrawFrame(); | 4241 DrawFrame(); |
4242 | 4242 |
4243 EXPECT_EQ(InputHandler::SCROLL_STARTED, | 4243 EXPECT_EQ(InputHandler::SCROLL_STARTED, |
4244 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); | 4244 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); |
4245 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 4245 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
4246 host_impl_->ScrollEnd(); | 4246 host_impl_->ScrollEnd(); |
4247 EXPECT_TRUE(did_request_redraw_); | 4247 EXPECT_TRUE(did_request_redraw_); |
4248 EXPECT_TRUE(did_request_commit_); | 4248 EXPECT_TRUE(did_request_commit_); |
4249 } | 4249 } |
4250 | 4250 |
4251 TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) { | 4251 TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) { |
4252 gfx::Size surface_size(10, 10); | 4252 gfx::Size surface_size(10, 10); |
4253 gfx::Size contents_size(20, 20); | 4253 gfx::Size contents_size(20, 20); |
4254 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 4254 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
4255 root->SetBounds(surface_size); | 4255 root->SetBounds(surface_size); |
4256 root->AddChild(CreateScrollableLayer(2, contents_size, root.get())); | 4256 root->AddChild(CreateScrollableLayer(2, contents_size, root.get())); |
4257 root->SetHasRenderSurface(true); | 4257 root->SetForceRenderSurface(true); |
4258 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 4258 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
4259 host_impl_->SetViewportSize(surface_size); | 4259 host_impl_->SetViewportSize(surface_size); |
4260 DrawFrame(); | 4260 DrawFrame(); |
4261 | 4261 |
4262 EXPECT_EQ(InputHandler::SCROLL_STARTED, | 4262 EXPECT_EQ(InputHandler::SCROLL_STARTED, |
4263 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); | 4263 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); |
4264 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 4264 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
4265 host_impl_->ScrollEnd(); | 4265 host_impl_->ScrollEnd(); |
4266 EXPECT_TRUE(did_request_redraw_); | 4266 EXPECT_TRUE(did_request_redraw_); |
4267 EXPECT_TRUE(did_request_commit_); | 4267 EXPECT_TRUE(did_request_commit_); |
4268 } | 4268 } |
4269 | 4269 |
4270 TEST_F(LayerTreeHostImplTest, ScrollMissesChild) { | 4270 TEST_F(LayerTreeHostImplTest, ScrollMissesChild) { |
4271 gfx::Size surface_size(10, 10); | 4271 gfx::Size surface_size(10, 10); |
4272 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 4272 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
4273 root->AddChild(CreateScrollableLayer(2, surface_size, root.get())); | 4273 root->AddChild(CreateScrollableLayer(2, surface_size, root.get())); |
4274 root->SetHasRenderSurface(true); | 4274 root->SetForceRenderSurface(true); |
4275 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 4275 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
4276 host_impl_->SetViewportSize(surface_size); | 4276 host_impl_->SetViewportSize(surface_size); |
4277 DrawFrame(); | 4277 DrawFrame(); |
4278 | 4278 |
4279 // Scroll event is ignored because the input coordinate is outside the layer | 4279 // Scroll event is ignored because the input coordinate is outside the layer |
4280 // boundaries. | 4280 // boundaries. |
4281 EXPECT_EQ(InputHandler::SCROLL_IGNORED, | 4281 EXPECT_EQ(InputHandler::SCROLL_IGNORED, |
4282 host_impl_->ScrollBegin(gfx::Point(15, 5), InputHandler::WHEEL)); | 4282 host_impl_->ScrollBegin(gfx::Point(15, 5), InputHandler::WHEEL)); |
4283 EXPECT_FALSE(did_request_redraw_); | 4283 EXPECT_FALSE(did_request_redraw_); |
4284 EXPECT_FALSE(did_request_commit_); | 4284 EXPECT_FALSE(did_request_commit_); |
4285 } | 4285 } |
4286 | 4286 |
4287 TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) { | 4287 TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) { |
4288 gfx::Size surface_size(10, 10); | 4288 gfx::Size surface_size(10, 10); |
4289 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 4289 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
4290 root->SetHasRenderSurface(true); | 4290 root->SetForceRenderSurface(true); |
4291 scoped_ptr<LayerImpl> child = | 4291 scoped_ptr<LayerImpl> child = |
4292 CreateScrollableLayer(2, surface_size, root.get()); | 4292 CreateScrollableLayer(2, surface_size, root.get()); |
4293 host_impl_->SetViewportSize(surface_size); | 4293 host_impl_->SetViewportSize(surface_size); |
4294 | 4294 |
4295 gfx::Transform matrix; | 4295 gfx::Transform matrix; |
4296 matrix.RotateAboutXAxis(180.0); | 4296 matrix.RotateAboutXAxis(180.0); |
4297 child->SetTransform(matrix); | 4297 child->SetTransform(matrix); |
4298 child->SetDoubleSided(false); | 4298 child->SetDoubleSided(false); |
4299 | 4299 |
4300 root->AddChild(std::move(child)); | 4300 root->AddChild(std::move(child)); |
(...skipping 16 matching lines...) Expand all Loading... |
4317 CreateScrollableLayer(1, surface_size, clip_layer.get()); | 4317 CreateScrollableLayer(1, surface_size, clip_layer.get()); |
4318 content_layer->SetShouldScrollOnMainThread(true); | 4318 content_layer->SetShouldScrollOnMainThread(true); |
4319 content_layer->SetScrollClipLayer(Layer::INVALID_ID); | 4319 content_layer->SetScrollClipLayer(Layer::INVALID_ID); |
4320 | 4320 |
4321 // Note: we can use the same clip layer for both since both calls to | 4321 // Note: we can use the same clip layer for both since both calls to |
4322 // CreateScrollableLayer() use the same surface size. | 4322 // CreateScrollableLayer() use the same surface size. |
4323 scoped_ptr<LayerImpl> scroll_layer = | 4323 scoped_ptr<LayerImpl> scroll_layer = |
4324 CreateScrollableLayer(2, surface_size, clip_layer.get()); | 4324 CreateScrollableLayer(2, surface_size, clip_layer.get()); |
4325 scroll_layer->AddChild(std::move(content_layer)); | 4325 scroll_layer->AddChild(std::move(content_layer)); |
4326 clip_layer->AddChild(std::move(scroll_layer)); | 4326 clip_layer->AddChild(std::move(scroll_layer)); |
4327 clip_layer->SetHasRenderSurface(true); | 4327 clip_layer->SetForceRenderSurface(true); |
4328 | 4328 |
4329 host_impl_->active_tree()->SetRootLayer(std::move(clip_layer)); | 4329 host_impl_->active_tree()->SetRootLayer(std::move(clip_layer)); |
4330 host_impl_->SetViewportSize(surface_size); | 4330 host_impl_->SetViewportSize(surface_size); |
4331 DrawFrame(); | 4331 DrawFrame(); |
4332 | 4332 |
4333 // Scrolling fails because the content layer is asking to be scrolled on the | 4333 // Scrolling fails because the content layer is asking to be scrolled on the |
4334 // main thread. | 4334 // main thread. |
4335 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, | 4335 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, |
4336 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); | 4336 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); |
4337 } | 4337 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4519 EXPECT_EQ(1.f, host_impl_->active_tree()->page_scale_delta()); | 4519 EXPECT_EQ(1.f, host_impl_->active_tree()->page_scale_delta()); |
4520 } | 4520 } |
4521 | 4521 |
4522 TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) { | 4522 TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) { |
4523 // Scroll a child layer beyond its maximum scroll range and make sure the | 4523 // Scroll a child layer beyond its maximum scroll range and make sure the |
4524 // parent layer isn't scrolled. | 4524 // parent layer isn't scrolled. |
4525 gfx::Size surface_size(10, 10); | 4525 gfx::Size surface_size(10, 10); |
4526 gfx::Size content_size(20, 20); | 4526 gfx::Size content_size(20, 20); |
4527 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 4527 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
4528 root->SetBounds(surface_size); | 4528 root->SetBounds(surface_size); |
4529 root->SetHasRenderSurface(true); | 4529 root->SetForceRenderSurface(true); |
4530 scoped_ptr<LayerImpl> grand_child = | 4530 scoped_ptr<LayerImpl> grand_child = |
4531 CreateScrollableLayer(3, content_size, root.get()); | 4531 CreateScrollableLayer(3, content_size, root.get()); |
4532 | 4532 |
4533 scoped_ptr<LayerImpl> child = | 4533 scoped_ptr<LayerImpl> child = |
4534 CreateScrollableLayer(2, content_size, root.get()); | 4534 CreateScrollableLayer(2, content_size, root.get()); |
4535 LayerImpl* grand_child_layer = grand_child.get(); | 4535 LayerImpl* grand_child_layer = grand_child.get(); |
4536 child->AddChild(std::move(grand_child)); | 4536 child->AddChild(std::move(grand_child)); |
4537 | 4537 |
4538 LayerImpl* child_layer = child.get(); | 4538 LayerImpl* child_layer = child.get(); |
4539 root->AddChild(std::move(child)); | 4539 root->AddChild(std::move(child)); |
(...skipping 25 matching lines...) Expand all Loading... |
4565 ExpectNone(*scroll_info.get(), child->id()); | 4565 ExpectNone(*scroll_info.get(), child->id()); |
4566 } | 4566 } |
4567 } | 4567 } |
4568 | 4568 |
4569 TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) { | 4569 TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) { |
4570 // Scroll a child layer beyond its maximum scroll range and make sure the | 4570 // Scroll a child layer beyond its maximum scroll range and make sure the |
4571 // the scroll doesn't bubble up to the parent layer. | 4571 // the scroll doesn't bubble up to the parent layer. |
4572 gfx::Size surface_size(20, 20); | 4572 gfx::Size surface_size(20, 20); |
4573 gfx::Size viewport_size(10, 10); | 4573 gfx::Size viewport_size(10, 10); |
4574 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 4574 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
4575 root->SetHasRenderSurface(true); | 4575 root->SetForceRenderSurface(true); |
4576 scoped_ptr<LayerImpl> root_scrolling = | 4576 scoped_ptr<LayerImpl> root_scrolling = |
4577 CreateScrollableLayer(2, surface_size, root.get()); | 4577 CreateScrollableLayer(2, surface_size, root.get()); |
4578 root_scrolling->SetIsContainerForFixedPositionLayers(true); | 4578 root_scrolling->SetIsContainerForFixedPositionLayers(true); |
4579 | 4579 |
4580 scoped_ptr<LayerImpl> grand_child = | 4580 scoped_ptr<LayerImpl> grand_child = |
4581 CreateScrollableLayer(4, surface_size, root.get()); | 4581 CreateScrollableLayer(4, surface_size, root.get()); |
4582 | 4582 |
4583 scoped_ptr<LayerImpl> child = | 4583 scoped_ptr<LayerImpl> child = |
4584 CreateScrollableLayer(3, surface_size, root.get()); | 4584 CreateScrollableLayer(3, surface_size, root.get()); |
4585 LayerImpl* grand_child_layer = grand_child.get(); | 4585 LayerImpl* grand_child_layer = grand_child.get(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4681 gfx::Vector2d(0, 4))); | 4681 gfx::Vector2d(0, 4))); |
4682 } | 4682 } |
4683 } | 4683 } |
4684 TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) { | 4684 TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) { |
4685 // When we try to scroll a non-scrollable child layer, the scroll delta | 4685 // When we try to scroll a non-scrollable child layer, the scroll delta |
4686 // should be applied to one of its ancestors if possible. | 4686 // should be applied to one of its ancestors if possible. |
4687 gfx::Size surface_size(10, 10); | 4687 gfx::Size surface_size(10, 10); |
4688 gfx::Size content_size(20, 20); | 4688 gfx::Size content_size(20, 20); |
4689 scoped_ptr<LayerImpl> root_clip = | 4689 scoped_ptr<LayerImpl> root_clip = |
4690 LayerImpl::Create(host_impl_->active_tree(), 3); | 4690 LayerImpl::Create(host_impl_->active_tree(), 3); |
4691 root_clip->SetHasRenderSurface(true); | 4691 root_clip->SetForceRenderSurface(true); |
4692 scoped_ptr<LayerImpl> root = | 4692 scoped_ptr<LayerImpl> root = |
4693 CreateScrollableLayer(1, content_size, root_clip.get()); | 4693 CreateScrollableLayer(1, content_size, root_clip.get()); |
4694 // Make 'root' the clip layer for child: since they have the same sizes the | 4694 // Make 'root' the clip layer for child: since they have the same sizes the |
4695 // child will have zero max_scroll_offset and scrolls will bubble. | 4695 // child will have zero max_scroll_offset and scrolls will bubble. |
4696 scoped_ptr<LayerImpl> child = | 4696 scoped_ptr<LayerImpl> child = |
4697 CreateScrollableLayer(2, content_size, root.get()); | 4697 CreateScrollableLayer(2, content_size, root.get()); |
4698 child->SetIsContainerForFixedPositionLayers(true); | 4698 child->SetIsContainerForFixedPositionLayers(true); |
4699 root->SetBounds(content_size); | 4699 root->SetBounds(content_size); |
4700 | 4700 |
4701 int root_scroll_id = root->id(); | 4701 int root_scroll_id = root->id(); |
(...skipping 23 matching lines...) Expand all Loading... |
4725 } | 4725 } |
4726 } | 4726 } |
4727 | 4727 |
4728 TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { | 4728 TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { |
4729 gfx::Size surface_size(10, 10); | 4729 gfx::Size surface_size(10, 10); |
4730 scoped_ptr<LayerImpl> root_clip = | 4730 scoped_ptr<LayerImpl> root_clip = |
4731 LayerImpl::Create(host_impl_->active_tree(), 1); | 4731 LayerImpl::Create(host_impl_->active_tree(), 1); |
4732 scoped_ptr<LayerImpl> root_scroll = | 4732 scoped_ptr<LayerImpl> root_scroll = |
4733 CreateScrollableLayer(2, surface_size, root_clip.get()); | 4733 CreateScrollableLayer(2, surface_size, root_clip.get()); |
4734 root_scroll->SetIsContainerForFixedPositionLayers(true); | 4734 root_scroll->SetIsContainerForFixedPositionLayers(true); |
4735 root_clip->SetHasRenderSurface(true); | 4735 root_clip->SetForceRenderSurface(true); |
4736 root_clip->AddChild(std::move(root_scroll)); | 4736 root_clip->AddChild(std::move(root_scroll)); |
4737 host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); | 4737 host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); |
4738 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2, | 4738 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2, |
4739 Layer::INVALID_ID); | 4739 Layer::INVALID_ID); |
4740 host_impl_->active_tree()->DidBecomeActive(); | 4740 host_impl_->active_tree()->DidBecomeActive(); |
4741 host_impl_->SetViewportSize(surface_size); | 4741 host_impl_->SetViewportSize(surface_size); |
4742 | 4742 |
4743 // Draw one frame and then immediately rebuild the layer tree to mimic a tree | 4743 // Draw one frame and then immediately rebuild the layer tree to mimic a tree |
4744 // synchronization. | 4744 // synchronization. |
4745 DrawFrame(); | 4745 DrawFrame(); |
4746 host_impl_->active_tree()->DetachLayerTree(); | 4746 host_impl_->active_tree()->DetachLayerTree(); |
4747 scoped_ptr<LayerImpl> root_clip2 = | 4747 scoped_ptr<LayerImpl> root_clip2 = |
4748 LayerImpl::Create(host_impl_->active_tree(), 3); | 4748 LayerImpl::Create(host_impl_->active_tree(), 3); |
4749 scoped_ptr<LayerImpl> root_scroll2 = | 4749 scoped_ptr<LayerImpl> root_scroll2 = |
4750 CreateScrollableLayer(4, surface_size, root_clip2.get()); | 4750 CreateScrollableLayer(4, surface_size, root_clip2.get()); |
4751 root_scroll2->SetIsContainerForFixedPositionLayers(true); | 4751 root_scroll2->SetIsContainerForFixedPositionLayers(true); |
4752 root_clip2->AddChild(std::move(root_scroll2)); | 4752 root_clip2->AddChild(std::move(root_scroll2)); |
4753 root_clip2->SetHasRenderSurface(true); | 4753 root_clip2->SetForceRenderSurface(true); |
4754 host_impl_->active_tree()->SetRootLayer(std::move(root_clip2)); | 4754 host_impl_->active_tree()->SetRootLayer(std::move(root_clip2)); |
4755 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 3, 4, | 4755 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 3, 4, |
4756 Layer::INVALID_ID); | 4756 Layer::INVALID_ID); |
4757 host_impl_->active_tree()->DidBecomeActive(); | 4757 host_impl_->active_tree()->DidBecomeActive(); |
4758 | 4758 |
4759 // Scrolling should still work even though we did not draw yet. | 4759 // Scrolling should still work even though we did not draw yet. |
4760 RebuildPropertyTrees(); | 4760 RebuildPropertyTrees(); |
4761 EXPECT_EQ(InputHandler::SCROLL_STARTED, | 4761 EXPECT_EQ(InputHandler::SCROLL_STARTED, |
4762 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); | 4762 host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL)); |
4763 } | 4763 } |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5314 } | 5314 } |
5315 | 5315 |
5316 | 5316 |
5317 TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) { | 5317 TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) { |
5318 // Scroll child layers beyond their maximum scroll range and make sure root | 5318 // Scroll child layers beyond their maximum scroll range and make sure root |
5319 // overscroll does not accumulate. | 5319 // overscroll does not accumulate. |
5320 InputHandlerScrollResult scroll_result; | 5320 InputHandlerScrollResult scroll_result; |
5321 gfx::Size surface_size(10, 10); | 5321 gfx::Size surface_size(10, 10); |
5322 scoped_ptr<LayerImpl> root_clip = | 5322 scoped_ptr<LayerImpl> root_clip = |
5323 LayerImpl::Create(host_impl_->active_tree(), 4); | 5323 LayerImpl::Create(host_impl_->active_tree(), 4); |
5324 root_clip->SetHasRenderSurface(true); | 5324 root_clip->SetForceRenderSurface(true); |
5325 | 5325 |
5326 scoped_ptr<LayerImpl> root = | 5326 scoped_ptr<LayerImpl> root = |
5327 CreateScrollableLayer(1, surface_size, root_clip.get()); | 5327 CreateScrollableLayer(1, surface_size, root_clip.get()); |
5328 | 5328 |
5329 scoped_ptr<LayerImpl> grand_child = | 5329 scoped_ptr<LayerImpl> grand_child = |
5330 CreateScrollableLayer(3, surface_size, root_clip.get()); | 5330 CreateScrollableLayer(3, surface_size, root_clip.get()); |
5331 | 5331 |
5332 scoped_ptr<LayerImpl> child = | 5332 scoped_ptr<LayerImpl> child = |
5333 CreateScrollableLayer(2, surface_size, root_clip.get()); | 5333 CreateScrollableLayer(2, surface_size, root_clip.get()); |
5334 LayerImpl* grand_child_layer = grand_child.get(); | 5334 LayerImpl* grand_child_layer = grand_child.get(); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5571 gfx::Rect quad_visible_rect_; | 5571 gfx::Rect quad_visible_rect_; |
5572 ResourceId resource_id_; | 5572 ResourceId resource_id_; |
5573 }; | 5573 }; |
5574 | 5574 |
5575 TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { | 5575 TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
5576 { | 5576 { |
5577 scoped_ptr<LayerImpl> root = | 5577 scoped_ptr<LayerImpl> root = |
5578 LayerImpl::Create(host_impl_->active_tree(), 1); | 5578 LayerImpl::Create(host_impl_->active_tree(), 1); |
5579 root->SetBounds(gfx::Size(10, 10)); | 5579 root->SetBounds(gfx::Size(10, 10)); |
5580 root->SetDrawsContent(false); | 5580 root->SetDrawsContent(false); |
5581 root->SetHasRenderSurface(true); | 5581 root->SetForceRenderSurface(true); |
5582 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 5582 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
5583 } | 5583 } |
5584 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 5584 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
5585 | 5585 |
5586 root->AddChild( | 5586 root->AddChild( |
5587 BlendStateCheckLayer::Create(host_impl_->active_tree(), | 5587 BlendStateCheckLayer::Create(host_impl_->active_tree(), |
5588 2, | 5588 2, |
5589 host_impl_->resource_provider())); | 5589 host_impl_->resource_provider())); |
5590 BlendStateCheckLayer* layer1 = | 5590 BlendStateCheckLayer* layer1 = |
5591 static_cast<BlendStateCheckLayer*>(root->children()[0].get()); | 5591 static_cast<BlendStateCheckLayer*>(root->children()[0].get()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5681 EXPECT_TRUE(layer2->quads_appended()); | 5681 EXPECT_TRUE(layer2->quads_appended()); |
5682 host_impl_->DidDrawAllLayers(frame); | 5682 host_impl_->DidDrawAllLayers(frame); |
5683 | 5683 |
5684 // Parent layer with translucent opacity and opaque content. Since it has a | 5684 // Parent layer with translucent opacity and opaque content. Since it has a |
5685 // drawing child, it's drawn to a render surface which carries the opacity, | 5685 // drawing child, it's drawn to a render surface which carries the opacity, |
5686 // so it's itself drawn without blending. | 5686 // so it's itself drawn without blending. |
5687 // Child layer with opaque content, drawn without blending (parent surface | 5687 // Child layer with opaque content, drawn without blending (parent surface |
5688 // carries the inherited opacity). | 5688 // carries the inherited opacity). |
5689 layer1->SetContentsOpaque(true); | 5689 layer1->SetContentsOpaque(true); |
5690 layer1->SetOpacity(0.5f); | 5690 layer1->SetOpacity(0.5f); |
5691 layer1->SetHasRenderSurface(true); | 5691 layer1->SetForceRenderSurface(true); |
5692 layer1->SetExpectation(false, true); | 5692 layer1->SetExpectation(false, true); |
5693 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); | 5693 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
5694 layer2->SetExpectation(false, false); | 5694 layer2->SetExpectation(false, false); |
5695 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); | 5695 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
5696 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( | 5696 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( |
5697 host_impl_->active_tree()->root_layer()); | 5697 host_impl_->active_tree()->root_layer()); |
5698 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 5698 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
5699 host_impl_->DrawLayers(&frame); | 5699 host_impl_->DrawLayers(&frame); |
5700 EXPECT_TRUE(layer1->quads_appended()); | 5700 EXPECT_TRUE(layer1->quads_appended()); |
5701 EXPECT_TRUE(layer2->quads_appended()); | 5701 EXPECT_TRUE(layer2->quads_appended()); |
5702 host_impl_->DidDrawAllLayers(frame); | 5702 host_impl_->DidDrawAllLayers(frame); |
5703 layer1->SetHasRenderSurface(false); | 5703 layer1->SetForceRenderSurface(false); |
5704 | 5704 |
5705 // Draw again, but with child non-opaque, to make sure | 5705 // Draw again, but with child non-opaque, to make sure |
5706 // layer1 not culled. | 5706 // layer1 not culled. |
5707 layer1->SetContentsOpaque(true); | 5707 layer1->SetContentsOpaque(true); |
5708 layer1->SetOpacity(1.f); | 5708 layer1->SetOpacity(1.f); |
5709 layer1->SetExpectation(false, false); | 5709 layer1->SetExpectation(false, false); |
5710 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); | 5710 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
5711 layer2->SetContentsOpaque(true); | 5711 layer2->SetContentsOpaque(true); |
5712 layer2->SetOpacity(0.5f); | 5712 layer2->SetOpacity(0.5f); |
5713 layer2->SetExpectation(true, false); | 5713 layer2->SetExpectation(true, false); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5811 return FakeOutputSurface::CreateSoftware( | 5811 return FakeOutputSurface::CreateSoftware( |
5812 make_scoped_ptr(new SoftwareOutputDevice())); | 5812 make_scoped_ptr(new SoftwareOutputDevice())); |
5813 } | 5813 } |
5814 return FakeOutputSurface::Create3d(); | 5814 return FakeOutputSurface::Create3d(); |
5815 } | 5815 } |
5816 | 5816 |
5817 void SetupActiveTreeLayers() { | 5817 void SetupActiveTreeLayers() { |
5818 host_impl_->active_tree()->set_background_color(SK_ColorGRAY); | 5818 host_impl_->active_tree()->set_background_color(SK_ColorGRAY); |
5819 host_impl_->active_tree()->SetRootLayer( | 5819 host_impl_->active_tree()->SetRootLayer( |
5820 LayerImpl::Create(host_impl_->active_tree(), 1)); | 5820 LayerImpl::Create(host_impl_->active_tree(), 1)); |
5821 host_impl_->active_tree()->root_layer()->SetHasRenderSurface(true); | 5821 host_impl_->active_tree()->root_layer()->SetForceRenderSurface(true); |
5822 host_impl_->active_tree()->root_layer()->AddChild( | 5822 host_impl_->active_tree()->root_layer()->AddChild( |
5823 BlendStateCheckLayer::Create(host_impl_->active_tree(), | 5823 BlendStateCheckLayer::Create(host_impl_->active_tree(), |
5824 2, | 5824 2, |
5825 host_impl_->resource_provider())); | 5825 host_impl_->resource_provider())); |
5826 child_ = static_cast<BlendStateCheckLayer*>( | 5826 child_ = static_cast<BlendStateCheckLayer*>( |
5827 host_impl_->active_tree()->root_layer()->children()[0].get()); | 5827 host_impl_->active_tree()->root_layer()->children()[0].get()); |
5828 child_->SetExpectation(false, false); | 5828 child_->SetExpectation(false, false); |
5829 child_->SetContentsOpaque(true); | 5829 child_->SetContentsOpaque(true); |
5830 } | 5830 } |
5831 | 5831 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6067 TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) { | 6067 TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) { |
6068 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 6068 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
6069 scoped_ptr<OutputSurface> output_surface( | 6069 scoped_ptr<OutputSurface> output_surface( |
6070 FakeOutputSurface::Create3d(provider)); | 6070 FakeOutputSurface::Create3d(provider)); |
6071 CreateHostImpl(DefaultSettings(), std::move(output_surface)); | 6071 CreateHostImpl(DefaultSettings(), std::move(output_surface)); |
6072 | 6072 |
6073 scoped_ptr<LayerImpl> root = | 6073 scoped_ptr<LayerImpl> root = |
6074 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); | 6074 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); |
6075 root->SetBounds(gfx::Size(10, 10)); | 6075 root->SetBounds(gfx::Size(10, 10)); |
6076 root->SetDrawsContent(true); | 6076 root->SetDrawsContent(true); |
6077 root->SetHasRenderSurface(true); | 6077 root->SetForceRenderSurface(true); |
6078 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 6078 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
6079 EXPECT_FALSE(provider->TestContext3d()->reshape_called()); | 6079 EXPECT_FALSE(provider->TestContext3d()->reshape_called()); |
6080 provider->TestContext3d()->clear_reshape_called(); | 6080 provider->TestContext3d()->clear_reshape_called(); |
6081 | 6081 |
6082 LayerTreeHostImpl::FrameData frame; | 6082 LayerTreeHostImpl::FrameData frame; |
6083 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6083 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
6084 host_impl_->active_tree()->SetDeviceScaleFactor(1.f); | 6084 host_impl_->active_tree()->SetDeviceScaleFactor(1.f); |
6085 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 6085 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
6086 host_impl_->DrawLayers(&frame); | 6086 host_impl_->DrawLayers(&frame); |
6087 EXPECT_TRUE(provider->TestContext3d()->reshape_called()); | 6087 EXPECT_TRUE(provider->TestContext3d()->reshape_called()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6133 settings, this, &task_runner_provider_, &stats_instrumentation_, | 6133 settings, this, &task_runner_provider_, &stats_instrumentation_, |
6134 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); | 6134 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); |
6135 layer_tree_host_impl->SetVisible(true); | 6135 layer_tree_host_impl->SetVisible(true); |
6136 layer_tree_host_impl->InitializeRenderer(output_surface.get()); | 6136 layer_tree_host_impl->InitializeRenderer(output_surface.get()); |
6137 layer_tree_host_impl->WillBeginImplFrame( | 6137 layer_tree_host_impl->WillBeginImplFrame( |
6138 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 6138 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
6139 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 6139 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
6140 | 6140 |
6141 scoped_ptr<LayerImpl> root = | 6141 scoped_ptr<LayerImpl> root = |
6142 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 6142 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
6143 root->SetHasRenderSurface(true); | 6143 root->SetForceRenderSurface(true); |
6144 scoped_ptr<LayerImpl> child = | 6144 scoped_ptr<LayerImpl> child = |
6145 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 6145 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
6146 child->SetPosition(gfx::PointF(12.f, 13.f)); | 6146 child->SetPosition(gfx::PointF(12.f, 13.f)); |
6147 child->SetBounds(gfx::Size(14, 15)); | 6147 child->SetBounds(gfx::Size(14, 15)); |
6148 child->SetDrawsContent(true); | 6148 child->SetDrawsContent(true); |
6149 root->SetBounds(gfx::Size(500, 500)); | 6149 root->SetBounds(gfx::Size(500, 500)); |
6150 root->SetDrawsContent(true); | 6150 root->SetDrawsContent(true); |
6151 root->AddChild(std::move(child)); | 6151 root->AddChild(std::move(child)); |
6152 layer_tree_host_impl->active_tree()->SetRootLayer(std::move(root)); | 6152 layer_tree_host_impl->active_tree()->SetRootLayer(std::move(root)); |
6153 | 6153 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6199 | 6199 |
6200 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { | 6200 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { |
6201 scoped_ptr<LayerImpl> root = | 6201 scoped_ptr<LayerImpl> root = |
6202 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); | 6202 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); |
6203 scoped_ptr<LayerImpl> child = | 6203 scoped_ptr<LayerImpl> child = |
6204 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 2); | 6204 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 2); |
6205 child->SetBounds(gfx::Size(10, 10)); | 6205 child->SetBounds(gfx::Size(10, 10)); |
6206 child->SetDrawsContent(true); | 6206 child->SetDrawsContent(true); |
6207 root->SetBounds(gfx::Size(10, 10)); | 6207 root->SetBounds(gfx::Size(10, 10)); |
6208 root->SetDrawsContent(true); | 6208 root->SetDrawsContent(true); |
6209 root->SetHasRenderSurface(true); | 6209 root->SetForceRenderSurface(true); |
6210 root->AddChild(std::move(child)); | 6210 root->AddChild(std::move(child)); |
6211 | 6211 |
6212 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 6212 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
6213 | 6213 |
6214 LayerTreeHostImpl::FrameData frame; | 6214 LayerTreeHostImpl::FrameData frame; |
6215 | 6215 |
6216 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 6216 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
6217 EXPECT_EQ(1u, frame.render_surface_layer_list->size()); | 6217 EXPECT_EQ(1u, frame.render_surface_layer_list->size()); |
6218 EXPECT_EQ(1u, frame.render_passes.size()); | 6218 EXPECT_EQ(1u, frame.render_passes.size()); |
6219 host_impl_->DidDrawAllLayers(frame); | 6219 host_impl_->DidDrawAllLayers(frame); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6448 LayerImpl::Create(my_host_impl->active_tree(), 1); | 6448 LayerImpl::Create(my_host_impl->active_tree(), 1); |
6449 scoped_ptr<LayerImpl> child = | 6449 scoped_ptr<LayerImpl> child = |
6450 LayerImpl::Create(my_host_impl->active_tree(), 2); | 6450 LayerImpl::Create(my_host_impl->active_tree(), 2); |
6451 scoped_ptr<LayerImpl> grand_child = | 6451 scoped_ptr<LayerImpl> grand_child = |
6452 FakeLayerWithQuads::Create(my_host_impl->active_tree(), 3); | 6452 FakeLayerWithQuads::Create(my_host_impl->active_tree(), 3); |
6453 | 6453 |
6454 gfx::Rect root_rect(0, 0, 100, 100); | 6454 gfx::Rect root_rect(0, 0, 100, 100); |
6455 gfx::Rect child_rect(10, 10, 50, 50); | 6455 gfx::Rect child_rect(10, 10, 50, 50); |
6456 gfx::Rect grand_child_rect(5, 5, 150, 150); | 6456 gfx::Rect grand_child_rect(5, 5, 150, 150); |
6457 | 6457 |
6458 root->SetHasRenderSurface(true); | 6458 root->SetForceRenderSurface(true); |
6459 root->SetPosition(gfx::PointF(root_rect.origin())); | 6459 root->SetPosition(gfx::PointF(root_rect.origin())); |
6460 root->SetBounds(root_rect.size()); | 6460 root->SetBounds(root_rect.size()); |
6461 root->draw_properties().visible_layer_rect = root_rect; | 6461 root->draw_properties().visible_layer_rect = root_rect; |
6462 root->SetDrawsContent(false); | 6462 root->SetDrawsContent(false); |
6463 root->render_surface()->SetContentRect(gfx::Rect(root_rect.size())); | |
6464 | 6463 |
6465 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); | 6464 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); |
6466 child->SetOpacity(0.5f); | 6465 child->SetOpacity(0.5f); |
6467 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); | 6466 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); |
6468 child->draw_properties().visible_layer_rect = child_rect; | 6467 child->draw_properties().visible_layer_rect = child_rect; |
6469 child->SetDrawsContent(false); | 6468 child->SetDrawsContent(false); |
6470 child->SetHasRenderSurface(true); | 6469 child->SetForceRenderSurface(true); |
6471 | 6470 |
6472 grand_child->SetPosition(gfx::PointF(grand_child_rect.origin())); | 6471 grand_child->SetPosition(gfx::PointF(grand_child_rect.origin())); |
6473 grand_child->SetBounds(grand_child_rect.size()); | 6472 grand_child->SetBounds(grand_child_rect.size()); |
6474 grand_child->draw_properties().visible_layer_rect = grand_child_rect; | 6473 grand_child->draw_properties().visible_layer_rect = grand_child_rect; |
6475 grand_child->SetDrawsContent(true); | 6474 grand_child->SetDrawsContent(true); |
6476 | 6475 |
6477 child->AddChild(std::move(grand_child)); | 6476 child->AddChild(std::move(grand_child)); |
6478 root->AddChild(std::move(child)); | 6477 root->AddChild(std::move(child)); |
6479 | 6478 |
6480 my_host_impl->active_tree()->SetRootLayer(std::move(root)); | 6479 my_host_impl->active_tree()->SetRootLayer(std::move(root)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6546 scoped_ptr<TestWebGraphicsContext3D> context = | 6545 scoped_ptr<TestWebGraphicsContext3D> context = |
6547 TestWebGraphicsContext3D::Create(); | 6546 TestWebGraphicsContext3D::Create(); |
6548 TestWebGraphicsContext3D* context3d = context.get(); | 6547 TestWebGraphicsContext3D* context3d = context.get(); |
6549 scoped_ptr<OutputSurface> output_surface( | 6548 scoped_ptr<OutputSurface> output_surface( |
6550 FakeOutputSurface::Create3d(std::move(context))); | 6549 FakeOutputSurface::Create3d(std::move(context))); |
6551 CreateHostImpl(DefaultSettings(), std::move(output_surface)); | 6550 CreateHostImpl(DefaultSettings(), std::move(output_surface)); |
6552 | 6551 |
6553 scoped_ptr<LayerImpl> root_layer = | 6552 scoped_ptr<LayerImpl> root_layer = |
6554 LayerImpl::Create(host_impl_->active_tree(), 1); | 6553 LayerImpl::Create(host_impl_->active_tree(), 1); |
6555 root_layer->SetBounds(gfx::Size(10, 10)); | 6554 root_layer->SetBounds(gfx::Size(10, 10)); |
6556 root_layer->SetHasRenderSurface(true); | 6555 root_layer->SetForceRenderSurface(true); |
6557 | 6556 |
6558 scoped_refptr<VideoFrame> softwareFrame = | 6557 scoped_refptr<VideoFrame> softwareFrame = |
6559 media::VideoFrame::CreateColorFrame( | 6558 media::VideoFrame::CreateColorFrame( |
6560 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 6559 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
6561 FakeVideoFrameProvider provider; | 6560 FakeVideoFrameProvider provider; |
6562 provider.set_frame(softwareFrame); | 6561 provider.set_frame(softwareFrame); |
6563 scoped_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create( | 6562 scoped_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create( |
6564 host_impl_->active_tree(), 4, &provider, media::VIDEO_ROTATION_0); | 6563 host_impl_->active_tree(), 4, &provider, media::VIDEO_ROTATION_0); |
6565 video_layer->SetBounds(gfx::Size(10, 10)); | 6564 video_layer->SetBounds(gfx::Size(10, 10)); |
6566 video_layer->SetDrawsContent(true); | 6565 video_layer->SetDrawsContent(true); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6679 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); | 6678 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); |
6680 } | 6679 } |
6681 }; | 6680 }; |
6682 | 6681 |
6683 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { | 6682 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { |
6684 scoped_ptr<SolidColorLayerImpl> root = | 6683 scoped_ptr<SolidColorLayerImpl> root = |
6685 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); | 6684 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
6686 root->SetPosition(gfx::PointF()); | 6685 root->SetPosition(gfx::PointF()); |
6687 root->SetBounds(gfx::Size(10, 10)); | 6686 root->SetBounds(gfx::Size(10, 10)); |
6688 root->SetDrawsContent(true); | 6687 root->SetDrawsContent(true); |
6689 root->SetHasRenderSurface(true); | 6688 root->SetForceRenderSurface(true); |
6690 | 6689 |
6691 // Child layer is in the bottom right corner. | 6690 // Child layer is in the bottom right corner. |
6692 scoped_ptr<SolidColorLayerImpl> child = | 6691 scoped_ptr<SolidColorLayerImpl> child = |
6693 SolidColorLayerImpl::Create(host_impl_->active_tree(), 2); | 6692 SolidColorLayerImpl::Create(host_impl_->active_tree(), 2); |
6694 child->SetPosition(gfx::PointF(9.f, 9.f)); | 6693 child->SetPosition(gfx::PointF(9.f, 9.f)); |
6695 child->SetBounds(gfx::Size(1, 1)); | 6694 child->SetBounds(gfx::Size(1, 1)); |
6696 child->SetDrawsContent(true); | 6695 child->SetDrawsContent(true); |
6697 root->AddChild(std::move(child)); | 6696 root->AddChild(std::move(child)); |
6698 | 6697 |
6699 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 6698 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6736 host_impl_->SetViewportSize(device_viewport_size); | 6735 host_impl_->SetViewportSize(device_viewport_size); |
6737 | 6736 |
6738 host_impl_->CreatePendingTree(); | 6737 host_impl_->CreatePendingTree(); |
6739 host_impl_->pending_tree()->SetDeviceScaleFactor(device_scale_factor); | 6738 host_impl_->pending_tree()->SetDeviceScaleFactor(device_scale_factor); |
6740 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f / 16.f, | 6739 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f / 16.f, |
6741 16.f); | 6740 16.f); |
6742 | 6741 |
6743 scoped_ptr<LayerImpl> scoped_root = | 6742 scoped_ptr<LayerImpl> scoped_root = |
6744 LayerImpl::Create(host_impl_->pending_tree(), 1); | 6743 LayerImpl::Create(host_impl_->pending_tree(), 1); |
6745 LayerImpl* root = scoped_root.get(); | 6744 LayerImpl* root = scoped_root.get(); |
6746 root->SetHasRenderSurface(true); | 6745 root->SetForceRenderSurface(true); |
6747 | 6746 |
6748 host_impl_->pending_tree()->SetRootLayer(std::move(scoped_root)); | 6747 host_impl_->pending_tree()->SetRootLayer(std::move(scoped_root)); |
6749 | 6748 |
6750 scoped_ptr<LayerImpl> scoped_scrolling_layer = | 6749 scoped_ptr<LayerImpl> scoped_scrolling_layer = |
6751 LayerImpl::Create(host_impl_->pending_tree(), 2); | 6750 LayerImpl::Create(host_impl_->pending_tree(), 2); |
6752 LayerImpl* scrolling_layer = scoped_scrolling_layer.get(); | 6751 LayerImpl* scrolling_layer = scoped_scrolling_layer.get(); |
6753 root->AddChild(std::move(scoped_scrolling_layer)); | 6752 root->AddChild(std::move(scoped_scrolling_layer)); |
6754 | 6753 |
6755 gfx::Size content_layer_bounds(100000, 100); | 6754 gfx::Size content_layer_bounds(100000, 100); |
6756 scoped_refptr<FakeDisplayListRasterSource> raster_source( | 6755 scoped_refptr<FakeDisplayListRasterSource> raster_source( |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7114 EXPECT_EQ(0u, context_provider->TestContext3d()->NumTextures()); | 7113 EXPECT_EQ(0u, context_provider->TestContext3d()->NumTextures()); |
7115 } | 7114 } |
7116 | 7115 |
7117 TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) { | 7116 TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) { |
7118 // When flinging via touch, only the child should scroll (we should not | 7117 // When flinging via touch, only the child should scroll (we should not |
7119 // bubble). | 7118 // bubble). |
7120 gfx::Size surface_size(10, 10); | 7119 gfx::Size surface_size(10, 10); |
7121 gfx::Size content_size(20, 20); | 7120 gfx::Size content_size(20, 20); |
7122 scoped_ptr<LayerImpl> root_clip = | 7121 scoped_ptr<LayerImpl> root_clip = |
7123 LayerImpl::Create(host_impl_->active_tree(), 3); | 7122 LayerImpl::Create(host_impl_->active_tree(), 3); |
7124 root_clip->SetHasRenderSurface(true); | 7123 root_clip->SetForceRenderSurface(true); |
7125 | 7124 |
7126 scoped_ptr<LayerImpl> root = | 7125 scoped_ptr<LayerImpl> root = |
7127 CreateScrollableLayer(1, content_size, root_clip.get()); | 7126 CreateScrollableLayer(1, content_size, root_clip.get()); |
7128 root->SetIsContainerForFixedPositionLayers(true); | 7127 root->SetIsContainerForFixedPositionLayers(true); |
7129 scoped_ptr<LayerImpl> child = | 7128 scoped_ptr<LayerImpl> child = |
7130 CreateScrollableLayer(2, content_size, root_clip.get()); | 7129 CreateScrollableLayer(2, content_size, root_clip.get()); |
7131 | 7130 |
7132 root->AddChild(std::move(child)); | 7131 root->AddChild(std::move(child)); |
7133 int root_id = root->id(); | 7132 int root_id = root->id(); |
7134 root_clip->AddChild(std::move(root)); | 7133 root_clip->AddChild(std::move(root)); |
(...skipping 23 matching lines...) Expand all Loading... |
7158 ASSERT_EQ(1u, scroll_info->scrolls.size()); | 7157 ASSERT_EQ(1u, scroll_info->scrolls.size()); |
7159 ExpectNone(*scroll_info.get(), root_id); | 7158 ExpectNone(*scroll_info.get(), root_id); |
7160 } | 7159 } |
7161 } | 7160 } |
7162 | 7161 |
7163 TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) { | 7162 TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) { |
7164 // Scroll a child layer beyond its maximum scroll range and make sure the | 7163 // Scroll a child layer beyond its maximum scroll range and make sure the |
7165 // the scroll doesn't bubble up to the parent layer. | 7164 // the scroll doesn't bubble up to the parent layer. |
7166 gfx::Size surface_size(10, 10); | 7165 gfx::Size surface_size(10, 10); |
7167 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 7166 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
7168 root->SetHasRenderSurface(true); | 7167 root->SetForceRenderSurface(true); |
7169 scoped_ptr<LayerImpl> root_scrolling = | 7168 scoped_ptr<LayerImpl> root_scrolling = |
7170 CreateScrollableLayer(2, surface_size, root.get()); | 7169 CreateScrollableLayer(2, surface_size, root.get()); |
7171 | 7170 |
7172 scoped_ptr<LayerImpl> grand_child = | 7171 scoped_ptr<LayerImpl> grand_child = |
7173 CreateScrollableLayer(4, surface_size, root.get()); | 7172 CreateScrollableLayer(4, surface_size, root.get()); |
7174 grand_child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); | 7173 grand_child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); |
7175 | 7174 |
7176 scoped_ptr<LayerImpl> child = | 7175 scoped_ptr<LayerImpl> child = |
7177 CreateScrollableLayer(3, surface_size, root.get()); | 7176 CreateScrollableLayer(3, surface_size, root.get()); |
7178 child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 4)); | 7177 child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 4)); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7229 host_impl_->ScrollEnd(); | 7228 host_impl_->ScrollEnd(); |
7230 } | 7229 } |
7231 } | 7230 } |
7232 | 7231 |
7233 TEST_F(LayerTreeHostImplTest, WheelFlingShouldntBubble) { | 7232 TEST_F(LayerTreeHostImplTest, WheelFlingShouldntBubble) { |
7234 // When flinging via wheel, we shouldn't bubble. | 7233 // When flinging via wheel, we shouldn't bubble. |
7235 gfx::Size surface_size(10, 10); | 7234 gfx::Size surface_size(10, 10); |
7236 gfx::Size content_size(20, 20); | 7235 gfx::Size content_size(20, 20); |
7237 scoped_ptr<LayerImpl> root_clip = | 7236 scoped_ptr<LayerImpl> root_clip = |
7238 LayerImpl::Create(host_impl_->active_tree(), 3); | 7237 LayerImpl::Create(host_impl_->active_tree(), 3); |
7239 root_clip->SetHasRenderSurface(true); | 7238 root_clip->SetForceRenderSurface(true); |
7240 scoped_ptr<LayerImpl> root_scroll = | 7239 scoped_ptr<LayerImpl> root_scroll = |
7241 CreateScrollableLayer(1, content_size, root_clip.get()); | 7240 CreateScrollableLayer(1, content_size, root_clip.get()); |
7242 int root_scroll_id = root_scroll->id(); | 7241 int root_scroll_id = root_scroll->id(); |
7243 scoped_ptr<LayerImpl> child = | 7242 scoped_ptr<LayerImpl> child = |
7244 CreateScrollableLayer(2, content_size, root_clip.get()); | 7243 CreateScrollableLayer(2, content_size, root_clip.get()); |
7245 | 7244 |
7246 root_scroll->AddChild(std::move(child)); | 7245 root_scroll->AddChild(std::move(child)); |
7247 root_clip->AddChild(std::move(root_scroll)); | 7246 root_clip->AddChild(std::move(root_scroll)); |
7248 | 7247 |
7249 host_impl_->SetViewportSize(surface_size); | 7248 host_impl_->SetViewportSize(surface_size); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7461 } | 7460 } |
7462 | 7461 |
7463 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed | 7462 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed |
7464 // to CompositorFrameMetadata after SwapBuffers(); | 7463 // to CompositorFrameMetadata after SwapBuffers(); |
7465 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { | 7464 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { |
7466 scoped_ptr<SolidColorLayerImpl> root = | 7465 scoped_ptr<SolidColorLayerImpl> root = |
7467 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); | 7466 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
7468 root->SetPosition(gfx::PointF()); | 7467 root->SetPosition(gfx::PointF()); |
7469 root->SetBounds(gfx::Size(10, 10)); | 7468 root->SetBounds(gfx::Size(10, 10)); |
7470 root->SetDrawsContent(true); | 7469 root->SetDrawsContent(true); |
7471 root->SetHasRenderSurface(true); | 7470 root->SetForceRenderSurface(true); |
7472 | 7471 |
7473 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 7472 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
7474 | 7473 |
7475 FakeOutputSurface* fake_output_surface = | 7474 FakeOutputSurface* fake_output_surface = |
7476 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); | 7475 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); |
7477 | 7476 |
7478 const std::vector<ui::LatencyInfo>& metadata_latency_before = | 7477 const std::vector<ui::LatencyInfo>& metadata_latency_before = |
7479 fake_output_surface->last_sent_frame().metadata.latency_info; | 7478 fake_output_surface->last_sent_frame().metadata.latency_info; |
7480 EXPECT_TRUE(metadata_latency_before.empty()); | 7479 EXPECT_TRUE(metadata_latency_before.empty()); |
7481 | 7480 |
(...skipping 19 matching lines...) Expand all Loading... |
7501 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); | 7500 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); |
7502 } | 7501 } |
7503 | 7502 |
7504 TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) { | 7503 TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) { |
7505 int root_layer_id = 1; | 7504 int root_layer_id = 1; |
7506 scoped_ptr<SolidColorLayerImpl> root = | 7505 scoped_ptr<SolidColorLayerImpl> root = |
7507 SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id); | 7506 SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id); |
7508 root->SetPosition(gfx::PointF()); | 7507 root->SetPosition(gfx::PointF()); |
7509 root->SetBounds(gfx::Size(10, 10)); | 7508 root->SetBounds(gfx::Size(10, 10)); |
7510 root->SetDrawsContent(true); | 7509 root->SetDrawsContent(true); |
7511 root->SetHasRenderSurface(true); | 7510 root->SetForceRenderSurface(true); |
7512 | 7511 |
7513 host_impl_->active_tree()->SetRootLayer(std::move(root)); | 7512 host_impl_->active_tree()->SetRootLayer(std::move(root)); |
7514 | 7513 |
7515 // Ensure the default frame selection bounds are empty. | 7514 // Ensure the default frame selection bounds are empty. |
7516 FakeOutputSurface* fake_output_surface = | 7515 FakeOutputSurface* fake_output_surface = |
7517 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); | 7516 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); |
7518 const ViewportSelection& selection_before = | 7517 const ViewportSelection& selection_before = |
7519 fake_output_surface->last_sent_frame().metadata.selection; | 7518 fake_output_surface->last_sent_frame().metadata.selection; |
7520 EXPECT_EQ(ViewportSelectionBound(), selection_before.start); | 7519 EXPECT_EQ(ViewportSelectionBound(), selection_before.start); |
7521 EXPECT_EQ(ViewportSelectionBound(), selection_before.end); | 7520 EXPECT_EQ(ViewportSelectionBound(), selection_before.end); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8136 contents->SetDrawsContent(true); | 8135 contents->SetDrawsContent(true); |
8137 contents->SetBounds(content_size); | 8136 contents->SetBounds(content_size); |
8138 contents->SetPosition(gfx::PointF()); | 8137 contents->SetPosition(gfx::PointF()); |
8139 | 8138 |
8140 outer_scroll->AddChild(std::move(contents)); | 8139 outer_scroll->AddChild(std::move(contents)); |
8141 outer_clip->AddChild(std::move(outer_scroll)); | 8140 outer_clip->AddChild(std::move(outer_scroll)); |
8142 inner_scroll->AddChild(std::move(outer_clip)); | 8141 inner_scroll->AddChild(std::move(outer_clip)); |
8143 page_scale->AddChild(std::move(inner_scroll)); | 8142 page_scale->AddChild(std::move(inner_scroll)); |
8144 inner_clip->AddChild(std::move(page_scale)); | 8143 inner_clip->AddChild(std::move(page_scale)); |
8145 | 8144 |
8146 inner_clip->SetHasRenderSurface(true); | 8145 inner_clip->SetForceRenderSurface(true); |
8147 layer_tree_impl->SetRootLayer(std::move(inner_clip)); | 8146 layer_tree_impl->SetRootLayer(std::move(inner_clip)); |
8148 layer_tree_impl->SetViewportLayersFromIds( | 8147 layer_tree_impl->SetViewportLayersFromIds( |
8149 Layer::INVALID_ID, kPageScaleLayerId, kInnerViewportScrollLayerId, | 8148 Layer::INVALID_ID, kPageScaleLayerId, kInnerViewportScrollLayerId, |
8150 kOuterViewportScrollLayerId); | 8149 kOuterViewportScrollLayerId); |
8151 | 8150 |
8152 host_impl_->active_tree()->DidBecomeActive(); | 8151 host_impl_->active_tree()->DidBecomeActive(); |
8153 } | 8152 } |
8154 }; | 8153 }; |
8155 | 8154 |
8156 TEST_F(LayerTreeHostImplVirtualViewportTest, ScrollBothInnerAndOuterLayer) { | 8155 TEST_F(LayerTreeHostImplVirtualViewportTest, ScrollBothInnerAndOuterLayer) { |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8603 | 8602 |
8604 TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsSublayerScaleFactor) { | 8603 TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsSublayerScaleFactor) { |
8605 const gfx::Size layer_size(100, 100); | 8604 const gfx::Size layer_size(100, 100); |
8606 SetupScrollAndContentsLayers(layer_size); | 8605 SetupScrollAndContentsLayers(layer_size); |
8607 LayerImpl* content_layer = host_impl_->active_tree() | 8606 LayerImpl* content_layer = host_impl_->active_tree() |
8608 ->OuterViewportScrollLayer() | 8607 ->OuterViewportScrollLayer() |
8609 ->children()[0] | 8608 ->children()[0] |
8610 .get(); | 8609 .get(); |
8611 content_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100)); | 8610 content_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100)); |
8612 LayerImpl* test_layer = host_impl_->active_tree()->LayerById(100); | 8611 LayerImpl* test_layer = host_impl_->active_tree()->LayerById(100); |
8613 test_layer->SetHasRenderSurface(true); | 8612 test_layer->SetForceRenderSurface(true); |
8614 test_layer->SetDrawsContent(true); | 8613 test_layer->SetDrawsContent(true); |
8615 test_layer->SetBounds(layer_size); | 8614 test_layer->SetBounds(layer_size); |
8616 gfx::Transform perspective_transform; | 8615 gfx::Transform perspective_transform; |
8617 perspective_transform.ApplyPerspectiveDepth(2); | 8616 perspective_transform.ApplyPerspectiveDepth(2); |
8618 test_layer->SetTransform(perspective_transform); | 8617 test_layer->SetTransform(perspective_transform); |
8619 | 8618 |
8620 RebuildPropertyTrees(); | 8619 RebuildPropertyTrees(); |
8621 bool update_lcd_text = false; | 8620 bool update_lcd_text = false; |
8622 | 8621 |
8623 host_impl_->SetViewportSize(gfx::Size(50, 50)); | 8622 host_impl_->SetViewportSize(gfx::Size(50, 50)); |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9260 TEST_F(LayerTreeHostImplTest, SubLayerScaleForNodeInSubtreeOfPageScaleLayer) { | 9259 TEST_F(LayerTreeHostImplTest, SubLayerScaleForNodeInSubtreeOfPageScaleLayer) { |
9261 // Checks that the sublayer scale of a transform node in the subtree of the | 9260 // Checks that the sublayer scale of a transform node in the subtree of the |
9262 // page scale layer is updated without a property tree rebuild. | 9261 // page scale layer is updated without a property tree rebuild. |
9263 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 3.f); | 9262 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 3.f); |
9264 CreateScrollAndContentsLayers(host_impl_->active_tree(), gfx::Size(100, 100)); | 9263 CreateScrollAndContentsLayers(host_impl_->active_tree(), gfx::Size(100, 100)); |
9265 LayerImpl* page_scale_layer = host_impl_->active_tree()->PageScaleLayer(); | 9264 LayerImpl* page_scale_layer = host_impl_->active_tree()->PageScaleLayer(); |
9266 page_scale_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100)); | 9265 page_scale_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100)); |
9267 | 9266 |
9268 LayerImpl* in_subtree_of_page_scale_layer = | 9267 LayerImpl* in_subtree_of_page_scale_layer = |
9269 host_impl_->active_tree()->LayerById(100); | 9268 host_impl_->active_tree()->LayerById(100); |
9270 in_subtree_of_page_scale_layer->SetHasRenderSurface(true); | 9269 in_subtree_of_page_scale_layer->SetForceRenderSurface(true); |
9271 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 9270 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
9272 DrawFrame(); | 9271 DrawFrame(); |
9273 TransformNode* node = | 9272 TransformNode* node = |
9274 host_impl_->active_tree()->property_trees()->transform_tree.Node( | 9273 host_impl_->active_tree()->property_trees()->transform_tree.Node( |
9275 in_subtree_of_page_scale_layer->transform_tree_index()); | 9274 in_subtree_of_page_scale_layer->transform_tree_index()); |
9276 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(1.f, 1.f)); | 9275 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(1.f, 1.f)); |
9277 | 9276 |
9278 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f); | 9277 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f); |
9279 DrawFrame(); | 9278 DrawFrame(); |
9280 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100); | 9279 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100); |
9281 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( | 9280 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( |
9282 in_subtree_of_page_scale_layer->transform_tree_index()); | 9281 in_subtree_of_page_scale_layer->transform_tree_index()); |
9283 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 9282 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); |
9284 } | 9283 } |
9285 | 9284 |
9286 } // namespace | 9285 } // namespace |
9287 } // namespace cc | 9286 } // namespace cc |
OLD | NEW |