| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 host_impl_.active_tree(), 4, VERTICAL, kThumbThickness, kTrackStart, | 98 host_impl_.active_tree(), 4, VERTICAL, kThumbThickness, kTrackStart, |
| 99 kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); | 99 kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar); |
| 100 v_scrollbar_layer_ = v_scrollbar.get(); | 100 v_scrollbar_layer_ = v_scrollbar.get(); |
| 101 h_scrollbar_layer_ = h_scrollbar.get(); | 101 h_scrollbar_layer_ = h_scrollbar.get(); |
| 102 | 102 |
| 103 scroll_layer->test_properties()->AddChild(std::move(v_scrollbar)); | 103 scroll_layer->test_properties()->AddChild(std::move(v_scrollbar)); |
| 104 scroll_layer->test_properties()->AddChild(std::move(h_scrollbar)); | 104 scroll_layer->test_properties()->AddChild(std::move(h_scrollbar)); |
| 105 clip_layer_->test_properties()->AddChild(std::move(scroll_layer)); | 105 clip_layer_->test_properties()->AddChild(std::move(scroll_layer)); |
| 106 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); | 106 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); |
| 107 | 107 |
| 108 v_scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); | 108 v_scrollbar_layer_->SetScrollInfo(scroll_layer_ptr->id(), |
| 109 h_scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); | 109 scroll_layer_ptr->element_id()); |
| 110 h_scrollbar_layer_->SetScrollInfo(scroll_layer_ptr->id(), |
| 111 scroll_layer_ptr->element_id()); |
| 110 v_scrollbar_layer_->test_properties()->opacity_can_animate = true; | 112 v_scrollbar_layer_->test_properties()->opacity_can_animate = true; |
| 111 h_scrollbar_layer_->test_properties()->opacity_can_animate = true; | 113 h_scrollbar_layer_->test_properties()->opacity_can_animate = true; |
| 112 clip_layer_->SetBounds(gfx::Size(100, 100)); | 114 clip_layer_->SetBounds(gfx::Size(100, 100)); |
| 113 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); | 115 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); |
| 114 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 116 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 115 | 117 |
| 116 scrollbar_controller_ = ScrollbarAnimationController:: | 118 scrollbar_controller_ = ScrollbarAnimationController:: |
| 117 CreateScrollbarAnimationControllerAuraOverlay( | 119 CreateScrollbarAnimationControllerAuraOverlay( |
| 118 scroll_layer_ptr->id(), &client_, kShowDelay, kFadeOutDelay, | 120 scroll_layer_ptr->id(), &client_, kShowDelay, kFadeOutDelay, |
| 119 kResizeFadeOutDelay, kFadeOutDuration, kThinningDuration); | 121 kResizeFadeOutDelay, kFadeOutDuration, kThinningDuration); |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 scrollbar_layer_->test_properties()->opacity_can_animate = true; | 1154 scrollbar_layer_->test_properties()->opacity_can_animate = true; |
| 1153 std::unique_ptr<LayerImpl> clip = | 1155 std::unique_ptr<LayerImpl> clip = |
| 1154 LayerImpl::Create(host_impl_.active_tree(), 3); | 1156 LayerImpl::Create(host_impl_.active_tree(), 3); |
| 1155 clip_layer_ = clip.get(); | 1157 clip_layer_ = clip.get(); |
| 1156 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | 1158 scroll_layer->SetScrollClipLayer(clip_layer_->id()); |
| 1157 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | 1159 LayerImpl* scroll_layer_ptr = scroll_layer.get(); |
| 1158 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); | 1160 scroll_layer->test_properties()->AddChild(std::move(scrollbar)); |
| 1159 clip->test_properties()->AddChild(std::move(scroll_layer)); | 1161 clip->test_properties()->AddChild(std::move(scroll_layer)); |
| 1160 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); | 1162 host_impl_.active_tree()->SetRootLayerForTesting(std::move(clip)); |
| 1161 | 1163 |
| 1162 scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id()); | 1164 scrollbar_layer_->SetScrollInfo(scroll_layer_ptr->id(), |
| 1165 scroll_layer_ptr->element_id()); |
| 1163 clip_layer_->SetBounds(gfx::Size(100, 100)); | 1166 clip_layer_->SetBounds(gfx::Size(100, 100)); |
| 1164 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); | 1167 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); |
| 1165 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 1168 host_impl_.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 1166 | 1169 |
| 1167 scrollbar_controller_ = | 1170 scrollbar_controller_ = |
| 1168 ScrollbarAnimationController::CreateScrollbarAnimationControllerAndroid( | 1171 ScrollbarAnimationController::CreateScrollbarAnimationControllerAndroid( |
| 1169 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2), | 1172 scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2), |
| 1170 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3)); | 1173 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3)); |
| 1171 } | 1174 } |
| 1172 | 1175 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 1597 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
| 1595 | 1598 |
| 1596 time += base::TimeDelta::FromSeconds(1); | 1599 time += base::TimeDelta::FromSeconds(1); |
| 1597 scrollbar_controller_->DidScrollEnd(); | 1600 scrollbar_controller_->DidScrollEnd(); |
| 1598 EXPECT_FALSE(did_request_animate_); | 1601 EXPECT_FALSE(did_request_animate_); |
| 1599 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); | 1602 EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity()); |
| 1600 } | 1603 } |
| 1601 | 1604 |
| 1602 } // namespace | 1605 } // namespace |
| 1603 } // namespace cc | 1606 } // namespace cc |
| OLD | NEW |