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 "base/values.h" | 9 #include "base/values.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 return; | 208 return; |
209 | 209 |
210 sent_scroll_delta_ = sent_scroll_delta; | 210 sent_scroll_delta_ = sent_scroll_delta; |
211 } | 211 } |
212 | 212 |
213 gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) { | 213 gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) { |
214 gfx::Vector2dF min_delta = -scroll_offset_; | 214 gfx::Vector2dF min_delta = -scroll_offset_; |
215 gfx::Vector2dF max_delta = max_scroll_offset_ - scroll_offset_; | 215 gfx::Vector2dF max_delta = max_scroll_offset_ - scroll_offset_; |
216 // Clamp new_delta so that position + delta stays within scroll bounds. | 216 // Clamp new_delta so that position + delta stays within scroll bounds. |
217 gfx::Vector2dF new_delta = (scroll_delta_ + scroll); | 217 gfx::Vector2dF new_delta = (scroll_delta_ + scroll); |
218 new_delta.ClampToMin(min_delta); | 218 new_delta.ClampToLowerBound(min_delta); |
219 new_delta.ClampToMax(max_delta); | 219 new_delta.ClampToUpperBound(max_delta); |
220 gfx::Vector2dF unscrolled = scroll_delta_ + scroll - new_delta; | 220 gfx::Vector2dF unscrolled = scroll_delta_ + scroll - new_delta; |
221 | 221 |
222 SetScrollDelta(new_delta); | 222 SetScrollDelta(new_delta); |
223 return unscrolled; | 223 return unscrolled; |
224 } | 224 } |
225 | 225 |
226 InputHandlerClient::ScrollStatus LayerImpl::TryScroll( | 226 InputHandlerClient::ScrollStatus LayerImpl::TryScroll( |
227 gfx::PointF screen_space_point, | 227 gfx::PointF screen_space_point, |
228 InputHandlerClient::ScrollInputType type) const { | 228 InputHandlerClient::ScrollInputType type) const { |
229 if (should_scroll_on_main_thread()) { | 229 if (should_scroll_on_main_thread()) { |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 dict->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); | 963 dict->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); |
964 } | 964 } |
965 | 965 |
966 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 966 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
967 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 967 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
968 AsValueInto(state.get()); | 968 AsValueInto(state.get()); |
969 return state.PassAs<base::Value>(); | 969 return state.PassAs<base::Value>(); |
970 } | 970 } |
971 | 971 |
972 } // namespace cc | 972 } // namespace cc |
OLD | NEW |