OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input/scrollbar_animation_controller.h" | 5 #include "cc/input/scrollbar_animation_controller.h" |
6 | 6 |
7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
8 #include "cc/test/fake_impl_task_runner_provider.h" | 8 #include "cc/test/fake_impl_task_runner_provider.h" |
9 #include "cc/test/fake_layer_tree_host_impl.h" | 9 #include "cc/test/fake_layer_tree_host_impl.h" |
10 #include "cc/test/geometry_test_utils.h" | 10 #include "cc/test/geometry_test_utils.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 const base::TimeDelta kFadeDelay = base::TimeDelta::FromSeconds(4); | 73 const base::TimeDelta kFadeDelay = base::TimeDelta::FromSeconds(4); |
74 const base::TimeDelta kFadeDuration = base::TimeDelta::FromSeconds(3); | 74 const base::TimeDelta kFadeDuration = base::TimeDelta::FromSeconds(3); |
75 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2); | 75 const base::TimeDelta kThinningDuration = base::TimeDelta::FromSeconds(2); |
76 | 76 |
77 void SetUp() override { | 77 void SetUp() override { |
78 std::unique_ptr<LayerImpl> scroll_layer = | 78 std::unique_ptr<LayerImpl> scroll_layer = |
79 LayerImpl::Create(host_impl_.active_tree(), 1); | 79 LayerImpl::Create(host_impl_.active_tree(), 1); |
80 std::unique_ptr<LayerImpl> clip = | 80 std::unique_ptr<LayerImpl> clip = |
81 LayerImpl::Create(host_impl_.active_tree(), 2); | 81 LayerImpl::Create(host_impl_.active_tree(), 2); |
82 clip_layer_ = clip.get(); | 82 clip_layer_ = clip.get(); |
83 scroll_layer->SetElementId( | 83 ElementId element_id; |
84 LayerIdToElementIdForTesting(scroll_layer->id())); | 84 element_id.id = scroll_layer->id(); |
wkorman
2017/05/08 18:23:24
In subsequent change we could consider adding a Te
| |
85 scroll_layer->SetElementId(element_id); | |
85 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 86 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
86 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 87 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
87 | 88 |
88 const int kTrackStart = 0; | 89 const int kTrackStart = 0; |
89 const int kTrackLength = 100; | 90 const int kTrackLength = 100; |
90 const bool kIsLeftSideVerticalScrollbar = false; | 91 const bool kIsLeftSideVerticalScrollbar = false; |
91 const bool kIsOverlayScrollbar = true; | 92 const bool kIsOverlayScrollbar = true; |
92 | 93 |
93 std::unique_ptr<SolidColorScrollbarLayerImpl> h_scrollbar = | 94 std::unique_ptr<SolidColorScrollbarLayerImpl> h_scrollbar = |
94 SolidColorScrollbarLayerImpl::Create( | 95 SolidColorScrollbarLayerImpl::Create( |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1238 LayerImpl::Create(host_impl_.active_tree(), 1); | 1239 LayerImpl::Create(host_impl_.active_tree(), 1); |
1239 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = | 1240 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = |
1240 SolidColorScrollbarLayerImpl::Create( | 1241 SolidColorScrollbarLayerImpl::Create( |
1241 host_impl_.active_tree(), 2, orientation(), kThumbThickness, | 1242 host_impl_.active_tree(), 2, orientation(), kThumbThickness, |
1242 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); | 1243 kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); |
1243 scrollbar_layer_ = scrollbar.get(); | 1244 scrollbar_layer_ = scrollbar.get(); |
1244 scrollbar_layer_->test_properties()->opacity_can_animate = true; | 1245 scrollbar_layer_->test_properties()->opacity_can_animate = true; |
1245 std::unique_ptr<LayerImpl> clip = | 1246 std::unique_ptr<LayerImpl> clip = |
1246 LayerImpl::Create(host_impl_.active_tree(), 3); | 1247 LayerImpl::Create(host_impl_.active_tree(), 3); |
1247 clip_layer_ = clip.get(); | 1248 clip_layer_ = clip.get(); |
1248 scroll_layer->SetElementId( | 1249 ElementId element_id; |
1249 LayerIdToElementIdForTesting(scroll_layer->id())); | 1250 element_id.id = scroll_layer->id(); |
1251 scroll_layer->SetElementId(element_id); | |
1250 | 1252 |
1251 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 1253 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
1252 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 1254 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
1253 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); | 1255 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); |
1254 clip->test_properties()->AddChild(std::move(scroll_layer)); | 1256 clip->test_properties()->AddChild(std::move(scroll_layer)); |
1255 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); | 1257 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); |
1256 | 1258 |
1257 scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id()); | 1259 scrollbar_layer_->SetScrollElementId(scroll_layer_ptr->element_id()); |
1258 clip_layer_->SetBounds(gfx::Size(100, 100)); | 1260 clip_layer_->SetBounds(gfx::Size(100, 100)); |
1259 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); | 1261 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1671 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 1673 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
1672 | 1674 |
1673 time += base::TimeDelta::FromSeconds(1); | 1675 time += base::TimeDelta::FromSeconds(1); |
1674 scrollbar_controller_->DidScrollEnd(); | 1676 scrollbar_controller_->DidScrollEnd(); |
1675 EXPECT_FALSE(did_request_animate_); | 1677 EXPECT_FALSE(did_request_animate_); |
1676 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 1678 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
1677 } | 1679 } |
1678 | 1680 |
1679 } // namespace | 1681 } // namespace |
1680 } // namespace cc | 1682 } // namespace cc |
OLD | NEW |