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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 std::unique_ptr<LayerImpl> inner_clip = | 333 std::unique_ptr<LayerImpl> inner_clip = |
334 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 334 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
335 inner_clip->SetBounds( | 335 inner_clip->SetBounds( |
336 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 336 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
337 | 337 |
338 std::unique_ptr<LayerImpl> page_scale = | 338 std::unique_ptr<LayerImpl> page_scale = |
339 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 339 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
340 | 340 |
341 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 341 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
342 inner_scroll->SetElementId( | 342 inner_scroll->SetElementId(inner_scroll->id()); |
343 LayerIdToElementIdForTesting(inner_scroll->id())); | |
344 inner_scroll->SetBounds(content_size); | 343 inner_scroll->SetBounds(content_size); |
345 inner_scroll->SetPosition(gfx::PointF()); | 344 inner_scroll->SetPosition(gfx::PointF()); |
346 | 345 |
347 std::unique_ptr<LayerImpl> outer_clip = | 346 std::unique_ptr<LayerImpl> outer_clip = |
348 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 347 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
349 outer_clip->SetBounds(content_size); | 348 outer_clip->SetBounds(content_size); |
350 outer_clip->test_properties()->is_container_for_fixed_position_layers = | 349 outer_clip->test_properties()->is_container_for_fixed_position_layers = |
351 true; | 350 true; |
352 | 351 |
353 std::unique_ptr<LayerImpl> outer_scroll = | 352 std::unique_ptr<LayerImpl> outer_scroll = |
354 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 353 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
355 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 354 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
356 outer_scroll->SetElementId( | 355 outer_scroll->SetElementId(outer_scroll->id()); |
357 LayerIdToElementIdForTesting(outer_scroll->id())); | |
358 outer_scroll->layer_tree_impl() | 356 outer_scroll->layer_tree_impl() |
359 ->property_trees() | 357 ->property_trees() |
360 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | 358 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), |
361 gfx::ScrollOffset()); | 359 gfx::ScrollOffset()); |
362 outer_scroll->SetBounds(content_size); | 360 outer_scroll->SetBounds(content_size); |
363 outer_scroll->SetPosition(gfx::PointF()); | 361 outer_scroll->SetPosition(gfx::PointF()); |
364 | 362 |
365 std::unique_ptr<LayerImpl> contents = | 363 std::unique_ptr<LayerImpl> contents = |
366 LayerImpl::Create(layer_tree_impl, kContentLayerId); | 364 LayerImpl::Create(layer_tree_impl, kContentLayerId); |
367 contents->SetDrawsContent(true); | 365 contents->SetDrawsContent(true); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 425 } |
428 | 426 |
429 std::unique_ptr<LayerImpl> CreateScrollableLayer(int id, | 427 std::unique_ptr<LayerImpl> CreateScrollableLayer(int id, |
430 const gfx::Size& size, | 428 const gfx::Size& size, |
431 LayerImpl* clip_layer) { | 429 LayerImpl* clip_layer) { |
432 DCHECK(clip_layer); | 430 DCHECK(clip_layer); |
433 DCHECK(id != clip_layer->id()); | 431 DCHECK(id != clip_layer->id()); |
434 std::unique_ptr<LayerImpl> layer = | 432 std::unique_ptr<LayerImpl> layer = |
435 LayerImpl::Create(host_impl_->active_tree(), id); | 433 LayerImpl::Create(host_impl_->active_tree(), id); |
436 layer->SetScrollClipLayer(clip_layer->id()); | 434 layer->SetScrollClipLayer(clip_layer->id()); |
437 layer->SetElementId(LayerIdToElementIdForTesting(layer->id())); | 435 layer->SetElementId(layer->id()); |
438 layer->SetDrawsContent(true); | 436 layer->SetDrawsContent(true); |
439 layer->SetBounds(size); | 437 layer->SetBounds(size); |
440 clip_layer->SetBounds(gfx::Size(size.width() / 2, size.height() / 2)); | 438 clip_layer->SetBounds(gfx::Size(size.width() / 2, size.height() / 2)); |
441 return layer; | 439 return layer; |
442 } | 440 } |
443 | 441 |
444 std::unique_ptr<ScrollState> BeginState(const gfx::Point& point) { | 442 std::unique_ptr<ScrollState> BeginState(const gfx::Point& point) { |
445 ScrollStateData scroll_state_data; | 443 ScrollStateData scroll_state_data; |
446 scroll_state_data.is_beginning = true; | 444 scroll_state_data.is_beginning = true; |
447 scroll_state_data.position_x = point.x(); | 445 scroll_state_data.position_x = point.x(); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 | 719 |
722 auto root_clip_owned = LayerImpl::Create(host_impl_->active_tree(), 2); | 720 auto root_clip_owned = LayerImpl::Create(host_impl_->active_tree(), 2); |
723 auto* root_clip = root_clip_owned.get(); | 721 auto* root_clip = root_clip_owned.get(); |
724 auto root_owned = LayerImpl::Create(host_impl_->active_tree(), 1); | 722 auto root_owned = LayerImpl::Create(host_impl_->active_tree(), 1); |
725 auto* root = root_owned.get(); | 723 auto* root = root_owned.get(); |
726 | 724 |
727 root_clip->SetBounds(gfx::Size(10, 10)); | 725 root_clip->SetBounds(gfx::Size(10, 10)); |
728 root_clip->test_properties()->AddChild(std::move(root_owned)); | 726 root_clip->test_properties()->AddChild(std::move(root_owned)); |
729 root->SetBounds(gfx::Size(110, 110)); | 727 root->SetBounds(gfx::Size(110, 110)); |
730 root->SetScrollClipLayer(root_clip->id()); | 728 root->SetScrollClipLayer(root_clip->id()); |
731 root->SetElementId(LayerIdToElementIdForTesting(root->id())); | 729 root->SetElementId(root->id()); |
732 root->layer_tree_impl() | 730 root->layer_tree_impl() |
733 ->property_trees() | 731 ->property_trees() |
734 ->scroll_tree.UpdateScrollOffsetBaseForTesting(root->id(), scroll_offset); | 732 ->scroll_tree.UpdateScrollOffsetBaseForTesting(root->id(), scroll_offset); |
735 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_clip_owned)); | 733 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_clip_owned)); |
736 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 734 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
737 | 735 |
738 std::unique_ptr<ScrollAndScaleSet> scroll_info; | 736 std::unique_ptr<ScrollAndScaleSet> scroll_info; |
739 | 737 |
740 root->ScrollBy(scroll_delta); | 738 root->ScrollBy(scroll_delta); |
741 scroll_info = host_impl_->ProcessScrollDeltas(); | 739 scroll_info = host_impl_->ProcessScrollDeltas(); |
(...skipping 22 matching lines...) Expand all Loading... |
764 host_impl_->active_tree()->OuterViewportScrollLayer(); | 762 host_impl_->active_tree()->OuterViewportScrollLayer(); |
765 int id = outer_viewport_scroll_layer->id(); | 763 int id = outer_viewport_scroll_layer->id(); |
766 std::unique_ptr<LayerImpl> child = | 764 std::unique_ptr<LayerImpl> child = |
767 LayerImpl::Create(host_impl_->active_tree(), id + 2); | 765 LayerImpl::Create(host_impl_->active_tree(), id + 2); |
768 std::unique_ptr<LayerImpl> child_clip = | 766 std::unique_ptr<LayerImpl> child_clip = |
769 LayerImpl::Create(host_impl_->active_tree(), id + 3); | 767 LayerImpl::Create(host_impl_->active_tree(), id + 3); |
770 | 768 |
771 child_clip->SetBounds(gfx::Size(100, 100)); | 769 child_clip->SetBounds(gfx::Size(100, 100)); |
772 | 770 |
773 child->SetScrollClipLayer(child_clip->id()); | 771 child->SetScrollClipLayer(child_clip->id()); |
774 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 772 child->SetElementId(child->id()); |
775 child->SetBounds(gfx::Size(100, 400)); | 773 child->SetBounds(gfx::Size(100, 400)); |
776 child->SetPosition(gfx::PointF()); | 774 child->SetPosition(gfx::PointF()); |
777 child->SetDrawsContent(true); | 775 child->SetDrawsContent(true); |
778 | 776 |
779 child_clip->test_properties()->AddChild(std::move(child)); | 777 child_clip->test_properties()->AddChild(std::move(child)); |
780 outer_viewport_scroll_layer->test_properties()->AddChild( | 778 outer_viewport_scroll_layer->test_properties()->AddChild( |
781 std::move(child_clip)); | 779 std::move(child_clip)); |
782 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 780 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
783 | 781 |
784 base::HistogramTester histogram_tester; | 782 base::HistogramTester histogram_tester; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 root->SetBounds(content_size); | 1085 root->SetBounds(content_size); |
1088 root->SetPosition(gfx::PointF()); | 1086 root->SetPosition(gfx::PointF()); |
1089 | 1087 |
1090 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); | 1088 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); |
1091 clip->SetBounds(content_size); | 1089 clip->SetBounds(content_size); |
1092 clip->SetPosition(gfx::PointF()); | 1090 clip->SetPosition(gfx::PointF()); |
1093 | 1091 |
1094 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); | 1092 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); |
1095 scroll->SetBounds(scroll_content_size); | 1093 scroll->SetBounds(scroll_content_size); |
1096 scroll->SetScrollClipLayer(clip->id()); | 1094 scroll->SetScrollClipLayer(clip->id()); |
1097 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 1095 scroll->SetElementId(scroll->id()); |
1098 scroll->SetDrawsContent(true); | 1096 scroll->SetDrawsContent(true); |
1099 | 1097 |
1100 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = | 1098 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = |
1101 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, | 1099 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, |
1102 false, true); | 1100 false, true); |
1103 scrollbar->SetBounds(scrollbar_size); | 1101 scrollbar->SetBounds(scrollbar_size); |
1104 scrollbar->SetPosition(gfx::PointF(345, 0)); | 1102 scrollbar->SetPosition(gfx::PointF(345, 0)); |
1105 scrollbar->SetScrollElementId(scroll->element_id()); | 1103 scrollbar->SetScrollElementId(scroll->element_id()); |
1106 scrollbar->SetDrawsContent(true); | 1104 scrollbar->SetDrawsContent(true); |
1107 scrollbar->test_properties()->opacity = 1.f; | 1105 scrollbar->test_properties()->opacity = 1.f; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 root->SetBounds(content_size); | 1157 root->SetBounds(content_size); |
1160 root->SetPosition(gfx::PointF()); | 1158 root->SetPosition(gfx::PointF()); |
1161 | 1159 |
1162 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); | 1160 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); |
1163 clip->SetBounds(content_size); | 1161 clip->SetBounds(content_size); |
1164 clip->SetPosition(gfx::PointF()); | 1162 clip->SetPosition(gfx::PointF()); |
1165 | 1163 |
1166 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); | 1164 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); |
1167 scroll->SetBounds(scroll_content_size); | 1165 scroll->SetBounds(scroll_content_size); |
1168 scroll->SetScrollClipLayer(clip->id()); | 1166 scroll->SetScrollClipLayer(clip->id()); |
1169 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 1167 scroll->SetElementId(scroll->id()); |
1170 scroll->SetDrawsContent(true); | 1168 scroll->SetDrawsContent(true); |
1171 | 1169 |
1172 std::unique_ptr<SolidColorScrollbarLayerImpl> drawn_scrollbar = | 1170 std::unique_ptr<SolidColorScrollbarLayerImpl> drawn_scrollbar = |
1173 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, | 1171 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, |
1174 false, true); | 1172 false, true); |
1175 drawn_scrollbar->SetBounds(scrollbar_size); | 1173 drawn_scrollbar->SetBounds(scrollbar_size); |
1176 drawn_scrollbar->SetPosition(gfx::PointF(345, 0)); | 1174 drawn_scrollbar->SetPosition(gfx::PointF(345, 0)); |
1177 drawn_scrollbar->SetScrollElementId(scroll->element_id()); | 1175 drawn_scrollbar->SetScrollElementId(scroll->element_id()); |
1178 drawn_scrollbar->SetDrawsContent(true); | 1176 drawn_scrollbar->SetDrawsContent(true); |
1179 drawn_scrollbar->test_properties()->opacity = 1.f; | 1177 drawn_scrollbar->test_properties()->opacity = 1.f; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { | 1402 TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { |
1405 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200)); | 1403 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200)); |
1406 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 1404 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
1407 | 1405 |
1408 gfx::Size overflow_size(400, 400); | 1406 gfx::Size overflow_size(400, 400); |
1409 ASSERT_EQ(1u, scroll_layer->test_properties()->children.size()); | 1407 ASSERT_EQ(1u, scroll_layer->test_properties()->children.size()); |
1410 LayerImpl* overflow = scroll_layer->test_properties()->children[0]; | 1408 LayerImpl* overflow = scroll_layer->test_properties()->children[0]; |
1411 overflow->SetBounds(overflow_size); | 1409 overflow->SetBounds(overflow_size); |
1412 overflow->SetScrollClipLayer( | 1410 overflow->SetScrollClipLayer( |
1413 scroll_layer->test_properties()->parent->test_properties()->parent->id()); | 1411 scroll_layer->test_properties()->parent->test_properties()->parent->id()); |
1414 overflow->SetElementId(LayerIdToElementIdForTesting(overflow->id())); | 1412 overflow->SetElementId(overflow->id()); |
1415 overflow->layer_tree_impl() | 1413 overflow->layer_tree_impl() |
1416 ->property_trees() | 1414 ->property_trees() |
1417 ->scroll_tree.UpdateScrollOffsetBaseForTesting(overflow->id(), | 1415 ->scroll_tree.UpdateScrollOffsetBaseForTesting(overflow->id(), |
1418 gfx::ScrollOffset()); | 1416 gfx::ScrollOffset()); |
1419 overflow->SetPosition(gfx::PointF()); | 1417 overflow->SetPosition(gfx::PointF()); |
1420 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 1418 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
1421 | 1419 |
1422 DrawFrame(); | 1420 DrawFrame(); |
1423 gfx::Point scroll_position(10, 10); | 1421 gfx::Point scroll_position(10, 10); |
1424 | 1422 |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3367 // Scrolling the viewport should result in a scrollbar animation update. | 3365 // Scrolling the viewport should result in a scrollbar animation update. |
3368 animation_task_ = base::Closure(); | 3366 animation_task_ = base::Closure(); |
3369 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL); | 3367 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL); |
3370 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(10, 10)).get()); | 3368 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(10, 10)).get()); |
3371 host_impl_->ScrollEnd(EndState().get()); | 3369 host_impl_->ScrollEnd(EndState().get()); |
3372 EXPECT_FALSE(animation_task_.Equals(base::Closure())); | 3370 EXPECT_FALSE(animation_task_.Equals(base::Closure())); |
3373 animation_task_ = base::Closure(); | 3371 animation_task_ = base::Closure(); |
3374 | 3372 |
3375 // Check scrollbar registration on a sublayer. | 3373 // Check scrollbar registration on a sublayer. |
3376 child->SetScrollClipLayer(child_clip->id()); | 3374 child->SetScrollClipLayer(child_clip->id()); |
3377 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 3375 child->SetElementId(child->id()); |
3378 ElementId child_scroll_element_id = child->element_id(); | 3376 ElementId child_scroll_element_id = child->element_id(); |
3379 child_clip->test_properties()->AddChild(std::move(child)); | 3377 child_clip->test_properties()->AddChild(std::move(child)); |
3380 root_scroll->test_properties()->AddChild(std::move(child_clip)); | 3378 root_scroll->test_properties()->AddChild(std::move(child_clip)); |
3381 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); | 3379 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); |
3382 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId( | 3380 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId( |
3383 child_scroll_element_id)); | 3381 child_scroll_element_id)); |
3384 vert_2_scrollbar->SetScrollElementId(child_scroll_element_id); | 3382 vert_2_scrollbar->SetScrollElementId(child_scroll_element_id); |
3385 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); | 3383 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); |
3386 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( | 3384 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( |
3387 child_scroll_element_id)); | 3385 child_scroll_element_id)); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3943 int id, | 3941 int id, |
3944 bool tile_missing, | 3942 bool tile_missing, |
3945 bool had_incomplete_tile, | 3943 bool had_incomplete_tile, |
3946 bool animating, | 3944 bool animating, |
3947 ResourceProvider* resource_provider, | 3945 ResourceProvider* resource_provider, |
3948 scoped_refptr<AnimationTimeline> timeline) | 3946 scoped_refptr<AnimationTimeline> timeline) |
3949 : DidDrawCheckLayer(tree_impl, id), | 3947 : DidDrawCheckLayer(tree_impl, id), |
3950 tile_missing_(tile_missing), | 3948 tile_missing_(tile_missing), |
3951 had_incomplete_tile_(had_incomplete_tile) { | 3949 had_incomplete_tile_(had_incomplete_tile) { |
3952 if (animating) { | 3950 if (animating) { |
3953 this->SetElementId(LayerIdToElementIdForTesting(id)); | 3951 this->SetElementId(id); |
3954 AddAnimatedTransformToElementWithPlayer(this->element_id(), timeline, | 3952 AddAnimatedTransformToElementWithPlayer(this->element_id(), timeline, |
3955 10.0, 3, 0); | 3953 10.0, 3, 0); |
3956 } | 3954 } |
3957 } | 3955 } |
3958 | 3956 |
3959 bool tile_missing_; | 3957 bool tile_missing_; |
3960 bool had_incomplete_tile_; | 3958 bool had_incomplete_tile_; |
3961 }; | 3959 }; |
3962 | 3960 |
3963 struct PrepareToDrawSuccessTestCase { | 3961 struct PrepareToDrawSuccessTestCase { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 | 4257 |
4260 std::unique_ptr<LayerImpl> root = LayerImpl::Create(tree_impl, 1); | 4258 std::unique_ptr<LayerImpl> root = LayerImpl::Create(tree_impl, 1); |
4261 std::unique_ptr<LayerImpl> root_clip = LayerImpl::Create(tree_impl, 2); | 4259 std::unique_ptr<LayerImpl> root_clip = LayerImpl::Create(tree_impl, 2); |
4262 std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(tree_impl, 3); | 4260 std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(tree_impl, 3); |
4263 | 4261 |
4264 std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(tree_impl, 4); | 4262 std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(tree_impl, 4); |
4265 std::unique_ptr<LayerImpl> outer_clip = LayerImpl::Create(tree_impl, 5); | 4263 std::unique_ptr<LayerImpl> outer_clip = LayerImpl::Create(tree_impl, 5); |
4266 | 4264 |
4267 root_clip->SetBounds(inner_viewport_size); | 4265 root_clip->SetBounds(inner_viewport_size); |
4268 root->SetScrollClipLayer(root_clip->id()); | 4266 root->SetScrollClipLayer(root_clip->id()); |
4269 root->SetElementId(LayerIdToElementIdForTesting(root->id())); | 4267 root->SetElementId(root->id()); |
4270 root->SetBounds(outer_viewport_size); | 4268 root->SetBounds(outer_viewport_size); |
4271 root->SetPosition(gfx::PointF()); | 4269 root->SetPosition(gfx::PointF()); |
4272 root->SetDrawsContent(false); | 4270 root->SetDrawsContent(false); |
4273 root_clip->test_properties()->force_render_surface = true; | 4271 root_clip->test_properties()->force_render_surface = true; |
4274 root->test_properties()->is_container_for_fixed_position_layers = true; | 4272 root->test_properties()->is_container_for_fixed_position_layers = true; |
4275 outer_clip->SetBounds(outer_viewport_size); | 4273 outer_clip->SetBounds(outer_viewport_size); |
4276 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 4274 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
4277 outer_scroll->SetElementId( | 4275 outer_scroll->SetElementId(outer_scroll->id()); |
4278 LayerIdToElementIdForTesting(outer_scroll->id())); | |
4279 outer_scroll->SetBounds(scroll_layer_size); | 4276 outer_scroll->SetBounds(scroll_layer_size); |
4280 outer_scroll->SetPosition(gfx::PointF()); | 4277 outer_scroll->SetPosition(gfx::PointF()); |
4281 outer_scroll->SetDrawsContent(false); | 4278 outer_scroll->SetDrawsContent(false); |
4282 outer_scroll->test_properties()->is_container_for_fixed_position_layers = | 4279 outer_scroll->test_properties()->is_container_for_fixed_position_layers = |
4283 true; | 4280 true; |
4284 | 4281 |
4285 int inner_viewport_scroll_layer_id = root->id(); | 4282 int inner_viewport_scroll_layer_id = root->id(); |
4286 int outer_viewport_scroll_layer_id = outer_scroll->id(); | 4283 int outer_viewport_scroll_layer_id = outer_scroll->id(); |
4287 int page_scale_layer_id = page_scale->id(); | 4284 int page_scale_layer_id = page_scale->id(); |
4288 | 4285 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 host_impl_->active_tree()->OuterViewportScrollLayer(); | 4616 host_impl_->active_tree()->OuterViewportScrollLayer(); |
4620 int id = outer_viewport_scroll_layer->id(); | 4617 int id = outer_viewport_scroll_layer->id(); |
4621 | 4618 |
4622 std::unique_ptr<LayerImpl> child = | 4619 std::unique_ptr<LayerImpl> child = |
4623 LayerImpl::Create(host_impl_->active_tree(), id + 2); | 4620 LayerImpl::Create(host_impl_->active_tree(), id + 2); |
4624 std::unique_ptr<LayerImpl> child_clip = | 4621 std::unique_ptr<LayerImpl> child_clip = |
4625 LayerImpl::Create(host_impl_->active_tree(), id + 3); | 4622 LayerImpl::Create(host_impl_->active_tree(), id + 3); |
4626 | 4623 |
4627 child_clip->SetBounds(sub_content_layer_size); | 4624 child_clip->SetBounds(sub_content_layer_size); |
4628 child->SetScrollClipLayer(child_clip->id()); | 4625 child->SetScrollClipLayer(child_clip->id()); |
4629 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 4626 child->SetElementId(child->id()); |
4630 child->SetBounds(sub_content_size); | 4627 child->SetBounds(sub_content_size); |
4631 child->SetPosition(gfx::PointF()); | 4628 child->SetPosition(gfx::PointF()); |
4632 child->SetDrawsContent(true); | 4629 child->SetDrawsContent(true); |
4633 child->test_properties()->is_container_for_fixed_position_layers = true; | 4630 child->test_properties()->is_container_for_fixed_position_layers = true; |
4634 | 4631 |
4635 // scroll child to limit | 4632 // scroll child to limit |
4636 SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); | 4633 SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); |
4637 child_clip->test_properties()->AddChild(std::move(child)); | 4634 child_clip->test_properties()->AddChild(std::move(child)); |
4638 outer_viewport_scroll_layer->test_properties()->AddChild( | 4635 outer_viewport_scroll_layer->test_properties()->AddChild( |
4639 std::move(child_clip)); | 4636 std::move(child_clip)); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5168 content_layer->SetDrawsContent(true); | 5165 content_layer->SetDrawsContent(true); |
5169 content_layer->SetPosition(gfx::PointF()); | 5166 content_layer->SetPosition(gfx::PointF()); |
5170 content_layer->SetBounds(contents_size); | 5167 content_layer->SetBounds(contents_size); |
5171 | 5168 |
5172 LayerImpl* scroll_clip_layer = | 5169 LayerImpl* scroll_clip_layer = |
5173 CreateBasicVirtualViewportLayers(surface_size, surface_size); | 5170 CreateBasicVirtualViewportLayers(surface_size, surface_size); |
5174 | 5171 |
5175 std::unique_ptr<LayerImpl> scroll_layer = | 5172 std::unique_ptr<LayerImpl> scroll_layer = |
5176 LayerImpl::Create(host_impl_->active_tree(), 12); | 5173 LayerImpl::Create(host_impl_->active_tree(), 12); |
5177 scroll_layer->SetScrollClipLayer(scroll_clip_layer->id()); | 5174 scroll_layer->SetScrollClipLayer(scroll_clip_layer->id()); |
5178 scroll_layer->SetElementId(LayerIdToElementIdForTesting(scroll_layer->id())); | 5175 scroll_layer->SetElementId(scroll_layer->id()); |
5179 scroll_layer->SetBounds(contents_size); | 5176 scroll_layer->SetBounds(contents_size); |
5180 scroll_layer->SetPosition(gfx::PointF()); | 5177 scroll_layer->SetPosition(gfx::PointF()); |
5181 scroll_layer->test_properties()->AddChild(std::move(content_layer)); | 5178 scroll_layer->test_properties()->AddChild(std::move(content_layer)); |
5182 scroll_clip_layer->test_properties()->AddChild(std::move(scroll_layer)); | 5179 scroll_clip_layer->test_properties()->AddChild(std::move(scroll_layer)); |
5183 | 5180 |
5184 scroll_clip_layer->test_properties()->force_render_surface = true; | 5181 scroll_clip_layer->test_properties()->force_render_surface = true; |
5185 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 5182 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
5186 | 5183 |
5187 host_impl_->SetViewportSize(surface_size); | 5184 host_impl_->SetViewportSize(surface_size); |
5188 DrawFrame(); | 5185 DrawFrame(); |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6800 // passing through the outer viewport still scroll correctly and affect | 6797 // passing through the outer viewport still scroll correctly and affect |
6801 // browser controls. | 6798 // browser controls. |
6802 { | 6799 { |
6803 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 6800 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
6804 clip->SetBounds(viewport_size); | 6801 clip->SetBounds(viewport_size); |
6805 clip->SetPosition(gfx::PointF()); | 6802 clip->SetPosition(gfx::PointF()); |
6806 | 6803 |
6807 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 6804 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
6808 scroll->SetBounds(gfx::Size(400, 400)); | 6805 scroll->SetBounds(gfx::Size(400, 400)); |
6809 scroll->SetScrollClipLayer(clip->id()); | 6806 scroll->SetScrollClipLayer(clip->id()); |
6810 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 6807 scroll->SetElementId(scroll->id()); |
6811 scroll->SetDrawsContent(true); | 6808 scroll->SetDrawsContent(true); |
6812 | 6809 |
6813 scroll_layer = scroll.get(); | 6810 scroll_layer = scroll.get(); |
6814 | 6811 |
6815 clip->test_properties()->AddChild(std::move(scroll)); | 6812 clip->test_properties()->AddChild(std::move(scroll)); |
6816 inner_scroll_layer->test_properties()->AddChild(std::move(clip)); | 6813 inner_scroll_layer->test_properties()->AddChild(std::move(clip)); |
6817 | 6814 |
6818 // Move the outer viewport layer away so that scrolls won't target it. | 6815 // Move the outer viewport layer away so that scrolls won't target it. |
6819 host_impl_->active_tree()->OuterViewportContainerLayer()->SetPosition( | 6816 host_impl_->active_tree()->OuterViewportContainerLayer()->SetPosition( |
6820 gfx::PointF(400, 400)); | 6817 gfx::PointF(400, 400)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6891 // with another scrolling div inside it. Set the outer "div" to be the outer | 6888 // with another scrolling div inside it. Set the outer "div" to be the outer |
6892 // viewport. | 6889 // viewport. |
6893 { | 6890 { |
6894 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 6891 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
6895 clip->SetBounds(content_size); | 6892 clip->SetBounds(content_size); |
6896 clip->SetPosition(gfx::PointF()); | 6893 clip->SetPosition(gfx::PointF()); |
6897 | 6894 |
6898 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 6895 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
6899 scroll->SetBounds(gfx::Size(400, 400)); | 6896 scroll->SetBounds(gfx::Size(400, 400)); |
6900 scroll->SetScrollClipLayer(clip->id()); | 6897 scroll->SetScrollClipLayer(clip->id()); |
6901 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 6898 scroll->SetElementId(scroll->id()); |
6902 scroll->SetDrawsContent(true); | 6899 scroll->SetDrawsContent(true); |
6903 | 6900 |
6904 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 12); | 6901 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 12); |
6905 clip2->SetBounds(gfx::Size(300, 300)); | 6902 clip2->SetBounds(gfx::Size(300, 300)); |
6906 clip2->SetPosition(gfx::PointF()); | 6903 clip2->SetPosition(gfx::PointF()); |
6907 clip2->SetDrawsContent(true); | 6904 clip2->SetDrawsContent(true); |
6908 | 6905 |
6909 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 13); | 6906 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 13); |
6910 scroll2->SetBounds(gfx::Size(500, 500)); | 6907 scroll2->SetBounds(gfx::Size(500, 500)); |
6911 scroll2->SetScrollClipLayer(clip2->id()); | 6908 scroll2->SetScrollClipLayer(clip2->id()); |
6912 scroll2->SetElementId(LayerIdToElementIdForTesting(scroll2->id())); | 6909 scroll2->SetElementId(scroll2->id()); |
6913 scroll2->SetDrawsContent(true); | 6910 scroll2->SetDrawsContent(true); |
6914 | 6911 |
6915 scroll_layer = scroll.get(); | 6912 scroll_layer = scroll.get(); |
6916 child_scroll_layer = scroll2.get(); | 6913 child_scroll_layer = scroll2.get(); |
6917 | 6914 |
6918 clip2->test_properties()->AddChild(std::move(scroll2)); | 6915 clip2->test_properties()->AddChild(std::move(scroll2)); |
6919 scroll->test_properties()->AddChild(std::move(clip2)); | 6916 scroll->test_properties()->AddChild(std::move(clip2)); |
6920 | 6917 |
6921 clip->test_properties()->AddChild(std::move(scroll)); | 6918 clip->test_properties()->AddChild(std::move(scroll)); |
6922 content_layer->test_properties()->AddChild(std::move(clip)); | 6919 content_layer->test_properties()->AddChild(std::move(clip)); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 // set as the outer viewport. Add a sibling scrolling layer that isn't a child | 7021 // set as the outer viewport. Add a sibling scrolling layer that isn't a child |
7025 // of the outer viewport scroll layer. | 7022 // of the outer viewport scroll layer. |
7026 { | 7023 { |
7027 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 7024 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
7028 clip->SetBounds(content_size); | 7025 clip->SetBounds(content_size); |
7029 clip->SetPosition(gfx::PointF(100, 100)); | 7026 clip->SetPosition(gfx::PointF(100, 100)); |
7030 | 7027 |
7031 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 7028 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
7032 scroll->SetBounds(gfx::Size(1200, 1200)); | 7029 scroll->SetBounds(gfx::Size(1200, 1200)); |
7033 scroll->SetScrollClipLayer(clip->id()); | 7030 scroll->SetScrollClipLayer(clip->id()); |
7034 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 7031 scroll->SetElementId(scroll->id()); |
7035 scroll->SetDrawsContent(true); | 7032 scroll->SetDrawsContent(true); |
7036 | 7033 |
7037 outer_scroll_layer = scroll.get(); | 7034 outer_scroll_layer = scroll.get(); |
7038 | 7035 |
7039 clip->test_properties()->AddChild(std::move(scroll)); | 7036 clip->test_properties()->AddChild(std::move(scroll)); |
7040 content_layer->test_properties()->AddChild(std::move(clip)); | 7037 content_layer->test_properties()->AddChild(std::move(clip)); |
7041 | 7038 |
7042 // Create the non-descendant. | 7039 // Create the non-descendant. |
7043 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 14); | 7040 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 14); |
7044 clip2->SetBounds(gfx::Size(600, 600)); | 7041 clip2->SetBounds(gfx::Size(600, 600)); |
7045 clip2->SetPosition(gfx::PointF()); | 7042 clip2->SetPosition(gfx::PointF()); |
7046 | 7043 |
7047 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 15); | 7044 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 15); |
7048 scroll2->SetBounds(gfx::Size(1200, 1200)); | 7045 scroll2->SetBounds(gfx::Size(1200, 1200)); |
7049 scroll2->SetScrollClipLayer(clip2->id()); | 7046 scroll2->SetScrollClipLayer(clip2->id()); |
7050 scroll2->SetElementId(LayerIdToElementIdForTesting(scroll2->id())); | 7047 scroll2->SetElementId(scroll2->id()); |
7051 scroll2->SetDrawsContent(true); | 7048 scroll2->SetDrawsContent(true); |
7052 | 7049 |
7053 sibling_scroll_layer = scroll2.get(); | 7050 sibling_scroll_layer = scroll2.get(); |
7054 | 7051 |
7055 clip2->test_properties()->AddChild(std::move(scroll2)); | 7052 clip2->test_properties()->AddChild(std::move(scroll2)); |
7056 content_layer->test_properties()->AddChild(std::move(clip2)); | 7053 content_layer->test_properties()->AddChild(std::move(clip2)); |
7057 | 7054 |
7058 layer_tree_impl->SetViewportLayersFromIds( | 7055 layer_tree_impl->SetViewportLayersFromIds( |
7059 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), | 7056 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), |
7060 inner_scroll_layer->id(), outer_scroll_layer->id()); | 7057 inner_scroll_layer->id(), outer_scroll_layer->id()); |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8378 3, raster_source); | 8375 3, raster_source); |
8379 LayerImpl* content_layer = scoped_content_layer.get(); | 8376 LayerImpl* content_layer = scoped_content_layer.get(); |
8380 scrolling_layer->test_properties()->AddChild(std::move(scoped_content_layer)); | 8377 scrolling_layer->test_properties()->AddChild(std::move(scoped_content_layer)); |
8381 content_layer->SetBounds(content_layer_bounds); | 8378 content_layer->SetBounds(content_layer_bounds); |
8382 content_layer->SetDrawsContent(true); | 8379 content_layer->SetDrawsContent(true); |
8383 | 8380 |
8384 root->SetBounds(root_size); | 8381 root->SetBounds(root_size); |
8385 | 8382 |
8386 gfx::ScrollOffset scroll_offset(100000, 0); | 8383 gfx::ScrollOffset scroll_offset(100000, 0); |
8387 scrolling_layer->SetScrollClipLayer(root->id()); | 8384 scrolling_layer->SetScrollClipLayer(root->id()); |
8388 scrolling_layer->SetElementId( | 8385 scrolling_layer->SetElementId(scrolling_layer->id()); |
8389 LayerIdToElementIdForTesting(scrolling_layer->id())); | |
8390 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 8386 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
8391 | 8387 |
8392 scrolling_layer->layer_tree_impl() | 8388 scrolling_layer->layer_tree_impl() |
8393 ->property_trees() | 8389 ->property_trees() |
8394 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scrolling_layer->id(), | 8390 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scrolling_layer->id(), |
8395 scroll_offset); | 8391 scroll_offset); |
8396 host_impl_->ActivateSyncTree(); | 8392 host_impl_->ActivateSyncTree(); |
8397 | 8393 |
8398 bool update_lcd_text = false; | 8394 bool update_lcd_text = false; |
8399 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); | 8395 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9831 // set its scroll layer as the outer viewport. This simulates setting a | 9827 // set its scroll layer as the outer viewport. This simulates setting a |
9832 // scrolling element as the root scroller on the page. | 9828 // scrolling element as the root scroller on the page. |
9833 { | 9829 { |
9834 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 9830 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
9835 clip->SetBounds(root_layer_size); | 9831 clip->SetBounds(root_layer_size); |
9836 clip->SetPosition(gfx::PointF()); | 9832 clip->SetPosition(gfx::PointF()); |
9837 | 9833 |
9838 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 9834 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
9839 scroll->SetBounds(scroll_content_size); | 9835 scroll->SetBounds(scroll_content_size); |
9840 scroll->SetScrollClipLayer(clip->id()); | 9836 scroll->SetScrollClipLayer(clip->id()); |
9841 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 9837 scroll->SetElementId(scroll->id()); |
9842 scroll->SetDrawsContent(true); | 9838 scroll->SetDrawsContent(true); |
9843 | 9839 |
9844 scroll_layer = scroll.get(); | 9840 scroll_layer = scroll.get(); |
9845 | 9841 |
9846 clip->test_properties()->AddChild(std::move(scroll)); | 9842 clip->test_properties()->AddChild(std::move(scroll)); |
9847 outer_scroll->test_properties()->AddChild(std::move(clip)); | 9843 outer_scroll->test_properties()->AddChild(std::move(clip)); |
9848 layer_tree_impl->SetViewportLayersFromIds( | 9844 layer_tree_impl->SetViewportLayersFromIds( |
9849 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), | 9845 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), |
9850 inner_scroll->id(), scroll_layer->id()); | 9846 inner_scroll->id(), scroll_layer->id()); |
9851 layer_tree_impl->BuildPropertyTreesForTesting(); | 9847 layer_tree_impl->BuildPropertyTreesForTesting(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9893 gfx::ScrollOffset()); | 9889 gfx::ScrollOffset()); |
9894 | 9890 |
9895 std::unique_ptr<LayerImpl> inner_clip = | 9891 std::unique_ptr<LayerImpl> inner_clip = |
9896 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 9892 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
9897 inner_clip->SetBounds(inner_viewport); | 9893 inner_clip->SetBounds(inner_viewport); |
9898 | 9894 |
9899 std::unique_ptr<LayerImpl> page_scale = | 9895 std::unique_ptr<LayerImpl> page_scale = |
9900 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 9896 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
9901 | 9897 |
9902 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 9898 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
9903 inner_scroll->SetElementId( | 9899 inner_scroll->SetElementId(inner_scroll->id()); |
9904 LayerIdToElementIdForTesting(inner_scroll->id())); | |
9905 inner_scroll->SetBounds(outer_viewport); | 9900 inner_scroll->SetBounds(outer_viewport); |
9906 inner_scroll->SetPosition(gfx::PointF()); | 9901 inner_scroll->SetPosition(gfx::PointF()); |
9907 | 9902 |
9908 std::unique_ptr<LayerImpl> outer_clip = | 9903 std::unique_ptr<LayerImpl> outer_clip = |
9909 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 9904 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
9910 outer_clip->SetBounds(outer_viewport); | 9905 outer_clip->SetBounds(outer_viewport); |
9911 outer_clip->test_properties()->is_container_for_fixed_position_layers = | 9906 outer_clip->test_properties()->is_container_for_fixed_position_layers = |
9912 true; | 9907 true; |
9913 | 9908 |
9914 std::unique_ptr<LayerImpl> outer_scroll = | 9909 std::unique_ptr<LayerImpl> outer_scroll = |
9915 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 9910 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
9916 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 9911 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
9917 outer_scroll->SetElementId( | 9912 outer_scroll->SetElementId(outer_scroll->id()); |
9918 LayerIdToElementIdForTesting(outer_scroll->id())); | |
9919 outer_scroll->layer_tree_impl() | 9913 outer_scroll->layer_tree_impl() |
9920 ->property_trees() | 9914 ->property_trees() |
9921 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | 9915 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), |
9922 gfx::ScrollOffset()); | 9916 gfx::ScrollOffset()); |
9923 outer_scroll->SetBounds(content_size); | 9917 outer_scroll->SetBounds(content_size); |
9924 outer_scroll->SetPosition(gfx::PointF()); | 9918 outer_scroll->SetPosition(gfx::PointF()); |
9925 | 9919 |
9926 std::unique_ptr<LayerImpl> contents = LayerImpl::Create(layer_tree_impl, 8); | 9920 std::unique_ptr<LayerImpl> contents = LayerImpl::Create(layer_tree_impl, 8); |
9927 contents->SetDrawsContent(true); | 9921 contents->SetDrawsContent(true); |
9928 contents->SetBounds(content_size); | 9922 contents->SetBounds(content_size); |
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12171 scrollbar_2_id, VERTICAL, 15, 0, | 12165 scrollbar_2_id, VERTICAL, 15, 0, |
12172 true, true); | 12166 true, true); |
12173 std::unique_ptr<LayerImpl> child_clip = | 12167 std::unique_ptr<LayerImpl> child_clip = |
12174 LayerImpl::Create(host_impl_->active_tree(), child_clip_id); | 12168 LayerImpl::Create(host_impl_->active_tree(), child_clip_id); |
12175 std::unique_ptr<LayerImpl> child = | 12169 std::unique_ptr<LayerImpl> child = |
12176 LayerImpl::Create(host_impl_->active_tree(), child_scroll_id); | 12170 LayerImpl::Create(host_impl_->active_tree(), child_scroll_id); |
12177 child->SetPosition(gfx::PointF(50, 50)); | 12171 child->SetPosition(gfx::PointF(50, 50)); |
12178 child->SetBounds(child_layer_size); | 12172 child->SetBounds(child_layer_size); |
12179 child->SetDrawsContent(true); | 12173 child->SetDrawsContent(true); |
12180 child->SetScrollClipLayer(child_clip_id); | 12174 child->SetScrollClipLayer(child_clip_id); |
12181 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 12175 child->SetElementId(child->id()); |
12182 ElementId child_element_id = child->element_id(); | 12176 ElementId child_element_id = child->element_id(); |
12183 | 12177 |
12184 if (main_thread_scrolling) { | 12178 if (main_thread_scrolling) { |
12185 child->set_main_thread_scrolling_reasons( | 12179 child->set_main_thread_scrolling_reasons( |
12186 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); | 12180 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); |
12187 } | 12181 } |
12188 | 12182 |
12189 scrollbar_2->SetScrollElementId(child_element_id); | 12183 scrollbar_2->SetScrollElementId(child_element_id); |
12190 scrollbar_2->SetDrawsContent(true); | 12184 scrollbar_2->SetDrawsContent(true); |
12191 scrollbar_2->SetBounds(scrollbar_size_2); | 12185 scrollbar_2->SetBounds(scrollbar_size_2); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12365 else | 12359 else |
12366 EXPECT_FALSE(tile->HasRasterTask()); | 12360 EXPECT_FALSE(tile->HasRasterTask()); |
12367 } | 12361 } |
12368 Region expected_invalidation( | 12362 Region expected_invalidation( |
12369 raster_source->GetRectForImage(checkerable_image->uniqueID())); | 12363 raster_source->GetRectForImage(checkerable_image->uniqueID())); |
12370 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); | 12364 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); |
12371 } | 12365 } |
12372 | 12366 |
12373 } // namespace | 12367 } // namespace |
12374 } // namespace cc | 12368 } // namespace cc |
OLD | NEW |