Chromium Code Reviews| 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/time.h" | 8 #include "base/time.h" |
| 8 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 9 #include "cc/scrollbar_layer_impl.h" | 10 #include "cc/scrollbar_layer_impl.h" |
| 10 | 11 |
| 11 #if defined(OS_ANDROID) | 12 #if defined(OS_ANDROID) |
| 12 #include "cc/scrollbar_animation_controller_linear_fade.h" | 13 #include "cc/scrollbar_animation_controller_linear_fade.h" |
| 13 #endif | 14 #endif |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 | 17 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 // a cleaner way to get the contentBounds on the Impl side. | 74 // a cleaner way to get the contentBounds on the Impl side. |
| 74 return scrollLayer->children()[0]->bounds(); | 75 return scrollLayer->children()[0]->bounds(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void ScrollbarAnimationController::updateScrollOffsetAtTime(LayerImpl* scrollLay er, double) | 78 void ScrollbarAnimationController::updateScrollOffsetAtTime(LayerImpl* scrollLay er, double) |
| 78 { | 79 { |
| 79 m_currentOffset = scrollLayer->scrollOffset() + scrollLayer->scrollDelta(); | 80 m_currentOffset = scrollLayer->scrollOffset() + scrollLayer->scrollDelta(); |
| 80 m_totalSize = getScrollLayerBounds(scrollLayer); | 81 m_totalSize = getScrollLayerBounds(scrollLayer); |
| 81 m_maximum = scrollLayer->maxScrollOffset(); | 82 m_maximum = scrollLayer->maxScrollOffset(); |
| 82 | 83 |
| 84 // Get the m_currentOffset.y() value for a sanity-check on scrolling | |
| 85 // benchmark metrics. Specifically, we want to make sure | |
| 86 // BasicMouseWheelSmoothScrollGesture has proper scroll curves. | |
| 87 TRACE_COUNTER_ID1("gpu", "scroll_offset_y", this, m_currentOffset.y()); | |
|
nduca
2013/01/04 22:42:13
we should be passing a layerTreeHostImpl pointer h
| |
| 88 | |
| 89 | |
| 83 if (m_horizontalScrollbarLayer) { | 90 if (m_horizontalScrollbarLayer) { |
| 84 m_horizontalScrollbarLayer->setCurrentPos(m_currentOffset.x()); | 91 m_horizontalScrollbarLayer->setCurrentPos(m_currentOffset.x()); |
| 85 m_horizontalScrollbarLayer->setTotalSize(m_totalSize.width()); | 92 m_horizontalScrollbarLayer->setTotalSize(m_totalSize.width()); |
| 86 m_horizontalScrollbarLayer->setMaximum(m_maximum.x()); | 93 m_horizontalScrollbarLayer->setMaximum(m_maximum.x()); |
| 87 } | 94 } |
| 88 | 95 |
| 89 if (m_verticalScrollbarLayer) { | 96 if (m_verticalScrollbarLayer) { |
| 90 m_verticalScrollbarLayer->setCurrentPos(m_currentOffset.y()); | 97 m_verticalScrollbarLayer->setCurrentPos(m_currentOffset.y()); |
| 91 m_verticalScrollbarLayer->setTotalSize(m_totalSize.height()); | 98 m_verticalScrollbarLayer->setTotalSize(m_totalSize.height()); |
| 92 m_verticalScrollbarLayer->setMaximum(m_maximum.y()); | 99 m_verticalScrollbarLayer->setMaximum(m_maximum.y()); |
| 93 } | 100 } |
| 94 } | 101 } |
| 95 | 102 |
| 96 } // namespace cc | 103 } // namespace cc |
| OLD | NEW |