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