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 ElementId element_id; |
343 LayerIdToElementIdForTesting(inner_scroll->id())); | 343 element_id.id = inner_scroll->id(); |
| 344 inner_scroll->SetElementId(element_id); |
344 inner_scroll->SetBounds(content_size); | 345 inner_scroll->SetBounds(content_size); |
345 inner_scroll->SetPosition(gfx::PointF()); | 346 inner_scroll->SetPosition(gfx::PointF()); |
346 | 347 |
347 std::unique_ptr<LayerImpl> outer_clip = | 348 std::unique_ptr<LayerImpl> outer_clip = |
348 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 349 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
349 outer_clip->SetBounds(content_size); | 350 outer_clip->SetBounds(content_size); |
350 outer_clip->test_properties()->is_container_for_fixed_position_layers = | 351 outer_clip->test_properties()->is_container_for_fixed_position_layers = |
351 true; | 352 true; |
352 | 353 |
353 std::unique_ptr<LayerImpl> outer_scroll = | 354 std::unique_ptr<LayerImpl> outer_scroll = |
354 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 355 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
355 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 356 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
356 outer_scroll->SetElementId( | 357 element_id.id = outer_scroll->id(); |
357 LayerIdToElementIdForTesting(outer_scroll->id())); | 358 outer_scroll->SetElementId(element_id); |
358 outer_scroll->layer_tree_impl() | 359 outer_scroll->layer_tree_impl() |
359 ->property_trees() | 360 ->property_trees() |
360 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | 361 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), |
361 gfx::ScrollOffset()); | 362 gfx::ScrollOffset()); |
362 outer_scroll->SetBounds(content_size); | 363 outer_scroll->SetBounds(content_size); |
363 outer_scroll->SetPosition(gfx::PointF()); | 364 outer_scroll->SetPosition(gfx::PointF()); |
364 | 365 |
365 std::unique_ptr<LayerImpl> contents = | 366 std::unique_ptr<LayerImpl> contents = |
366 LayerImpl::Create(layer_tree_impl, kContentLayerId); | 367 LayerImpl::Create(layer_tree_impl, kContentLayerId); |
367 contents->SetDrawsContent(true); | 368 contents->SetDrawsContent(true); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 428 } |
428 | 429 |
429 std::unique_ptr<LayerImpl> CreateScrollableLayer(int id, | 430 std::unique_ptr<LayerImpl> CreateScrollableLayer(int id, |
430 const gfx::Size& size, | 431 const gfx::Size& size, |
431 LayerImpl* clip_layer) { | 432 LayerImpl* clip_layer) { |
432 DCHECK(clip_layer); | 433 DCHECK(clip_layer); |
433 DCHECK(id != clip_layer->id()); | 434 DCHECK(id != clip_layer->id()); |
434 std::unique_ptr<LayerImpl> layer = | 435 std::unique_ptr<LayerImpl> layer = |
435 LayerImpl::Create(host_impl_->active_tree(), id); | 436 LayerImpl::Create(host_impl_->active_tree(), id); |
436 layer->SetScrollClipLayer(clip_layer->id()); | 437 layer->SetScrollClipLayer(clip_layer->id()); |
437 layer->SetElementId(LayerIdToElementIdForTesting(layer->id())); | 438 ElementId element_id; |
| 439 element_id.id = layer->id(); |
| 440 layer->SetElementId(element_id); |
438 layer->SetDrawsContent(true); | 441 layer->SetDrawsContent(true); |
439 layer->SetBounds(size); | 442 layer->SetBounds(size); |
440 clip_layer->SetBounds(gfx::Size(size.width() / 2, size.height() / 2)); | 443 clip_layer->SetBounds(gfx::Size(size.width() / 2, size.height() / 2)); |
441 return layer; | 444 return layer; |
442 } | 445 } |
443 | 446 |
444 std::unique_ptr<ScrollState> BeginState(const gfx::Point& point) { | 447 std::unique_ptr<ScrollState> BeginState(const gfx::Point& point) { |
445 ScrollStateData scroll_state_data; | 448 ScrollStateData scroll_state_data; |
446 scroll_state_data.is_beginning = true; | 449 scroll_state_data.is_beginning = true; |
447 scroll_state_data.position_x = point.x(); | 450 scroll_state_data.position_x = point.x(); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 | 724 |
722 auto root_clip_owned = LayerImpl::Create(host_impl_->active_tree(), 2); | 725 auto root_clip_owned = LayerImpl::Create(host_impl_->active_tree(), 2); |
723 auto* root_clip = root_clip_owned.get(); | 726 auto* root_clip = root_clip_owned.get(); |
724 auto root_owned = LayerImpl::Create(host_impl_->active_tree(), 1); | 727 auto root_owned = LayerImpl::Create(host_impl_->active_tree(), 1); |
725 auto* root = root_owned.get(); | 728 auto* root = root_owned.get(); |
726 | 729 |
727 root_clip->SetBounds(gfx::Size(10, 10)); | 730 root_clip->SetBounds(gfx::Size(10, 10)); |
728 root_clip->test_properties()->AddChild(std::move(root_owned)); | 731 root_clip->test_properties()->AddChild(std::move(root_owned)); |
729 root->SetBounds(gfx::Size(110, 110)); | 732 root->SetBounds(gfx::Size(110, 110)); |
730 root->SetScrollClipLayer(root_clip->id()); | 733 root->SetScrollClipLayer(root_clip->id()); |
731 root->SetElementId(LayerIdToElementIdForTesting(root->id())); | 734 ElementId element_id; |
| 735 element_id.id = root->id(); |
| 736 root->SetElementId(element_id); |
732 root->layer_tree_impl() | 737 root->layer_tree_impl() |
733 ->property_trees() | 738 ->property_trees() |
734 ->scroll_tree.UpdateScrollOffsetBaseForTesting(root->id(), scroll_offset); | 739 ->scroll_tree.UpdateScrollOffsetBaseForTesting(root->id(), scroll_offset); |
735 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_clip_owned)); | 740 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root_clip_owned)); |
736 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 741 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
737 | 742 |
738 std::unique_ptr<ScrollAndScaleSet> scroll_info; | 743 std::unique_ptr<ScrollAndScaleSet> scroll_info; |
739 | 744 |
740 root->ScrollBy(scroll_delta); | 745 root->ScrollBy(scroll_delta); |
741 scroll_info = host_impl_->ProcessScrollDeltas(); | 746 scroll_info = host_impl_->ProcessScrollDeltas(); |
(...skipping 22 matching lines...) Expand all Loading... |
764 host_impl_->active_tree()->OuterViewportScrollLayer(); | 769 host_impl_->active_tree()->OuterViewportScrollLayer(); |
765 int id = outer_viewport_scroll_layer->id(); | 770 int id = outer_viewport_scroll_layer->id(); |
766 std::unique_ptr<LayerImpl> child = | 771 std::unique_ptr<LayerImpl> child = |
767 LayerImpl::Create(host_impl_->active_tree(), id + 2); | 772 LayerImpl::Create(host_impl_->active_tree(), id + 2); |
768 std::unique_ptr<LayerImpl> child_clip = | 773 std::unique_ptr<LayerImpl> child_clip = |
769 LayerImpl::Create(host_impl_->active_tree(), id + 3); | 774 LayerImpl::Create(host_impl_->active_tree(), id + 3); |
770 | 775 |
771 child_clip->SetBounds(gfx::Size(100, 100)); | 776 child_clip->SetBounds(gfx::Size(100, 100)); |
772 | 777 |
773 child->SetScrollClipLayer(child_clip->id()); | 778 child->SetScrollClipLayer(child_clip->id()); |
774 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 779 ElementId element_id; |
| 780 element_id.id = child->id(); |
| 781 child->SetElementId(element_id); |
775 child->SetBounds(gfx::Size(100, 400)); | 782 child->SetBounds(gfx::Size(100, 400)); |
776 child->SetPosition(gfx::PointF()); | 783 child->SetPosition(gfx::PointF()); |
777 child->SetDrawsContent(true); | 784 child->SetDrawsContent(true); |
778 | 785 |
779 child_clip->test_properties()->AddChild(std::move(child)); | 786 child_clip->test_properties()->AddChild(std::move(child)); |
780 outer_viewport_scroll_layer->test_properties()->AddChild( | 787 outer_viewport_scroll_layer->test_properties()->AddChild( |
781 std::move(child_clip)); | 788 std::move(child_clip)); |
782 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 789 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
783 | 790 |
784 base::HistogramTester histogram_tester; | 791 base::HistogramTester histogram_tester; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 root->SetBounds(content_size); | 1094 root->SetBounds(content_size); |
1088 root->SetPosition(gfx::PointF()); | 1095 root->SetPosition(gfx::PointF()); |
1089 | 1096 |
1090 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); | 1097 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); |
1091 clip->SetBounds(content_size); | 1098 clip->SetBounds(content_size); |
1092 clip->SetPosition(gfx::PointF()); | 1099 clip->SetPosition(gfx::PointF()); |
1093 | 1100 |
1094 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); | 1101 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); |
1095 scroll->SetBounds(scroll_content_size); | 1102 scroll->SetBounds(scroll_content_size); |
1096 scroll->SetScrollClipLayer(clip->id()); | 1103 scroll->SetScrollClipLayer(clip->id()); |
1097 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 1104 ElementId element_id; |
| 1105 element_id.id = scroll->id(); |
| 1106 scroll->SetElementId(element_id); |
1098 scroll->SetDrawsContent(true); | 1107 scroll->SetDrawsContent(true); |
1099 | 1108 |
1100 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = | 1109 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = |
1101 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, | 1110 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, |
1102 false, true); | 1111 false, true); |
1103 scrollbar->SetBounds(scrollbar_size); | 1112 scrollbar->SetBounds(scrollbar_size); |
1104 scrollbar->SetPosition(gfx::PointF(345, 0)); | 1113 scrollbar->SetPosition(gfx::PointF(345, 0)); |
1105 scrollbar->SetScrollElementId(scroll->element_id()); | 1114 scrollbar->SetScrollElementId(scroll->element_id()); |
1106 scrollbar->SetDrawsContent(true); | 1115 scrollbar->SetDrawsContent(true); |
1107 scrollbar->test_properties()->opacity = 1.f; | 1116 scrollbar->test_properties()->opacity = 1.f; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 root->SetBounds(content_size); | 1168 root->SetBounds(content_size); |
1160 root->SetPosition(gfx::PointF()); | 1169 root->SetPosition(gfx::PointF()); |
1161 | 1170 |
1162 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); | 1171 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); |
1163 clip->SetBounds(content_size); | 1172 clip->SetBounds(content_size); |
1164 clip->SetPosition(gfx::PointF()); | 1173 clip->SetPosition(gfx::PointF()); |
1165 | 1174 |
1166 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); | 1175 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); |
1167 scroll->SetBounds(scroll_content_size); | 1176 scroll->SetBounds(scroll_content_size); |
1168 scroll->SetScrollClipLayer(clip->id()); | 1177 scroll->SetScrollClipLayer(clip->id()); |
1169 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 1178 ElementId element_id; |
| 1179 element_id.id = scroll->id(); |
| 1180 scroll->SetElementId(element_id); |
1170 scroll->SetDrawsContent(true); | 1181 scroll->SetDrawsContent(true); |
1171 | 1182 |
1172 std::unique_ptr<SolidColorScrollbarLayerImpl> drawn_scrollbar = | 1183 std::unique_ptr<SolidColorScrollbarLayerImpl> drawn_scrollbar = |
1173 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, | 1184 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, |
1174 false, true); | 1185 false, true); |
1175 drawn_scrollbar->SetBounds(scrollbar_size); | 1186 drawn_scrollbar->SetBounds(scrollbar_size); |
1176 drawn_scrollbar->SetPosition(gfx::PointF(345, 0)); | 1187 drawn_scrollbar->SetPosition(gfx::PointF(345, 0)); |
1177 drawn_scrollbar->SetScrollElementId(scroll->element_id()); | 1188 drawn_scrollbar->SetScrollElementId(scroll->element_id()); |
1178 drawn_scrollbar->SetDrawsContent(true); | 1189 drawn_scrollbar->SetDrawsContent(true); |
1179 drawn_scrollbar->test_properties()->opacity = 1.f; | 1190 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) { | 1415 TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { |
1405 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200)); | 1416 LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200)); |
1406 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 1417 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
1407 | 1418 |
1408 gfx::Size overflow_size(400, 400); | 1419 gfx::Size overflow_size(400, 400); |
1409 ASSERT_EQ(1u, scroll_layer->test_properties()->children.size()); | 1420 ASSERT_EQ(1u, scroll_layer->test_properties()->children.size()); |
1410 LayerImpl* overflow = scroll_layer->test_properties()->children[0]; | 1421 LayerImpl* overflow = scroll_layer->test_properties()->children[0]; |
1411 overflow->SetBounds(overflow_size); | 1422 overflow->SetBounds(overflow_size); |
1412 overflow->SetScrollClipLayer( | 1423 overflow->SetScrollClipLayer( |
1413 scroll_layer->test_properties()->parent->test_properties()->parent->id()); | 1424 scroll_layer->test_properties()->parent->test_properties()->parent->id()); |
1414 overflow->SetElementId(LayerIdToElementIdForTesting(overflow->id())); | 1425 ElementId element_id; |
| 1426 element_id.id = overflow->id(); |
| 1427 overflow->SetElementId(element_id); |
1415 overflow->layer_tree_impl() | 1428 overflow->layer_tree_impl() |
1416 ->property_trees() | 1429 ->property_trees() |
1417 ->scroll_tree.UpdateScrollOffsetBaseForTesting(overflow->id(), | 1430 ->scroll_tree.UpdateScrollOffsetBaseForTesting(overflow->id(), |
1418 gfx::ScrollOffset()); | 1431 gfx::ScrollOffset()); |
1419 overflow->SetPosition(gfx::PointF()); | 1432 overflow->SetPosition(gfx::PointF()); |
1420 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 1433 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
1421 | 1434 |
1422 DrawFrame(); | 1435 DrawFrame(); |
1423 gfx::Point scroll_position(10, 10); | 1436 gfx::Point scroll_position(10, 10); |
1424 | 1437 |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3367 // Scrolling the viewport should result in a scrollbar animation update. | 3380 // Scrolling the viewport should result in a scrollbar animation update. |
3368 animation_task_ = base::Closure(); | 3381 animation_task_ = base::Closure(); |
3369 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL); | 3382 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL); |
3370 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(10, 10)).get()); | 3383 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(10, 10)).get()); |
3371 host_impl_->ScrollEnd(EndState().get()); | 3384 host_impl_->ScrollEnd(EndState().get()); |
3372 EXPECT_FALSE(animation_task_.Equals(base::Closure())); | 3385 EXPECT_FALSE(animation_task_.Equals(base::Closure())); |
3373 animation_task_ = base::Closure(); | 3386 animation_task_ = base::Closure(); |
3374 | 3387 |
3375 // Check scrollbar registration on a sublayer. | 3388 // Check scrollbar registration on a sublayer. |
3376 child->SetScrollClipLayer(child_clip->id()); | 3389 child->SetScrollClipLayer(child_clip->id()); |
3377 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 3390 ElementId element_id; |
| 3391 element_id.id = child->id(); |
| 3392 child->SetElementId(element_id); |
3378 ElementId child_scroll_element_id = child->element_id(); | 3393 ElementId child_scroll_element_id = child->element_id(); |
3379 child_clip->test_properties()->AddChild(std::move(child)); | 3394 child_clip->test_properties()->AddChild(std::move(child)); |
3380 root_scroll->test_properties()->AddChild(std::move(child_clip)); | 3395 root_scroll->test_properties()->AddChild(std::move(child_clip)); |
3381 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); | 3396 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); |
3382 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId( | 3397 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId( |
3383 child_scroll_element_id)); | 3398 child_scroll_element_id)); |
3384 vert_2_scrollbar->SetScrollElementId(child_scroll_element_id); | 3399 vert_2_scrollbar->SetScrollElementId(child_scroll_element_id); |
3385 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); | 3400 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); |
3386 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( | 3401 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( |
3387 child_scroll_element_id)); | 3402 child_scroll_element_id)); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3943 int id, | 3958 int id, |
3944 bool tile_missing, | 3959 bool tile_missing, |
3945 bool had_incomplete_tile, | 3960 bool had_incomplete_tile, |
3946 bool animating, | 3961 bool animating, |
3947 ResourceProvider* resource_provider, | 3962 ResourceProvider* resource_provider, |
3948 scoped_refptr<AnimationTimeline> timeline) | 3963 scoped_refptr<AnimationTimeline> timeline) |
3949 : DidDrawCheckLayer(tree_impl, id), | 3964 : DidDrawCheckLayer(tree_impl, id), |
3950 tile_missing_(tile_missing), | 3965 tile_missing_(tile_missing), |
3951 had_incomplete_tile_(had_incomplete_tile) { | 3966 had_incomplete_tile_(had_incomplete_tile) { |
3952 if (animating) { | 3967 if (animating) { |
3953 this->SetElementId(LayerIdToElementIdForTesting(id)); | 3968 ElementId element_id; |
| 3969 element_id.id = id; |
| 3970 this->SetElementId(element_id); |
3954 AddAnimatedTransformToElementWithPlayer(this->element_id(), timeline, | 3971 AddAnimatedTransformToElementWithPlayer(this->element_id(), timeline, |
3955 10.0, 3, 0); | 3972 10.0, 3, 0); |
3956 } | 3973 } |
3957 } | 3974 } |
3958 | 3975 |
3959 bool tile_missing_; | 3976 bool tile_missing_; |
3960 bool had_incomplete_tile_; | 3977 bool had_incomplete_tile_; |
3961 }; | 3978 }; |
3962 | 3979 |
3963 struct PrepareToDrawSuccessTestCase { | 3980 struct PrepareToDrawSuccessTestCase { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 | 4276 |
4260 std::unique_ptr<LayerImpl> root = LayerImpl::Create(tree_impl, 1); | 4277 std::unique_ptr<LayerImpl> root = LayerImpl::Create(tree_impl, 1); |
4261 std::unique_ptr<LayerImpl> root_clip = LayerImpl::Create(tree_impl, 2); | 4278 std::unique_ptr<LayerImpl> root_clip = LayerImpl::Create(tree_impl, 2); |
4262 std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(tree_impl, 3); | 4279 std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(tree_impl, 3); |
4263 | 4280 |
4264 std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(tree_impl, 4); | 4281 std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(tree_impl, 4); |
4265 std::unique_ptr<LayerImpl> outer_clip = LayerImpl::Create(tree_impl, 5); | 4282 std::unique_ptr<LayerImpl> outer_clip = LayerImpl::Create(tree_impl, 5); |
4266 | 4283 |
4267 root_clip->SetBounds(inner_viewport_size); | 4284 root_clip->SetBounds(inner_viewport_size); |
4268 root->SetScrollClipLayer(root_clip->id()); | 4285 root->SetScrollClipLayer(root_clip->id()); |
4269 root->SetElementId(LayerIdToElementIdForTesting(root->id())); | 4286 ElementId element_id; |
| 4287 element_id.id = root->id(); |
| 4288 root->SetElementId(element_id); |
4270 root->SetBounds(outer_viewport_size); | 4289 root->SetBounds(outer_viewport_size); |
4271 root->SetPosition(gfx::PointF()); | 4290 root->SetPosition(gfx::PointF()); |
4272 root->SetDrawsContent(false); | 4291 root->SetDrawsContent(false); |
4273 root_clip->test_properties()->force_render_surface = true; | 4292 root_clip->test_properties()->force_render_surface = true; |
4274 root->test_properties()->is_container_for_fixed_position_layers = true; | 4293 root->test_properties()->is_container_for_fixed_position_layers = true; |
4275 outer_clip->SetBounds(outer_viewport_size); | 4294 outer_clip->SetBounds(outer_viewport_size); |
4276 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 4295 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
4277 outer_scroll->SetElementId( | 4296 element_id.id = outer_scroll->id(); |
4278 LayerIdToElementIdForTesting(outer_scroll->id())); | 4297 outer_scroll->SetElementId(element_id); |
4279 outer_scroll->SetBounds(scroll_layer_size); | 4298 outer_scroll->SetBounds(scroll_layer_size); |
4280 outer_scroll->SetPosition(gfx::PointF()); | 4299 outer_scroll->SetPosition(gfx::PointF()); |
4281 outer_scroll->SetDrawsContent(false); | 4300 outer_scroll->SetDrawsContent(false); |
4282 outer_scroll->test_properties()->is_container_for_fixed_position_layers = | 4301 outer_scroll->test_properties()->is_container_for_fixed_position_layers = |
4283 true; | 4302 true; |
4284 | 4303 |
4285 int inner_viewport_scroll_layer_id = root->id(); | 4304 int inner_viewport_scroll_layer_id = root->id(); |
4286 int outer_viewport_scroll_layer_id = outer_scroll->id(); | 4305 int outer_viewport_scroll_layer_id = outer_scroll->id(); |
4287 int page_scale_layer_id = page_scale->id(); | 4306 int page_scale_layer_id = page_scale->id(); |
4288 | 4307 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 host_impl_->active_tree()->OuterViewportScrollLayer(); | 4638 host_impl_->active_tree()->OuterViewportScrollLayer(); |
4620 int id = outer_viewport_scroll_layer->id(); | 4639 int id = outer_viewport_scroll_layer->id(); |
4621 | 4640 |
4622 std::unique_ptr<LayerImpl> child = | 4641 std::unique_ptr<LayerImpl> child = |
4623 LayerImpl::Create(host_impl_->active_tree(), id + 2); | 4642 LayerImpl::Create(host_impl_->active_tree(), id + 2); |
4624 std::unique_ptr<LayerImpl> child_clip = | 4643 std::unique_ptr<LayerImpl> child_clip = |
4625 LayerImpl::Create(host_impl_->active_tree(), id + 3); | 4644 LayerImpl::Create(host_impl_->active_tree(), id + 3); |
4626 | 4645 |
4627 child_clip->SetBounds(sub_content_layer_size); | 4646 child_clip->SetBounds(sub_content_layer_size); |
4628 child->SetScrollClipLayer(child_clip->id()); | 4647 child->SetScrollClipLayer(child_clip->id()); |
4629 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 4648 ElementId element_id; |
| 4649 element_id.id = child->id(); |
| 4650 child->SetElementId(element_id); |
4630 child->SetBounds(sub_content_size); | 4651 child->SetBounds(sub_content_size); |
4631 child->SetPosition(gfx::PointF()); | 4652 child->SetPosition(gfx::PointF()); |
4632 child->SetDrawsContent(true); | 4653 child->SetDrawsContent(true); |
4633 child->test_properties()->is_container_for_fixed_position_layers = true; | 4654 child->test_properties()->is_container_for_fixed_position_layers = true; |
4634 | 4655 |
4635 // scroll child to limit | 4656 // scroll child to limit |
4636 SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); | 4657 SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); |
4637 child_clip->test_properties()->AddChild(std::move(child)); | 4658 child_clip->test_properties()->AddChild(std::move(child)); |
4638 outer_viewport_scroll_layer->test_properties()->AddChild( | 4659 outer_viewport_scroll_layer->test_properties()->AddChild( |
4639 std::move(child_clip)); | 4660 std::move(child_clip)); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5168 content_layer->SetDrawsContent(true); | 5189 content_layer->SetDrawsContent(true); |
5169 content_layer->SetPosition(gfx::PointF()); | 5190 content_layer->SetPosition(gfx::PointF()); |
5170 content_layer->SetBounds(contents_size); | 5191 content_layer->SetBounds(contents_size); |
5171 | 5192 |
5172 LayerImpl* scroll_clip_layer = | 5193 LayerImpl* scroll_clip_layer = |
5173 CreateBasicVirtualViewportLayers(surface_size, surface_size); | 5194 CreateBasicVirtualViewportLayers(surface_size, surface_size); |
5174 | 5195 |
5175 std::unique_ptr<LayerImpl> scroll_layer = | 5196 std::unique_ptr<LayerImpl> scroll_layer = |
5176 LayerImpl::Create(host_impl_->active_tree(), 12); | 5197 LayerImpl::Create(host_impl_->active_tree(), 12); |
5177 scroll_layer->SetScrollClipLayer(scroll_clip_layer->id()); | 5198 scroll_layer->SetScrollClipLayer(scroll_clip_layer->id()); |
5178 scroll_layer->SetElementId(LayerIdToElementIdForTesting(scroll_layer->id())); | 5199 ElementId element_id; |
| 5200 element_id.id = scroll_layer->id(); |
| 5201 scroll_layer->SetElementId(element_id); |
5179 scroll_layer->SetBounds(contents_size); | 5202 scroll_layer->SetBounds(contents_size); |
5180 scroll_layer->SetPosition(gfx::PointF()); | 5203 scroll_layer->SetPosition(gfx::PointF()); |
5181 scroll_layer->test_properties()->AddChild(std::move(content_layer)); | 5204 scroll_layer->test_properties()->AddChild(std::move(content_layer)); |
5182 scroll_clip_layer->test_properties()->AddChild(std::move(scroll_layer)); | 5205 scroll_clip_layer->test_properties()->AddChild(std::move(scroll_layer)); |
5183 | 5206 |
5184 scroll_clip_layer->test_properties()->force_render_surface = true; | 5207 scroll_clip_layer->test_properties()->force_render_surface = true; |
5185 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 5208 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
5186 | 5209 |
5187 host_impl_->SetViewportSize(surface_size); | 5210 host_impl_->SetViewportSize(surface_size); |
5188 DrawFrame(); | 5211 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 | 6823 // passing through the outer viewport still scroll correctly and affect |
6801 // browser controls. | 6824 // browser controls. |
6802 { | 6825 { |
6803 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 6826 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
6804 clip->SetBounds(viewport_size); | 6827 clip->SetBounds(viewport_size); |
6805 clip->SetPosition(gfx::PointF()); | 6828 clip->SetPosition(gfx::PointF()); |
6806 | 6829 |
6807 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 6830 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
6808 scroll->SetBounds(gfx::Size(400, 400)); | 6831 scroll->SetBounds(gfx::Size(400, 400)); |
6809 scroll->SetScrollClipLayer(clip->id()); | 6832 scroll->SetScrollClipLayer(clip->id()); |
6810 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 6833 ElementId element_id; |
| 6834 element_id.id = scroll->id(); |
| 6835 scroll->SetElementId(element_id); |
6811 scroll->SetDrawsContent(true); | 6836 scroll->SetDrawsContent(true); |
6812 | 6837 |
6813 scroll_layer = scroll.get(); | 6838 scroll_layer = scroll.get(); |
6814 | 6839 |
6815 clip->test_properties()->AddChild(std::move(scroll)); | 6840 clip->test_properties()->AddChild(std::move(scroll)); |
6816 inner_scroll_layer->test_properties()->AddChild(std::move(clip)); | 6841 inner_scroll_layer->test_properties()->AddChild(std::move(clip)); |
6817 | 6842 |
6818 // Move the outer viewport layer away so that scrolls won't target it. | 6843 // Move the outer viewport layer away so that scrolls won't target it. |
6819 host_impl_->active_tree()->OuterViewportContainerLayer()->SetPosition( | 6844 host_impl_->active_tree()->OuterViewportContainerLayer()->SetPosition( |
6820 gfx::PointF(400, 400)); | 6845 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 | 6916 // with another scrolling div inside it. Set the outer "div" to be the outer |
6892 // viewport. | 6917 // viewport. |
6893 { | 6918 { |
6894 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 6919 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
6895 clip->SetBounds(content_size); | 6920 clip->SetBounds(content_size); |
6896 clip->SetPosition(gfx::PointF()); | 6921 clip->SetPosition(gfx::PointF()); |
6897 | 6922 |
6898 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 6923 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
6899 scroll->SetBounds(gfx::Size(400, 400)); | 6924 scroll->SetBounds(gfx::Size(400, 400)); |
6900 scroll->SetScrollClipLayer(clip->id()); | 6925 scroll->SetScrollClipLayer(clip->id()); |
6901 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 6926 ElementId element_id; |
| 6927 element_id.id = scroll->id(); |
| 6928 scroll->SetElementId(element_id); |
6902 scroll->SetDrawsContent(true); | 6929 scroll->SetDrawsContent(true); |
6903 | 6930 |
6904 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 12); | 6931 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 12); |
6905 clip2->SetBounds(gfx::Size(300, 300)); | 6932 clip2->SetBounds(gfx::Size(300, 300)); |
6906 clip2->SetPosition(gfx::PointF()); | 6933 clip2->SetPosition(gfx::PointF()); |
6907 clip2->SetDrawsContent(true); | 6934 clip2->SetDrawsContent(true); |
6908 | 6935 |
6909 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 13); | 6936 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 13); |
6910 scroll2->SetBounds(gfx::Size(500, 500)); | 6937 scroll2->SetBounds(gfx::Size(500, 500)); |
6911 scroll2->SetScrollClipLayer(clip2->id()); | 6938 scroll2->SetScrollClipLayer(clip2->id()); |
6912 scroll2->SetElementId(LayerIdToElementIdForTesting(scroll2->id())); | 6939 element_id.id = scroll2->id(); |
| 6940 scroll2->SetElementId(element_id); |
6913 scroll2->SetDrawsContent(true); | 6941 scroll2->SetDrawsContent(true); |
6914 | 6942 |
6915 scroll_layer = scroll.get(); | 6943 scroll_layer = scroll.get(); |
6916 child_scroll_layer = scroll2.get(); | 6944 child_scroll_layer = scroll2.get(); |
6917 | 6945 |
6918 clip2->test_properties()->AddChild(std::move(scroll2)); | 6946 clip2->test_properties()->AddChild(std::move(scroll2)); |
6919 scroll->test_properties()->AddChild(std::move(clip2)); | 6947 scroll->test_properties()->AddChild(std::move(clip2)); |
6920 | 6948 |
6921 clip->test_properties()->AddChild(std::move(scroll)); | 6949 clip->test_properties()->AddChild(std::move(scroll)); |
6922 content_layer->test_properties()->AddChild(std::move(clip)); | 6950 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 | 7052 // set as the outer viewport. Add a sibling scrolling layer that isn't a child |
7025 // of the outer viewport scroll layer. | 7053 // of the outer viewport scroll layer. |
7026 { | 7054 { |
7027 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 7055 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
7028 clip->SetBounds(content_size); | 7056 clip->SetBounds(content_size); |
7029 clip->SetPosition(gfx::PointF(100, 100)); | 7057 clip->SetPosition(gfx::PointF(100, 100)); |
7030 | 7058 |
7031 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 7059 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
7032 scroll->SetBounds(gfx::Size(1200, 1200)); | 7060 scroll->SetBounds(gfx::Size(1200, 1200)); |
7033 scroll->SetScrollClipLayer(clip->id()); | 7061 scroll->SetScrollClipLayer(clip->id()); |
7034 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 7062 ElementId element_id; |
| 7063 element_id.id = scroll->id(); |
| 7064 scroll->SetElementId(element_id); |
7035 scroll->SetDrawsContent(true); | 7065 scroll->SetDrawsContent(true); |
7036 | 7066 |
7037 outer_scroll_layer = scroll.get(); | 7067 outer_scroll_layer = scroll.get(); |
7038 | 7068 |
7039 clip->test_properties()->AddChild(std::move(scroll)); | 7069 clip->test_properties()->AddChild(std::move(scroll)); |
7040 content_layer->test_properties()->AddChild(std::move(clip)); | 7070 content_layer->test_properties()->AddChild(std::move(clip)); |
7041 | 7071 |
7042 // Create the non-descendant. | 7072 // Create the non-descendant. |
7043 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 14); | 7073 std::unique_ptr<LayerImpl> clip2 = LayerImpl::Create(layer_tree_impl, 14); |
7044 clip2->SetBounds(gfx::Size(600, 600)); | 7074 clip2->SetBounds(gfx::Size(600, 600)); |
7045 clip2->SetPosition(gfx::PointF()); | 7075 clip2->SetPosition(gfx::PointF()); |
7046 | 7076 |
7047 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 15); | 7077 std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 15); |
7048 scroll2->SetBounds(gfx::Size(1200, 1200)); | 7078 scroll2->SetBounds(gfx::Size(1200, 1200)); |
7049 scroll2->SetScrollClipLayer(clip2->id()); | 7079 scroll2->SetScrollClipLayer(clip2->id()); |
7050 scroll2->SetElementId(LayerIdToElementIdForTesting(scroll2->id())); | 7080 element_id.id = scroll2->id(); |
| 7081 scroll2->SetElementId(element_id); |
7051 scroll2->SetDrawsContent(true); | 7082 scroll2->SetDrawsContent(true); |
7052 | 7083 |
7053 sibling_scroll_layer = scroll2.get(); | 7084 sibling_scroll_layer = scroll2.get(); |
7054 | 7085 |
7055 clip2->test_properties()->AddChild(std::move(scroll2)); | 7086 clip2->test_properties()->AddChild(std::move(scroll2)); |
7056 content_layer->test_properties()->AddChild(std::move(clip2)); | 7087 content_layer->test_properties()->AddChild(std::move(clip2)); |
7057 | 7088 |
7058 layer_tree_impl->SetViewportLayersFromIds( | 7089 layer_tree_impl->SetViewportLayersFromIds( |
7059 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), | 7090 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), |
7060 inner_scroll_layer->id(), outer_scroll_layer->id()); | 7091 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); | 8409 3, raster_source); |
8379 LayerImpl* content_layer = scoped_content_layer.get(); | 8410 LayerImpl* content_layer = scoped_content_layer.get(); |
8380 scrolling_layer->test_properties()->AddChild(std::move(scoped_content_layer)); | 8411 scrolling_layer->test_properties()->AddChild(std::move(scoped_content_layer)); |
8381 content_layer->SetBounds(content_layer_bounds); | 8412 content_layer->SetBounds(content_layer_bounds); |
8382 content_layer->SetDrawsContent(true); | 8413 content_layer->SetDrawsContent(true); |
8383 | 8414 |
8384 root->SetBounds(root_size); | 8415 root->SetBounds(root_size); |
8385 | 8416 |
8386 gfx::ScrollOffset scroll_offset(100000, 0); | 8417 gfx::ScrollOffset scroll_offset(100000, 0); |
8387 scrolling_layer->SetScrollClipLayer(root->id()); | 8418 scrolling_layer->SetScrollClipLayer(root->id()); |
8388 scrolling_layer->SetElementId( | 8419 ElementId element_id; |
8389 LayerIdToElementIdForTesting(scrolling_layer->id())); | 8420 element_id.id = scrolling_layer->id(); |
| 8421 scrolling_layer->SetElementId(element_id); |
8390 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 8422 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
8391 | 8423 |
8392 scrolling_layer->layer_tree_impl() | 8424 scrolling_layer->layer_tree_impl() |
8393 ->property_trees() | 8425 ->property_trees() |
8394 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scrolling_layer->id(), | 8426 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scrolling_layer->id(), |
8395 scroll_offset); | 8427 scroll_offset); |
8396 host_impl_->ActivateSyncTree(); | 8428 host_impl_->ActivateSyncTree(); |
8397 | 8429 |
8398 bool update_lcd_text = false; | 8430 bool update_lcd_text = false; |
8399 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); | 8431 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9833 // set its scroll layer as the outer viewport. This simulates setting a | 9865 // set its scroll layer as the outer viewport. This simulates setting a |
9834 // scrolling element as the root scroller on the page. | 9866 // scrolling element as the root scroller on the page. |
9835 { | 9867 { |
9836 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); | 9868 std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 10); |
9837 clip->SetBounds(root_layer_size); | 9869 clip->SetBounds(root_layer_size); |
9838 clip->SetPosition(gfx::PointF()); | 9870 clip->SetPosition(gfx::PointF()); |
9839 | 9871 |
9840 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); | 9872 std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); |
9841 scroll->SetBounds(scroll_content_size); | 9873 scroll->SetBounds(scroll_content_size); |
9842 scroll->SetScrollClipLayer(clip->id()); | 9874 scroll->SetScrollClipLayer(clip->id()); |
9843 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); | 9875 ElementId element_id; |
| 9876 element_id.id = scroll->id(); |
| 9877 scroll->SetElementId(element_id); |
9844 scroll->SetDrawsContent(true); | 9878 scroll->SetDrawsContent(true); |
9845 | 9879 |
9846 scroll_layer = scroll.get(); | 9880 scroll_layer = scroll.get(); |
9847 | 9881 |
9848 clip->test_properties()->AddChild(std::move(scroll)); | 9882 clip->test_properties()->AddChild(std::move(scroll)); |
9849 outer_scroll->test_properties()->AddChild(std::move(clip)); | 9883 outer_scroll->test_properties()->AddChild(std::move(clip)); |
9850 layer_tree_impl->SetViewportLayersFromIds( | 9884 layer_tree_impl->SetViewportLayersFromIds( |
9851 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), | 9885 Layer::INVALID_ID, layer_tree_impl->PageScaleLayer()->id(), |
9852 inner_scroll->id(), scroll_layer->id()); | 9886 inner_scroll->id(), scroll_layer->id()); |
9853 layer_tree_impl->BuildPropertyTreesForTesting(); | 9887 layer_tree_impl->BuildPropertyTreesForTesting(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9895 gfx::ScrollOffset()); | 9929 gfx::ScrollOffset()); |
9896 | 9930 |
9897 std::unique_ptr<LayerImpl> inner_clip = | 9931 std::unique_ptr<LayerImpl> inner_clip = |
9898 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 9932 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
9899 inner_clip->SetBounds(inner_viewport); | 9933 inner_clip->SetBounds(inner_viewport); |
9900 | 9934 |
9901 std::unique_ptr<LayerImpl> page_scale = | 9935 std::unique_ptr<LayerImpl> page_scale = |
9902 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 9936 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
9903 | 9937 |
9904 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 9938 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
9905 inner_scroll->SetElementId( | 9939 ElementId element_id; |
9906 LayerIdToElementIdForTesting(inner_scroll->id())); | 9940 element_id.id = inner_scroll->id(); |
| 9941 inner_scroll->SetElementId(element_id); |
9907 inner_scroll->SetBounds(outer_viewport); | 9942 inner_scroll->SetBounds(outer_viewport); |
9908 inner_scroll->SetPosition(gfx::PointF()); | 9943 inner_scroll->SetPosition(gfx::PointF()); |
9909 | 9944 |
9910 std::unique_ptr<LayerImpl> outer_clip = | 9945 std::unique_ptr<LayerImpl> outer_clip = |
9911 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 9946 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
9912 outer_clip->SetBounds(outer_viewport); | 9947 outer_clip->SetBounds(outer_viewport); |
9913 outer_clip->test_properties()->is_container_for_fixed_position_layers = | 9948 outer_clip->test_properties()->is_container_for_fixed_position_layers = |
9914 true; | 9949 true; |
9915 | 9950 |
9916 std::unique_ptr<LayerImpl> outer_scroll = | 9951 std::unique_ptr<LayerImpl> outer_scroll = |
9917 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 9952 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
9918 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 9953 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
9919 outer_scroll->SetElementId( | 9954 element_id.id = outer_scroll->id(); |
9920 LayerIdToElementIdForTesting(outer_scroll->id())); | 9955 outer_scroll->SetElementId(element_id); |
9921 outer_scroll->layer_tree_impl() | 9956 outer_scroll->layer_tree_impl() |
9922 ->property_trees() | 9957 ->property_trees() |
9923 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), | 9958 ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), |
9924 gfx::ScrollOffset()); | 9959 gfx::ScrollOffset()); |
9925 outer_scroll->SetBounds(content_size); | 9960 outer_scroll->SetBounds(content_size); |
9926 outer_scroll->SetPosition(gfx::PointF()); | 9961 outer_scroll->SetPosition(gfx::PointF()); |
9927 | 9962 |
9928 std::unique_ptr<LayerImpl> contents = LayerImpl::Create(layer_tree_impl, 8); | 9963 std::unique_ptr<LayerImpl> contents = LayerImpl::Create(layer_tree_impl, 8); |
9929 contents->SetDrawsContent(true); | 9964 contents->SetDrawsContent(true); |
9930 contents->SetBounds(content_size); | 9965 contents->SetBounds(content_size); |
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12173 scrollbar_2_id, VERTICAL, 15, 0, | 12208 scrollbar_2_id, VERTICAL, 15, 0, |
12174 true, true); | 12209 true, true); |
12175 std::unique_ptr<LayerImpl> child_clip = | 12210 std::unique_ptr<LayerImpl> child_clip = |
12176 LayerImpl::Create(host_impl_->active_tree(), child_clip_id); | 12211 LayerImpl::Create(host_impl_->active_tree(), child_clip_id); |
12177 std::unique_ptr<LayerImpl> child = | 12212 std::unique_ptr<LayerImpl> child = |
12178 LayerImpl::Create(host_impl_->active_tree(), child_scroll_id); | 12213 LayerImpl::Create(host_impl_->active_tree(), child_scroll_id); |
12179 child->SetPosition(gfx::PointF(50, 50)); | 12214 child->SetPosition(gfx::PointF(50, 50)); |
12180 child->SetBounds(child_layer_size); | 12215 child->SetBounds(child_layer_size); |
12181 child->SetDrawsContent(true); | 12216 child->SetDrawsContent(true); |
12182 child->SetScrollClipLayer(child_clip_id); | 12217 child->SetScrollClipLayer(child_clip_id); |
12183 child->SetElementId(LayerIdToElementIdForTesting(child->id())); | 12218 ElementId child_element_id; |
12184 ElementId child_element_id = child->element_id(); | 12219 child_element_id.id = child->id(); |
| 12220 child->SetElementId(child_element_id); |
| 12221 child_element_id = child->element_id(); |
12185 | 12222 |
12186 if (main_thread_scrolling) { | 12223 if (main_thread_scrolling) { |
12187 child->set_main_thread_scrolling_reasons( | 12224 child->set_main_thread_scrolling_reasons( |
12188 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); | 12225 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); |
12189 } | 12226 } |
12190 | 12227 |
12191 scrollbar_2->SetScrollElementId(child_element_id); | 12228 scrollbar_2->SetScrollElementId(child_element_id); |
12192 scrollbar_2->SetDrawsContent(true); | 12229 scrollbar_2->SetDrawsContent(true); |
12193 scrollbar_2->SetBounds(scrollbar_size_2); | 12230 scrollbar_2->SetBounds(scrollbar_size_2); |
12194 scrollbar_2->SetCurrentPos(0); | 12231 scrollbar_2->SetCurrentPos(0); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12367 else | 12404 else |
12368 EXPECT_FALSE(tile->HasRasterTask()); | 12405 EXPECT_FALSE(tile->HasRasterTask()); |
12369 } | 12406 } |
12370 Region expected_invalidation( | 12407 Region expected_invalidation( |
12371 raster_source->GetRectForImage(checkerable_image->uniqueID())); | 12408 raster_source->GetRectForImage(checkerable_image->uniqueID())); |
12372 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); | 12409 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); |
12373 } | 12410 } |
12374 | 12411 |
12375 } // namespace | 12412 } // namespace |
12376 } // namespace cc | 12413 } // namespace cc |
OLD | NEW |