| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 const int kInnerViewportClipLayerId = 4; | 282 const int kInnerViewportClipLayerId = 4; |
| 283 const int kPageScaleLayerId = 5; | 283 const int kPageScaleLayerId = 5; |
| 284 | 284 |
| 285 std::unique_ptr<LayerImpl> root = LayerImpl::Create(layer_tree_impl, 1); | 285 std::unique_ptr<LayerImpl> root = LayerImpl::Create(layer_tree_impl, 1); |
| 286 root->SetBounds(content_size); | 286 root->SetBounds(content_size); |
| 287 root->SetPosition(gfx::PointF()); | 287 root->SetPosition(gfx::PointF()); |
| 288 root->test_properties()->force_render_surface = true; | 288 root->test_properties()->force_render_surface = true; |
| 289 | 289 |
| 290 std::unique_ptr<LayerImpl> inner_scroll = | 290 std::unique_ptr<LayerImpl> inner_scroll = |
| 291 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); | 291 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); |
| 292 inner_scroll->SetIsContainerForFixedPositionLayers(true); | 292 inner_scroll->test_properties()->is_container_for_fixed_position_layers = |
| 293 true; |
| 293 inner_scroll->layer_tree_impl() | 294 inner_scroll->layer_tree_impl() |
| 294 ->property_trees() | 295 ->property_trees() |
| 295 ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), | 296 ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), |
| 296 gfx::ScrollOffset()); | 297 gfx::ScrollOffset()); |
| 297 | 298 |
| 298 std::unique_ptr<LayerImpl> inner_clip = | 299 std::unique_ptr<LayerImpl> inner_clip = |
| 299 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 300 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
| 300 inner_clip->SetBounds( | 301 inner_clip->SetBounds( |
| 301 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 302 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
| 302 | 303 |
| 303 std::unique_ptr<LayerImpl> page_scale = | 304 std::unique_ptr<LayerImpl> page_scale = |
| 304 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 305 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
| 305 | 306 |
| 306 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 307 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
| 307 inner_scroll->SetBounds(content_size); | 308 inner_scroll->SetBounds(content_size); |
| 308 inner_scroll->SetPosition(gfx::PointF()); | 309 inner_scroll->SetPosition(gfx::PointF()); |
| 309 | 310 |
| 310 std::unique_ptr<LayerImpl> outer_clip = | 311 std::unique_ptr<LayerImpl> outer_clip = |
| 311 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 312 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
| 312 outer_clip->SetBounds(content_size); | 313 outer_clip->SetBounds(content_size); |
| 313 outer_clip->SetIsContainerForFixedPositionLayers(true); | 314 outer_clip->test_properties()->is_container_for_fixed_position_layers = |
| 315 true; |
| 314 | 316 |
| 315 std::unique_ptr<LayerImpl> outer_scroll = | 317 std::unique_ptr<LayerImpl> outer_scroll = |
| 316 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 318 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
| 317 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 319 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
| 318 outer_scroll->layer_tree_impl() | 320 outer_scroll->layer_tree_impl() |
| 319 ->property_trees() | 321 ->property_trees() |
| 320 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | 322 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), |
| 321 gfx::ScrollOffset()); | 323 gfx::ScrollOffset()); |
| 322 outer_scroll->SetBounds(content_size); | 324 outer_scroll->SetBounds(content_size); |
| 323 outer_scroll->SetPosition(gfx::PointF()); | 325 outer_scroll->SetPosition(gfx::PointF()); |
| (...skipping 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3460 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); | 3462 root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); |
| 3461 root->test_properties()->force_render_surface = true; | 3463 root->test_properties()->force_render_surface = true; |
| 3462 DidDrawCheckLayer* layer1 = | 3464 DidDrawCheckLayer* layer1 = |
| 3463 static_cast<DidDrawCheckLayer*>(root->children()[0]); | 3465 static_cast<DidDrawCheckLayer*>(root->children()[0]); |
| 3464 | 3466 |
| 3465 layer1->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); | 3467 layer1->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); |
| 3466 DidDrawCheckLayer* layer2 = | 3468 DidDrawCheckLayer* layer2 = |
| 3467 static_cast<DidDrawCheckLayer*>(layer1->children()[0]); | 3469 static_cast<DidDrawCheckLayer*>(layer1->children()[0]); |
| 3468 | 3470 |
| 3469 layer1->test_properties()->force_render_surface = true; | 3471 layer1->test_properties()->force_render_surface = true; |
| 3470 layer1->SetShouldFlattenTransform(true); | 3472 layer1->test_properties()->should_flatten_transform = true; |
| 3471 | 3473 |
| 3472 EXPECT_FALSE(root->did_draw_called()); | 3474 EXPECT_FALSE(root->did_draw_called()); |
| 3473 EXPECT_FALSE(layer1->did_draw_called()); | 3475 EXPECT_FALSE(layer1->did_draw_called()); |
| 3474 EXPECT_FALSE(layer2->did_draw_called()); | 3476 EXPECT_FALSE(layer2->did_draw_called()); |
| 3475 | 3477 |
| 3476 LayerTreeHostImpl::FrameData frame; | 3478 LayerTreeHostImpl::FrameData frame; |
| 3477 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( | 3479 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( |
| 3478 host_impl_->active_tree()->root_layer()); | 3480 host_impl_->active_tree()->root_layer()); |
| 3479 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 3481 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
| 3480 host_impl_->DrawLayers(&frame); | 3482 host_impl_->DrawLayers(&frame); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3873 std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(tree_impl, 3); | 3875 std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(tree_impl, 3); |
| 3874 | 3876 |
| 3875 std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(tree_impl, 4); | 3877 std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(tree_impl, 4); |
| 3876 std::unique_ptr<LayerImpl> outer_clip = LayerImpl::Create(tree_impl, 5); | 3878 std::unique_ptr<LayerImpl> outer_clip = LayerImpl::Create(tree_impl, 5); |
| 3877 | 3879 |
| 3878 root_clip->SetBounds(inner_viewport_size); | 3880 root_clip->SetBounds(inner_viewport_size); |
| 3879 root->SetScrollClipLayer(root_clip->id()); | 3881 root->SetScrollClipLayer(root_clip->id()); |
| 3880 root->SetBounds(outer_viewport_size); | 3882 root->SetBounds(outer_viewport_size); |
| 3881 root->SetPosition(gfx::PointF()); | 3883 root->SetPosition(gfx::PointF()); |
| 3882 root->SetDrawsContent(false); | 3884 root->SetDrawsContent(false); |
| 3883 root->SetIsContainerForFixedPositionLayers(true); | |
| 3884 root_clip->test_properties()->force_render_surface = true; | 3885 root_clip->test_properties()->force_render_surface = true; |
| 3886 root->test_properties()->is_container_for_fixed_position_layers = true; |
| 3885 outer_clip->SetBounds(outer_viewport_size); | 3887 outer_clip->SetBounds(outer_viewport_size); |
| 3886 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 3888 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
| 3887 outer_scroll->SetBounds(scroll_layer_size); | 3889 outer_scroll->SetBounds(scroll_layer_size); |
| 3888 outer_scroll->SetPosition(gfx::PointF()); | 3890 outer_scroll->SetPosition(gfx::PointF()); |
| 3889 outer_scroll->SetDrawsContent(false); | 3891 outer_scroll->SetDrawsContent(false); |
| 3890 outer_scroll->SetIsContainerForFixedPositionLayers(true); | 3892 outer_scroll->test_properties()->is_container_for_fixed_position_layers = |
| 3893 true; |
| 3891 | 3894 |
| 3892 int inner_viewport_scroll_layer_id = root->id(); | 3895 int inner_viewport_scroll_layer_id = root->id(); |
| 3893 int outer_viewport_scroll_layer_id = outer_scroll->id(); | 3896 int outer_viewport_scroll_layer_id = outer_scroll->id(); |
| 3894 int page_scale_layer_id = page_scale->id(); | 3897 int page_scale_layer_id = page_scale->id(); |
| 3895 | 3898 |
| 3896 outer_clip->AddChild(std::move(outer_scroll)); | 3899 outer_clip->AddChild(std::move(outer_scroll)); |
| 3897 root->AddChild(std::move(outer_clip)); | 3900 root->AddChild(std::move(outer_clip)); |
| 3898 page_scale->AddChild(std::move(root)); | 3901 page_scale->AddChild(std::move(root)); |
| 3899 root_clip->AddChild(std::move(page_scale)); | 3902 root_clip->AddChild(std::move(page_scale)); |
| 3900 | 3903 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4198 std::unique_ptr<LayerImpl> child = | 4201 std::unique_ptr<LayerImpl> child = |
| 4199 LayerImpl::Create(host_impl_->active_tree(), id + 2); | 4202 LayerImpl::Create(host_impl_->active_tree(), id + 2); |
| 4200 std::unique_ptr<LayerImpl> child_clip = | 4203 std::unique_ptr<LayerImpl> child_clip = |
| 4201 LayerImpl::Create(host_impl_->active_tree(), id + 3); | 4204 LayerImpl::Create(host_impl_->active_tree(), id + 3); |
| 4202 | 4205 |
| 4203 child_clip->SetBounds(sub_content_layer_size); | 4206 child_clip->SetBounds(sub_content_layer_size); |
| 4204 child->SetScrollClipLayer(child_clip->id()); | 4207 child->SetScrollClipLayer(child_clip->id()); |
| 4205 child->SetBounds(sub_content_size); | 4208 child->SetBounds(sub_content_size); |
| 4206 child->SetPosition(gfx::PointF()); | 4209 child->SetPosition(gfx::PointF()); |
| 4207 child->SetDrawsContent(true); | 4210 child->SetDrawsContent(true); |
| 4208 child->SetIsContainerForFixedPositionLayers(true); | 4211 child->test_properties()->is_container_for_fixed_position_layers = true; |
| 4209 | 4212 |
| 4210 // scroll child to limit | 4213 // scroll child to limit |
| 4211 SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); | 4214 SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); |
| 4212 child_clip->AddChild(std::move(child)); | 4215 child_clip->AddChild(std::move(child)); |
| 4213 outer_viewport_scroll_layer->AddChild(std::move(child_clip)); | 4216 outer_viewport_scroll_layer->AddChild(std::move(child_clip)); |
| 4214 | 4217 |
| 4215 // Scroll 25px to hide top controls | 4218 // Scroll 25px to hide top controls |
| 4216 gfx::Vector2dF scroll_delta(0.f, 25.f); | 4219 gfx::Vector2dF scroll_delta(0.f, 25.f); |
| 4217 host_impl_->active_tree()->property_trees()->needs_rebuild = true; | 4220 host_impl_->active_tree()->property_trees()->needs_rebuild = true; |
| 4218 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 4221 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5072 // the scroll doesn't bubble up to the parent layer. | 5075 // the scroll doesn't bubble up to the parent layer. |
| 5073 gfx::Size surface_size(20, 20); | 5076 gfx::Size surface_size(20, 20); |
| 5074 gfx::Size viewport_size(10, 10); | 5077 gfx::Size viewport_size(10, 10); |
| 5075 std::unique_ptr<LayerImpl> root_ptr = | 5078 std::unique_ptr<LayerImpl> root_ptr = |
| 5076 LayerImpl::Create(host_impl_->active_tree(), 1); | 5079 LayerImpl::Create(host_impl_->active_tree(), 1); |
| 5077 std::unique_ptr<LayerImpl> root_clip = | 5080 std::unique_ptr<LayerImpl> root_clip = |
| 5078 LayerImpl::Create(host_impl_->active_tree(), 2); | 5081 LayerImpl::Create(host_impl_->active_tree(), 2); |
| 5079 root_clip->test_properties()->force_render_surface = true; | 5082 root_clip->test_properties()->force_render_surface = true; |
| 5080 std::unique_ptr<LayerImpl> root_scrolling = | 5083 std::unique_ptr<LayerImpl> root_scrolling = |
| 5081 CreateScrollableLayer(3, surface_size, root_clip.get()); | 5084 CreateScrollableLayer(3, surface_size, root_clip.get()); |
| 5082 root_scrolling->SetIsContainerForFixedPositionLayers(true); | 5085 root_scrolling->test_properties()->is_container_for_fixed_position_layers = |
| 5086 true; |
| 5083 | 5087 |
| 5084 std::unique_ptr<LayerImpl> grand_child = | 5088 std::unique_ptr<LayerImpl> grand_child = |
| 5085 CreateScrollableLayer(5, surface_size, root_clip.get()); | 5089 CreateScrollableLayer(5, surface_size, root_clip.get()); |
| 5086 | 5090 |
| 5087 std::unique_ptr<LayerImpl> child = | 5091 std::unique_ptr<LayerImpl> child = |
| 5088 CreateScrollableLayer(4, surface_size, root_clip.get()); | 5092 CreateScrollableLayer(4, surface_size, root_clip.get()); |
| 5089 LayerImpl* grand_child_layer = grand_child.get(); | 5093 LayerImpl* grand_child_layer = grand_child.get(); |
| 5090 child->AddChild(std::move(grand_child)); | 5094 child->AddChild(std::move(grand_child)); |
| 5091 | 5095 |
| 5092 LayerImpl* child_layer = child.get(); | 5096 LayerImpl* child_layer = child.get(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5208 LayerImpl::Create(host_impl_->active_tree(), 4); | 5212 LayerImpl::Create(host_impl_->active_tree(), 4); |
| 5209 std::unique_ptr<LayerImpl> root_clip = | 5213 std::unique_ptr<LayerImpl> root_clip = |
| 5210 LayerImpl::Create(host_impl_->active_tree(), 3); | 5214 LayerImpl::Create(host_impl_->active_tree(), 3); |
| 5211 root_clip->test_properties()->force_render_surface = true; | 5215 root_clip->test_properties()->force_render_surface = true; |
| 5212 std::unique_ptr<LayerImpl> root_scroll = | 5216 std::unique_ptr<LayerImpl> root_scroll = |
| 5213 CreateScrollableLayer(1, content_size, root_clip.get()); | 5217 CreateScrollableLayer(1, content_size, root_clip.get()); |
| 5214 // Make 'root' the clip layer for child: since they have the same sizes the | 5218 // Make 'root' the clip layer for child: since they have the same sizes the |
| 5215 // child will have zero max_scroll_offset and scrolls will bubble. | 5219 // child will have zero max_scroll_offset and scrolls will bubble. |
| 5216 std::unique_ptr<LayerImpl> child = | 5220 std::unique_ptr<LayerImpl> child = |
| 5217 CreateScrollableLayer(2, content_size, root_scroll.get()); | 5221 CreateScrollableLayer(2, content_size, root_scroll.get()); |
| 5218 child->SetIsContainerForFixedPositionLayers(true); | 5222 child->test_properties()->is_container_for_fixed_position_layers = true; |
| 5219 root_scroll->SetBounds(content_size); | 5223 root_scroll->SetBounds(content_size); |
| 5220 | 5224 |
| 5221 int root_scroll_id = root_scroll->id(); | 5225 int root_scroll_id = root_scroll->id(); |
| 5222 root_scroll->AddChild(std::move(child)); | 5226 root_scroll->AddChild(std::move(child)); |
| 5223 root_clip->AddChild(std::move(root_scroll)); | 5227 root_clip->AddChild(std::move(root_scroll)); |
| 5224 root_ptr->AddChild(std::move(root_clip)); | 5228 root_ptr->AddChild(std::move(root_clip)); |
| 5225 | 5229 |
| 5226 host_impl_->SetViewportSize(surface_size); | 5230 host_impl_->SetViewportSize(surface_size); |
| 5227 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); | 5231 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); |
| 5228 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 4, 2, | 5232 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 4, 2, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5250 } | 5254 } |
| 5251 | 5255 |
| 5252 TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { | 5256 TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { |
| 5253 gfx::Size surface_size(10, 10); | 5257 gfx::Size surface_size(10, 10); |
| 5254 std::unique_ptr<LayerImpl> root_ptr = | 5258 std::unique_ptr<LayerImpl> root_ptr = |
| 5255 LayerImpl::Create(host_impl_->active_tree(), 1); | 5259 LayerImpl::Create(host_impl_->active_tree(), 1); |
| 5256 std::unique_ptr<LayerImpl> root_clip = | 5260 std::unique_ptr<LayerImpl> root_clip = |
| 5257 LayerImpl::Create(host_impl_->active_tree(), 2); | 5261 LayerImpl::Create(host_impl_->active_tree(), 2); |
| 5258 std::unique_ptr<LayerImpl> root_scroll = | 5262 std::unique_ptr<LayerImpl> root_scroll = |
| 5259 CreateScrollableLayer(3, surface_size, root_clip.get()); | 5263 CreateScrollableLayer(3, surface_size, root_clip.get()); |
| 5260 root_scroll->SetIsContainerForFixedPositionLayers(true); | |
| 5261 root_clip->test_properties()->force_render_surface = true; | 5264 root_clip->test_properties()->force_render_surface = true; |
| 5265 root_scroll->test_properties()->is_container_for_fixed_position_layers = true; |
| 5262 root_clip->AddChild(std::move(root_scroll)); | 5266 root_clip->AddChild(std::move(root_scroll)); |
| 5263 root_ptr->AddChild(std::move(root_clip)); | 5267 root_ptr->AddChild(std::move(root_clip)); |
| 5264 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); | 5268 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); |
| 5265 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 3, | 5269 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 3, |
| 5266 Layer::INVALID_ID); | 5270 Layer::INVALID_ID); |
| 5267 host_impl_->active_tree()->DidBecomeActive(); | 5271 host_impl_->active_tree()->DidBecomeActive(); |
| 5268 host_impl_->SetViewportSize(surface_size); | 5272 host_impl_->SetViewportSize(surface_size); |
| 5269 | 5273 |
| 5270 // Draw one frame and then immediately rebuild the layer tree to mimic a tree | 5274 // Draw one frame and then immediately rebuild the layer tree to mimic a tree |
| 5271 // synchronization. | 5275 // synchronization. |
| 5272 SetNeedsRebuildPropertyTrees(); | 5276 SetNeedsRebuildPropertyTrees(); |
| 5273 DrawFrame(); | 5277 DrawFrame(); |
| 5274 host_impl_->active_tree()->ClearLayers(); | 5278 host_impl_->active_tree()->ClearLayers(); |
| 5275 std::unique_ptr<LayerImpl> root_ptr2 = | 5279 std::unique_ptr<LayerImpl> root_ptr2 = |
| 5276 LayerImpl::Create(host_impl_->active_tree(), 4); | 5280 LayerImpl::Create(host_impl_->active_tree(), 4); |
| 5277 std::unique_ptr<LayerImpl> root_clip2 = | 5281 std::unique_ptr<LayerImpl> root_clip2 = |
| 5278 LayerImpl::Create(host_impl_->active_tree(), 5); | 5282 LayerImpl::Create(host_impl_->active_tree(), 5); |
| 5279 std::unique_ptr<LayerImpl> root_scroll2 = | 5283 std::unique_ptr<LayerImpl> root_scroll2 = |
| 5280 CreateScrollableLayer(6, surface_size, root_clip2.get()); | 5284 CreateScrollableLayer(6, surface_size, root_clip2.get()); |
| 5281 root_scroll2->SetIsContainerForFixedPositionLayers(true); | 5285 root_scroll2->test_properties()->is_container_for_fixed_position_layers = |
| 5286 true; |
| 5282 root_clip2->AddChild(std::move(root_scroll2)); | 5287 root_clip2->AddChild(std::move(root_scroll2)); |
| 5283 root_clip2->test_properties()->force_render_surface = true; | 5288 root_clip2->test_properties()->force_render_surface = true; |
| 5284 root_ptr2->AddChild(std::move(root_clip2)); | 5289 root_ptr2->AddChild(std::move(root_clip2)); |
| 5285 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr2)); | 5290 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr2)); |
| 5286 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 4, 6, | 5291 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 4, 6, |
| 5287 Layer::INVALID_ID); | 5292 Layer::INVALID_ID); |
| 5288 host_impl_->active_tree()->DidBecomeActive(); | 5293 host_impl_->active_tree()->DidBecomeActive(); |
| 5289 | 5294 |
| 5290 // Scrolling should still work even though we did not draw yet. | 5295 // Scrolling should still work even though we did not draw yet. |
| 5291 SetNeedsRebuildPropertyTrees(); | 5296 SetNeedsRebuildPropertyTrees(); |
| (...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7807 gfx::Size surface_size(10, 10); | 7812 gfx::Size surface_size(10, 10); |
| 7808 gfx::Size content_size(20, 20); | 7813 gfx::Size content_size(20, 20); |
| 7809 std::unique_ptr<LayerImpl> root_ptr = | 7814 std::unique_ptr<LayerImpl> root_ptr = |
| 7810 LayerImpl::Create(host_impl_->active_tree(), 4); | 7815 LayerImpl::Create(host_impl_->active_tree(), 4); |
| 7811 std::unique_ptr<LayerImpl> root_clip = | 7816 std::unique_ptr<LayerImpl> root_clip = |
| 7812 LayerImpl::Create(host_impl_->active_tree(), 3); | 7817 LayerImpl::Create(host_impl_->active_tree(), 3); |
| 7813 root_clip->test_properties()->force_render_surface = true; | 7818 root_clip->test_properties()->force_render_surface = true; |
| 7814 | 7819 |
| 7815 std::unique_ptr<LayerImpl> root_scroll = | 7820 std::unique_ptr<LayerImpl> root_scroll = |
| 7816 CreateScrollableLayer(1, content_size, root_clip.get()); | 7821 CreateScrollableLayer(1, content_size, root_clip.get()); |
| 7817 root_scroll->SetIsContainerForFixedPositionLayers(true); | 7822 root_scroll->test_properties()->is_container_for_fixed_position_layers = true; |
| 7818 std::unique_ptr<LayerImpl> child = | 7823 std::unique_ptr<LayerImpl> child = |
| 7819 CreateScrollableLayer(2, content_size, root_clip.get()); | 7824 CreateScrollableLayer(2, content_size, root_clip.get()); |
| 7820 | 7825 |
| 7821 root_scroll->AddChild(std::move(child)); | 7826 root_scroll->AddChild(std::move(child)); |
| 7822 int root_id = root_scroll->id(); | 7827 int root_id = root_scroll->id(); |
| 7823 root_clip->AddChild(std::move(root_scroll)); | 7828 root_clip->AddChild(std::move(root_scroll)); |
| 7824 root_ptr->AddChild(std::move(root_clip)); | 7829 root_ptr->AddChild(std::move(root_clip)); |
| 7825 | 7830 |
| 7826 host_impl_->SetViewportSize(surface_size); | 7831 host_impl_->SetViewportSize(surface_size); |
| 7827 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); | 7832 host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8891 const gfx::Size& inner_viewport) { | 8896 const gfx::Size& inner_viewport) { |
| 8892 LayerTreeImpl* layer_tree_impl = host_impl_->active_tree(); | 8897 LayerTreeImpl* layer_tree_impl = host_impl_->active_tree(); |
| 8893 const int kOuterViewportClipLayerId = 6; | 8898 const int kOuterViewportClipLayerId = 6; |
| 8894 const int kOuterViewportScrollLayerId = 7; | 8899 const int kOuterViewportScrollLayerId = 7; |
| 8895 const int kInnerViewportScrollLayerId = 2; | 8900 const int kInnerViewportScrollLayerId = 2; |
| 8896 const int kInnerViewportClipLayerId = 4; | 8901 const int kInnerViewportClipLayerId = 4; |
| 8897 const int kPageScaleLayerId = 5; | 8902 const int kPageScaleLayerId = 5; |
| 8898 | 8903 |
| 8899 std::unique_ptr<LayerImpl> inner_scroll = | 8904 std::unique_ptr<LayerImpl> inner_scroll = |
| 8900 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); | 8905 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); |
| 8901 inner_scroll->SetIsContainerForFixedPositionLayers(true); | 8906 inner_scroll->test_properties()->is_container_for_fixed_position_layers = |
| 8907 true; |
| 8902 inner_scroll->layer_tree_impl() | 8908 inner_scroll->layer_tree_impl() |
| 8903 ->property_trees() | 8909 ->property_trees() |
| 8904 ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), | 8910 ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), |
| 8905 gfx::ScrollOffset()); | 8911 gfx::ScrollOffset()); |
| 8906 | 8912 |
| 8907 std::unique_ptr<LayerImpl> inner_clip = | 8913 std::unique_ptr<LayerImpl> inner_clip = |
| 8908 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 8914 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
| 8909 inner_clip->SetBounds(inner_viewport); | 8915 inner_clip->SetBounds(inner_viewport); |
| 8910 | 8916 |
| 8911 std::unique_ptr<LayerImpl> page_scale = | 8917 std::unique_ptr<LayerImpl> page_scale = |
| 8912 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 8918 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
| 8913 | 8919 |
| 8914 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 8920 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
| 8915 inner_scroll->SetBounds(outer_viewport); | 8921 inner_scroll->SetBounds(outer_viewport); |
| 8916 inner_scroll->SetPosition(gfx::PointF()); | 8922 inner_scroll->SetPosition(gfx::PointF()); |
| 8917 | 8923 |
| 8918 std::unique_ptr<LayerImpl> outer_clip = | 8924 std::unique_ptr<LayerImpl> outer_clip = |
| 8919 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 8925 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
| 8920 outer_clip->SetBounds(outer_viewport); | 8926 outer_clip->SetBounds(outer_viewport); |
| 8921 outer_clip->SetIsContainerForFixedPositionLayers(true); | 8927 outer_clip->test_properties()->is_container_for_fixed_position_layers = |
| 8928 true; |
| 8922 | 8929 |
| 8923 std::unique_ptr<LayerImpl> outer_scroll = | 8930 std::unique_ptr<LayerImpl> outer_scroll = |
| 8924 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 8931 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
| 8925 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 8932 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
| 8926 outer_scroll->layer_tree_impl() | 8933 outer_scroll->layer_tree_impl() |
| 8927 ->property_trees() | 8934 ->property_trees() |
| 8928 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | 8935 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), |
| 8929 gfx::ScrollOffset()); | 8936 gfx::ScrollOffset()); |
| 8930 outer_scroll->SetBounds(content_size); | 8937 outer_scroll->SetBounds(content_size); |
| 8931 outer_scroll->SetPosition(gfx::PointF()); | 8938 outer_scroll->SetPosition(gfx::PointF()); |
| (...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10673 // There should not be any jitter measured till we hit the fixed point hits | 10680 // There should not be any jitter measured till we hit the fixed point hits |
| 10674 // threshold. | 10681 // threshold. |
| 10675 float expected_jitter = | 10682 float expected_jitter = |
| 10676 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10683 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
| 10677 EXPECT_EQ(jitter, expected_jitter); | 10684 EXPECT_EQ(jitter, expected_jitter); |
| 10678 } | 10685 } |
| 10679 } | 10686 } |
| 10680 | 10687 |
| 10681 } // namespace | 10688 } // namespace |
| 10682 } // namespace cc | 10689 } // namespace cc |
| OLD | NEW |