OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/scrollbar_animation_controller.h" | 5 #include "cc/scrollbar_animation_controller.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "cc/scrollbar_layer_impl.h" | 10 #include "cc/scrollbar_layer_impl.h" |
11 | 11 |
12 #if defined(OS_ANDROID) | |
13 #include "cc/scrollbar_animation_controller_linear_fade.h" | |
14 #endif | |
15 | |
16 namespace cc { | 12 namespace cc { |
17 | 13 |
18 #if defined(OS_ANDROID) | |
19 scoped_ptr<ScrollbarAnimationController> ScrollbarAnimationController::create(La
yerImpl* scrollLayer) | |
20 { | |
21 static const double fadeoutDelay = 0.3; | |
22 static const double fadeoutLength = 0.3; | |
23 return ScrollbarAnimationControllerLinearFade::create(scrollLayer, fadeoutDe
lay, fadeoutLength).PassAs<ScrollbarAnimationController>(); | |
24 } | |
25 #else | |
26 scoped_ptr<ScrollbarAnimationController> ScrollbarAnimationController::create(La
yerImpl* scrollLayer) | 14 scoped_ptr<ScrollbarAnimationController> ScrollbarAnimationController::create(La
yerImpl* scrollLayer) |
27 { | 15 { |
28 return make_scoped_ptr(new ScrollbarAnimationController(scrollLayer)); | 16 return make_scoped_ptr(new ScrollbarAnimationController(scrollLayer)); |
29 } | 17 } |
30 #endif | |
31 | 18 |
32 ScrollbarAnimationController::ScrollbarAnimationController(LayerImpl* scrollLaye
r) | 19 ScrollbarAnimationController::ScrollbarAnimationController(LayerImpl* scrollLaye
r) |
33 : m_horizontalScrollbarLayer(0) | 20 : m_horizontalScrollbarLayer(0) |
34 , m_verticalScrollbarLayer(0) | 21 , m_verticalScrollbarLayer(0) |
35 { | 22 { |
36 ScrollbarAnimationController::updateScrollOffsetAtTime(scrollLayer, 0); | 23 ScrollbarAnimationController::updateScrollOffsetAtTime(scrollLayer, 0); |
37 } | 24 } |
38 | 25 |
39 ScrollbarAnimationController::~ScrollbarAnimationController() | 26 ScrollbarAnimationController::~ScrollbarAnimationController() |
40 { | 27 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 81 } |
95 | 82 |
96 if (m_verticalScrollbarLayer) { | 83 if (m_verticalScrollbarLayer) { |
97 m_verticalScrollbarLayer->setCurrentPos(m_currentOffset.y()); | 84 m_verticalScrollbarLayer->setCurrentPos(m_currentOffset.y()); |
98 m_verticalScrollbarLayer->setTotalSize(m_totalSize.height()); | 85 m_verticalScrollbarLayer->setTotalSize(m_totalSize.height()); |
99 m_verticalScrollbarLayer->setMaximum(m_maximum.y()); | 86 m_verticalScrollbarLayer->setMaximum(m_maximum.y()); |
100 } | 87 } |
101 } | 88 } |
102 | 89 |
103 } // namespace cc | 90 } // namespace cc |
OLD | NEW |