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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2827163005: Remove scroll layer ids from scrollbar layers (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 scroll->SetBounds(scroll_content_size); 1034 scroll->SetBounds(scroll_content_size);
1035 scroll->SetScrollClipLayer(clip->id()); 1035 scroll->SetScrollClipLayer(clip->id());
1036 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); 1036 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id()));
1037 scroll->SetDrawsContent(true); 1037 scroll->SetDrawsContent(true);
1038 1038
1039 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 1039 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
1040 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, 1040 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0,
1041 false, true); 1041 false, true);
1042 scrollbar->SetBounds(scrollbar_size); 1042 scrollbar->SetBounds(scrollbar_size);
1043 scrollbar->SetPosition(gfx::PointF(345, 0)); 1043 scrollbar->SetPosition(gfx::PointF(345, 0));
1044 scrollbar->SetScrollInfo(scroll->id(), scroll->element_id()); 1044 scrollbar->SetScrollElementId(scroll->element_id());
1045 scrollbar->SetDrawsContent(true); 1045 scrollbar->SetDrawsContent(true);
1046 scrollbar->test_properties()->opacity = 1.f; 1046 scrollbar->test_properties()->opacity = 1.f;
1047 1047
1048 std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5); 1048 std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5);
1049 squash1->SetBounds(gfx::Size(140, 300)); 1049 squash1->SetBounds(gfx::Size(140, 300));
1050 squash1->SetPosition(gfx::PointF(220, 0)); 1050 squash1->SetPosition(gfx::PointF(220, 0));
1051 squash1->SetDrawsContent(true); 1051 squash1->SetDrawsContent(true);
1052 1052
1053 std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6); 1053 std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6);
1054 squash2->SetBounds(gfx::Size(140, 300)); 1054 squash2->SetBounds(gfx::Size(140, 300));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 scroll->SetBounds(scroll_content_size); 1106 scroll->SetBounds(scroll_content_size);
1107 scroll->SetScrollClipLayer(clip->id()); 1107 scroll->SetScrollClipLayer(clip->id());
1108 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); 1108 scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id()));
1109 scroll->SetDrawsContent(true); 1109 scroll->SetDrawsContent(true);
1110 1110
1111 std::unique_ptr<SolidColorScrollbarLayerImpl> drawn_scrollbar = 1111 std::unique_ptr<SolidColorScrollbarLayerImpl> drawn_scrollbar =
1112 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, 1112 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0,
1113 false, true); 1113 false, true);
1114 drawn_scrollbar->SetBounds(scrollbar_size); 1114 drawn_scrollbar->SetBounds(scrollbar_size);
1115 drawn_scrollbar->SetPosition(gfx::PointF(345, 0)); 1115 drawn_scrollbar->SetPosition(gfx::PointF(345, 0));
1116 drawn_scrollbar->SetScrollInfo(scroll->id(), scroll->element_id()); 1116 drawn_scrollbar->SetScrollElementId(scroll->element_id());
1117 drawn_scrollbar->SetDrawsContent(true); 1117 drawn_scrollbar->SetDrawsContent(true);
1118 drawn_scrollbar->test_properties()->opacity = 1.f; 1118 drawn_scrollbar->test_properties()->opacity = 1.f;
1119 1119
1120 std::unique_ptr<LayerImpl> squash = LayerImpl::Create(layer_tree_impl, 5); 1120 std::unique_ptr<LayerImpl> squash = LayerImpl::Create(layer_tree_impl, 5);
1121 squash->SetBounds(gfx::Size(140, 300)); 1121 squash->SetBounds(gfx::Size(140, 300));
1122 squash->SetPosition(gfx::PointF(220, 0)); 1122 squash->SetPosition(gfx::PointF(220, 0));
1123 squash->SetDrawsContent(true); 1123 squash->SetDrawsContent(true);
1124 1124
1125 scroll->test_properties()->AddChild(std::move(drawn_scrollbar)); 1125 scroll->test_properties()->AddChild(std::move(drawn_scrollbar));
1126 scroll->test_properties()->AddChild(std::move(squash)); 1126 scroll->test_properties()->AddChild(std::move(squash));
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 gfx::Size(content_size.width() / 2, content_size.height() / 2)); 2849 gfx::Size(content_size.width() / 2, content_size.height() / 2));
2850 2850
2851 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2851 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2852 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, 2852 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400,
2853 VERTICAL, 10, 0, false, true); 2853 VERTICAL, 10, 0, false, true);
2854 scrollbar->test_properties()->opacity = 0.f; 2854 scrollbar->test_properties()->opacity = 0.f;
2855 EXPECT_FLOAT_EQ(0.f, scrollbar->test_properties()->opacity); 2855 EXPECT_FLOAT_EQ(0.f, scrollbar->test_properties()->opacity);
2856 2856
2857 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer(); 2857 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer();
2858 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer(); 2858 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer();
2859 scrollbar->SetScrollInfo(scroll->id(), scroll->element_id()); 2859 scrollbar->SetScrollElementId(scroll->element_id());
2860 root->test_properties()->AddChild(std::move(scrollbar)); 2860 root->test_properties()->AddChild(std::move(scrollbar));
2861 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 2861 host_impl_->active_tree()->BuildPropertyTreesForTesting();
2862 host_impl_->active_tree()->DidBecomeActive(); 2862 host_impl_->active_tree()->DidBecomeActive();
2863 DrawFrame(); 2863 DrawFrame();
2864 2864
2865 // SetScrollInfo will initialize the scrollbar which will cause it to 2865 // SetScrollElementId will initialize the scrollbar which will cause it to
2866 // show and request a redraw. 2866 // show and request a redraw.
2867 did_request_redraw_ = false; 2867 did_request_redraw_ = false;
2868 } 2868 }
2869 2869
2870 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) { 2870 void RunTest(LayerTreeSettings::ScrollbarAnimator animator) {
2871 LayerTreeSettings settings = DefaultSettings(); 2871 LayerTreeSettings settings = DefaultSettings();
2872 settings.scrollbar_animator = animator; 2872 settings.scrollbar_animator = animator;
2873 settings.scrollbar_show_delay = base::TimeDelta::FromMilliseconds(20); 2873 settings.scrollbar_show_delay = base::TimeDelta::FromMilliseconds(20);
2874 settings.scrollbar_fade_out_delay = base::TimeDelta::FromMilliseconds(20); 2874 settings.scrollbar_fade_out_delay = base::TimeDelta::FromMilliseconds(20);
2875 settings.scrollbar_fade_out_resize_delay = 2875 settings.scrollbar_fade_out_resize_delay =
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 CreateHostImpl(settings, CreateCompositorFrameSink()); 3106 CreateHostImpl(settings, CreateCompositorFrameSink());
3107 host_impl_->CreatePendingTree(); 3107 host_impl_->CreatePendingTree();
3108 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); 3108 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size);
3109 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 3109 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
3110 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400, 3110 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400,
3111 VERTICAL, 10, 0, false, true); 3111 VERTICAL, 10, 0, false, true);
3112 scrollbar->test_properties()->opacity = 0.f; 3112 scrollbar->test_properties()->opacity = 0.f;
3113 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer(); 3113 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer();
3114 LayerImpl* container = 3114 LayerImpl* container =
3115 host_impl_->pending_tree()->InnerViewportContainerLayer(); 3115 host_impl_->pending_tree()->InnerViewportContainerLayer();
3116 scrollbar->SetScrollInfo(scroll->id(), scroll->element_id()); 3116 scrollbar->SetScrollElementId(scroll->element_id());
3117 container->test_properties()->AddChild(std::move(scrollbar)); 3117 container->test_properties()->AddChild(std::move(scrollbar));
3118 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 3118 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
3119 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); 3119 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
3120 host_impl_->ActivateSyncTree(); 3120 host_impl_->ActivateSyncTree();
3121 3121
3122 LayerImpl* active_scrollbar_layer = 3122 LayerImpl* active_scrollbar_layer =
3123 host_impl_->active_tree()->LayerById(400); 3123 host_impl_->active_tree()->LayerById(400);
3124 3124
3125 EffectNode* active_tree_node = 3125 EffectNode* active_tree_node =
3126 host_impl_->active_tree()->property_trees()->effect_tree.Node( 3126 host_impl_->active_tree()->property_trees()->effect_tree.Node(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
3201 CreateHostImpl(settings, CreateCompositorFrameSink()); 3201 CreateHostImpl(settings, CreateCompositorFrameSink());
3202 host_impl_->CreatePendingTree(); 3202 host_impl_->CreatePendingTree();
3203 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); 3203 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size);
3204 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 3204 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
3205 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400, 3205 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400,
3206 VERTICAL, 10, 0, false, true); 3206 VERTICAL, 10, 0, false, true);
3207 scrollbar->test_properties()->opacity = 0.f; 3207 scrollbar->test_properties()->opacity = 0.f;
3208 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer(); 3208 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer();
3209 LayerImpl* container = 3209 LayerImpl* container =
3210 host_impl_->pending_tree()->InnerViewportContainerLayer(); 3210 host_impl_->pending_tree()->InnerViewportContainerLayer();
3211 scrollbar->SetScrollInfo(scroll->id(), scroll->element_id()); 3211 scrollbar->SetScrollElementId(scroll->element_id());
3212 container->test_properties()->AddChild(std::move(scrollbar)); 3212 container->test_properties()->AddChild(std::move(scrollbar));
3213 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 3213 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
3214 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); 3214 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
3215 host_impl_->ActivateSyncTree(); 3215 host_impl_->ActivateSyncTree();
3216 3216
3217 ScrollbarAnimationController* scrollbar_controller = 3217 ScrollbarAnimationController* scrollbar_controller =
3218 host_impl_->ScrollbarAnimationControllerForElementId( 3218 host_impl_->ScrollbarAnimationControllerForElementId(
3219 scroll->element_id()); 3219 scroll->element_id());
3220 3220
3221 // Scrollbars will flash shown but we should have a fade out animation 3221 // Scrollbars will flash shown but we should have a fade out animation
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 std::unique_ptr<SolidColorScrollbarLayerImpl> horiz_scrollbar = 3277 std::unique_ptr<SolidColorScrollbarLayerImpl> horiz_scrollbar =
3278 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), horiz_id, 3278 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), horiz_id,
3279 HORIZONTAL, 5, 5, true, true); 3279 HORIZONTAL, 5, 5, true, true);
3280 std::unique_ptr<LayerImpl> child = 3280 std::unique_ptr<LayerImpl> child =
3281 LayerImpl::Create(host_impl_->active_tree(), child_scroll_id); 3281 LayerImpl::Create(host_impl_->active_tree(), child_scroll_id);
3282 child->SetBounds(content_size); 3282 child->SetBounds(content_size);
3283 std::unique_ptr<LayerImpl> child_clip = 3283 std::unique_ptr<LayerImpl> child_clip =
3284 LayerImpl::Create(host_impl_->active_tree(), child_clip_id); 3284 LayerImpl::Create(host_impl_->active_tree(), child_clip_id);
3285 child->SetBounds(inner_viewport_size); 3285 child->SetBounds(inner_viewport_size);
3286 3286
3287 horiz_scrollbar->SetScrollInfo(root_scroll->id(), root_scroll->element_id()); 3287 horiz_scrollbar->SetScrollElementId(root_scroll->element_id());
3288 3288
3289 EXPECT_EQ(300, horiz_scrollbar->clip_layer_length()); 3289 EXPECT_EQ(300, horiz_scrollbar->clip_layer_length());
3290 } 3290 }
3291 3291
3292 TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) { 3292 TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) {
3293 LayerTreeSettings settings = DefaultSettings(); 3293 LayerTreeSettings settings = DefaultSettings();
3294 settings.scrollbar_animator = LayerTreeSettings::ANDROID_OVERLAY; 3294 settings.scrollbar_animator = LayerTreeSettings::ANDROID_OVERLAY;
3295 settings.scrollbar_show_delay = base::TimeDelta::FromMilliseconds(20); 3295 settings.scrollbar_show_delay = base::TimeDelta::FromMilliseconds(20);
3296 settings.scrollbar_fade_out_delay = base::TimeDelta::FromMilliseconds(20); 3296 settings.scrollbar_fade_out_delay = base::TimeDelta::FromMilliseconds(20);
3297 settings.scrollbar_fade_out_duration = base::TimeDelta::FromMilliseconds(20); 3297 settings.scrollbar_fade_out_duration = base::TimeDelta::FromMilliseconds(20);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3330 std::unique_ptr<LayerImpl> child_clip = 3330 std::unique_ptr<LayerImpl> child_clip =
3331 LayerImpl::Create(host_impl_->active_tree(), child_clip_id); 3331 LayerImpl::Create(host_impl_->active_tree(), child_clip_id);
3332 child->SetBounds(viewport_size); 3332 child->SetBounds(viewport_size);
3333 LayerImpl* child_ptr = child.get(); 3333 LayerImpl* child_ptr = child.get();
3334 LayerImpl* child_clip_ptr = child_clip.get(); 3334 LayerImpl* child_clip_ptr = child_clip.get();
3335 3335
3336 // Check scrollbar registration on the viewport layers. 3336 // Check scrollbar registration on the viewport layers.
3337 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(root_scroll->element_id()).size()); 3337 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(root_scroll->element_id()).size());
3338 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId( 3338 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId(
3339 root_scroll->element_id())); 3339 root_scroll->element_id()));
3340 vert_1_scrollbar->SetScrollInfo(root_scroll->id(), root_scroll->element_id()); 3340 vert_1_scrollbar->SetScrollElementId(root_scroll->element_id());
3341 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(root_scroll->element_id()).size()); 3341 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(root_scroll->element_id()).size());
3342 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( 3342 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId(
3343 root_scroll->element_id())); 3343 root_scroll->element_id()));
3344 horiz_1_scrollbar->SetScrollInfo(root_scroll->id(), 3344 horiz_1_scrollbar->SetScrollElementId(root_scroll->element_id());
3345 root_scroll->element_id());
3346 EXPECT_EQ(2ul, host_impl_->ScrollbarsFor(root_scroll->element_id()).size()); 3345 EXPECT_EQ(2ul, host_impl_->ScrollbarsFor(root_scroll->element_id()).size());
3347 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( 3346 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId(
3348 root_scroll->element_id())); 3347 root_scroll->element_id()));
3349 3348
3350 // Changing one of the viewport layers should result in a scrollbar animation 3349 // Changing one of the viewport layers should result in a scrollbar animation
3351 // update. 3350 // update.
3352 animation_task_ = base::Closure(); 3351 animation_task_ = base::Closure();
3353 host_impl_->active_tree()->InnerViewportContainerLayer()->SetBoundsDelta( 3352 host_impl_->active_tree()->InnerViewportContainerLayer()->SetBoundsDelta(
3354 gfx::Vector2dF(10, 10)); 3353 gfx::Vector2dF(10, 10));
3355 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 3354 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
3356 animation_task_ = base::Closure(); 3355 animation_task_ = base::Closure();
3357 host_impl_->active_tree()->OuterViewportScrollLayer()->SetCurrentScrollOffset( 3356 host_impl_->active_tree()->OuterViewportScrollLayer()->SetCurrentScrollOffset(
3358 gfx::ScrollOffset(10, 10)); 3357 gfx::ScrollOffset(10, 10));
3359 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 3358 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
3360 animation_task_ = base::Closure(); 3359 animation_task_ = base::Closure();
3361 host_impl_->active_tree()->InnerViewportScrollLayer()->SetCurrentScrollOffset( 3360 host_impl_->active_tree()->InnerViewportScrollLayer()->SetCurrentScrollOffset(
3362 gfx::ScrollOffset(10, 10)); 3361 gfx::ScrollOffset(10, 10));
3363 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 3362 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
3364 animation_task_ = base::Closure(); 3363 animation_task_ = base::Closure();
3365 3364
3366 // Check scrollbar registration on a sublayer. 3365 // Check scrollbar registration on a sublayer.
3367 child->SetScrollClipLayer(child_clip->id()); 3366 child->SetScrollClipLayer(child_clip->id());
3368 child->SetElementId(LayerIdToElementIdForTesting(child->id())); 3367 child->SetElementId(LayerIdToElementIdForTesting(child->id()));
3369 ElementId child_scroll_element_id = child->element_id(); 3368 ElementId child_scroll_element_id = child->element_id();
3370 child_clip->test_properties()->AddChild(std::move(child)); 3369 child_clip->test_properties()->AddChild(std::move(child));
3371 root_scroll->test_properties()->AddChild(std::move(child_clip)); 3370 root_scroll->test_properties()->AddChild(std::move(child_clip));
3372 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); 3371 EXPECT_EQ(0ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size());
3373 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId( 3372 EXPECT_EQ(nullptr, host_impl_->ScrollbarAnimationControllerForElementId(
3374 child_scroll_element_id)); 3373 child_scroll_element_id));
3375 vert_2_scrollbar->SetScrollInfo(child_scroll_id, child_scroll_element_id); 3374 vert_2_scrollbar->SetScrollElementId(child_scroll_element_id);
3376 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); 3375 EXPECT_EQ(1ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size());
3377 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( 3376 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId(
3378 child_scroll_element_id)); 3377 child_scroll_element_id));
3379 horiz_2_scrollbar->SetScrollInfo(child_scroll_id, child_scroll_element_id); 3378 horiz_2_scrollbar->SetScrollElementId(child_scroll_element_id);
3380 EXPECT_EQ(2ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size()); 3379 EXPECT_EQ(2ul, host_impl_->ScrollbarsFor(child_scroll_element_id).size());
3381 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId( 3380 EXPECT_TRUE(host_impl_->ScrollbarAnimationControllerForElementId(
3382 child_scroll_element_id)); 3381 child_scroll_element_id));
3383 3382
3384 // Changing one of the child layers should result in a scrollbar animation 3383 // Changing one of the child layers should result in a scrollbar animation
3385 // update. 3384 // update.
3386 animation_task_ = base::Closure(); 3385 animation_task_ = base::Closure();
3387 child_clip_ptr->SetBounds(gfx::Size(200, 200)); 3386 child_clip_ptr->SetBounds(gfx::Size(200, 200));
3388 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 3387 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
3389 animation_task_ = base::Closure(); 3388 animation_task_ = base::Closure();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 3438
3440 CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size); 3439 CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size);
3441 host_impl_->active_tree()->InnerViewportContainerLayer()->SetBounds( 3440 host_impl_->active_tree()->InnerViewportContainerLayer()->SetBounds(
3442 viewport_size); 3441 viewport_size);
3443 LayerImpl* root_scroll = 3442 LayerImpl* root_scroll =
3444 host_impl_->active_tree()->OuterViewportScrollLayer(); 3443 host_impl_->active_tree()->OuterViewportScrollLayer();
3445 // The scrollbar is on the left side. 3444 // The scrollbar is on the left side.
3446 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 3445 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
3447 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 6, 3446 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 6,
3448 VERTICAL, 5, 5, true, true); 3447 VERTICAL, 5, 5, true, true);
3449 scrollbar->SetScrollInfo(root_scroll->id(), root_scroll->element_id()); 3448 scrollbar->SetScrollElementId(root_scroll->element_id());
3450 scrollbar->SetDrawsContent(true); 3449 scrollbar->SetDrawsContent(true);
3451 scrollbar->SetBounds(scrollbar_size); 3450 scrollbar->SetBounds(scrollbar_size);
3452 scrollbar->SetTouchEventHandlerRegion(gfx::Rect(scrollbar_size)); 3451 scrollbar->SetTouchEventHandlerRegion(gfx::Rect(scrollbar_size));
3453 host_impl_->active_tree() 3452 host_impl_->active_tree()
3454 ->InnerViewportContainerLayer() 3453 ->InnerViewportContainerLayer()
3455 ->test_properties() 3454 ->test_properties()
3456 ->AddChild(std::move(scrollbar)); 3455 ->AddChild(std::move(scrollbar));
3457 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 3456 host_impl_->active_tree()->BuildPropertyTreesForTesting();
3458 host_impl_->active_tree()->DidBecomeActive(); 3457 host_impl_->active_tree()->DidBecomeActive();
3459 3458
(...skipping 8619 matching lines...) Expand 10 before | Expand all | Expand 10 after
12079 if (main_thread_scrolling) { 12078 if (main_thread_scrolling) {
12080 root_scroll->set_main_thread_scrolling_reasons( 12079 root_scroll->set_main_thread_scrolling_reasons(
12081 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); 12080 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects);
12082 } 12081 }
12083 12082
12084 // scrollbar_1 on root scroll. 12083 // scrollbar_1 on root scroll.
12085 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_1 = 12084 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_1 =
12086 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 12085 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(),
12087 scrollbar_1_id, VERTICAL, 5, 5, true, 12086 scrollbar_1_id, VERTICAL, 5, 5, true,
12088 true); 12087 true);
12089 scrollbar_1->SetScrollInfo(root_scroll->id(), root_scroll->element_id()); 12088 scrollbar_1->SetScrollElementId(root_scroll->element_id());
12090 scrollbar_1->SetDrawsContent(true); 12089 scrollbar_1->SetDrawsContent(true);
12091 scrollbar_1->SetBounds(scrollbar_size_1); 12090 scrollbar_1->SetBounds(scrollbar_size_1);
12092 scrollbar_1->SetTouchEventHandlerRegion(gfx::Rect(scrollbar_size_1)); 12091 scrollbar_1->SetTouchEventHandlerRegion(gfx::Rect(scrollbar_size_1));
12093 host_impl_->active_tree() 12092 host_impl_->active_tree()
12094 ->InnerViewportContainerLayer() 12093 ->InnerViewportContainerLayer()
12095 ->test_properties() 12094 ->test_properties()
12096 ->AddChild(std::move(scrollbar_1)); 12095 ->AddChild(std::move(scrollbar_1));
12097 12096
12098 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 12097 host_impl_->active_tree()->BuildPropertyTreesForTesting();
12099 host_impl_->active_tree()->DidBecomeActive(); 12098 host_impl_->active_tree()->DidBecomeActive();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
12152 child->SetDrawsContent(true); 12151 child->SetDrawsContent(true);
12153 child->SetScrollClipLayer(child_clip_id); 12152 child->SetScrollClipLayer(child_clip_id);
12154 child->SetElementId(LayerIdToElementIdForTesting(child->id())); 12153 child->SetElementId(LayerIdToElementIdForTesting(child->id()));
12155 ElementId child_element_id = child->element_id(); 12154 ElementId child_element_id = child->element_id();
12156 12155
12157 if (main_thread_scrolling) { 12156 if (main_thread_scrolling) {
12158 child->set_main_thread_scrolling_reasons( 12157 child->set_main_thread_scrolling_reasons(
12159 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); 12158 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects);
12160 } 12159 }
12161 12160
12162 scrollbar_2->SetScrollInfo(child_scroll_id, child_element_id); 12161 scrollbar_2->SetScrollElementId(child_element_id);
12163 scrollbar_2->SetDrawsContent(true); 12162 scrollbar_2->SetDrawsContent(true);
12164 scrollbar_2->SetBounds(scrollbar_size_2); 12163 scrollbar_2->SetBounds(scrollbar_size_2);
12165 12164
12166 child->test_properties()->AddChild(std::move(scrollbar_2)); 12165 child->test_properties()->AddChild(std::move(scrollbar_2));
12167 child_clip->test_properties()->AddChild(std::move(child)); 12166 child_clip->test_properties()->AddChild(std::move(child));
12168 root_scroll->test_properties()->AddChild(std::move(child_clip)); 12167 root_scroll->test_properties()->AddChild(std::move(child_clip));
12169 12168
12170 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 12169 host_impl_->active_tree()->BuildPropertyTreesForTesting();
12171 host_impl_->active_tree()->DidBecomeActive(); 12170 host_impl_->active_tree()->DidBecomeActive();
12172 12171
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
12317 else 12316 else
12318 EXPECT_FALSE(tile->HasRasterTask()); 12317 EXPECT_FALSE(tile->HasRasterTask());
12319 } 12318 }
12320 Region expected_invalidation( 12319 Region expected_invalidation(
12321 raster_source->GetRectForImage(checkerable_image->uniqueID())); 12320 raster_source->GetRectForImage(checkerable_image->uniqueID()));
12322 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); 12321 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation()));
12323 } 12322 }
12324 12323
12325 } // namespace 12324 } // namespace
12326 } // namespace cc 12325 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698