OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/viewport.h" | 5 #include "cc/layers/viewport.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/input/top_controls_manager.h" | 8 #include "cc/input/top_controls_manager.h" |
9 #include "cc/trees/layer_tree_host_impl.h" | 9 #include "cc/trees/layer_tree_host_impl.h" |
10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 if (scroll_delta.y() < 0) | 143 if (scroll_delta.y() < 0) |
144 return true; | 144 return true; |
145 | 145 |
146 if (TotalScrollOffset().y() < MaxTotalScrollOffset().y()) | 146 if (TotalScrollOffset().y() < MaxTotalScrollOffset().y()) |
147 return true; | 147 return true; |
148 | 148 |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 gfx::Vector2dF Viewport::AdjustOverscroll(const gfx::Vector2dF& delta) const { | 152 gfx::Vector2dF Viewport::AdjustOverscroll(const gfx::Vector2dF& delta) const { |
| 153 // TODO(tdresser): Use a more rational epsilon. See crbug.com/510550 for |
| 154 // details. |
153 const float kEpsilon = 0.1f; | 155 const float kEpsilon = 0.1f; |
154 gfx::Vector2dF adjusted = delta; | 156 gfx::Vector2dF adjusted = delta; |
155 | 157 |
156 if (std::abs(adjusted.x()) < kEpsilon) | 158 if (std::abs(adjusted.x()) < kEpsilon) |
157 adjusted.set_x(0.0f); | 159 adjusted.set_x(0.0f); |
158 if (std::abs(adjusted.y()) < kEpsilon) | 160 if (std::abs(adjusted.y()) < kEpsilon) |
159 adjusted.set_y(0.0f); | 161 adjusted.set_y(0.0f); |
160 | 162 |
161 return adjusted; | 163 return adjusted; |
162 } | 164 } |
(...skipping 22 matching lines...) Expand all Loading... |
185 | 187 |
186 LayerImpl* Viewport::InnerScrollLayer() const { | 188 LayerImpl* Viewport::InnerScrollLayer() const { |
187 return host_impl_->InnerViewportScrollLayer(); | 189 return host_impl_->InnerViewportScrollLayer(); |
188 } | 190 } |
189 | 191 |
190 LayerImpl* Viewport::OuterScrollLayer() const { | 192 LayerImpl* Viewport::OuterScrollLayer() const { |
191 return host_impl_->OuterViewportScrollLayer(); | 193 return host_impl_->OuterViewportScrollLayer(); |
192 } | 194 } |
193 | 195 |
194 } // namespace cc | 196 } // namespace cc |
OLD | NEW |