| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 sent_scroll_delta_ = sent_scroll_delta; | 241 sent_scroll_delta_ = sent_scroll_delta; |
| 242 } | 242 } |
| 243 | 243 |
| 244 gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) { | 244 gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) { |
| 245 gfx::Vector2dF min_delta = -scroll_offset_; | 245 gfx::Vector2dF min_delta = -scroll_offset_; |
| 246 gfx::Vector2dF max_delta = max_scroll_offset_ - scroll_offset_; | 246 gfx::Vector2dF max_delta = max_scroll_offset_ - scroll_offset_; |
| 247 // Clamp new_delta so that position + delta stays within scroll bounds. | 247 // Clamp new_delta so that position + delta stays within scroll bounds. |
| 248 gfx::Vector2dF new_delta = (ScrollDelta() + scroll); | 248 gfx::Vector2dF new_delta = (ScrollDelta() + scroll); |
| 249 new_delta.ClampToMin(min_delta); | 249 new_delta.SetToMax(min_delta); |
| 250 new_delta.ClampToMax(max_delta); | 250 new_delta.SetToMin(max_delta); |
| 251 gfx::Vector2dF unscrolled = ScrollDelta() + scroll - new_delta; | 251 gfx::Vector2dF unscrolled = ScrollDelta() + scroll - new_delta; |
| 252 | 252 |
| 253 SetScrollDelta(new_delta); | 253 SetScrollDelta(new_delta); |
| 254 return unscrolled; | 254 return unscrolled; |
| 255 } | 255 } |
| 256 | 256 |
| 257 InputHandler::ScrollStatus LayerImpl::TryScroll( | 257 InputHandler::ScrollStatus LayerImpl::TryScroll( |
| 258 gfx::PointF screen_space_point, | 258 gfx::PointF screen_space_point, |
| 259 InputHandler::ScrollInputType type) const { | 259 InputHandler::ScrollInputType type) const { |
| 260 if (should_scroll_on_main_thread()) { | 260 if (should_scroll_on_main_thread()) { |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 | 1152 |
| 1153 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1153 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
| 1154 | 1154 |
| 1155 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1155 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
| 1156 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1156 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1157 AsValueInto(state.get()); | 1157 AsValueInto(state.get()); |
| 1158 return state.PassAs<base::Value>(); | 1158 return state.PassAs<base::Value>(); |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 } // namespace cc | 1161 } // namespace cc |
| OLD | NEW |