| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 viewport_point, | 60 viewport_point, |
| 61 is_direct_manipulation); | 61 is_direct_manipulation); |
| 62 result.consumed_delta = delta - AdjustOverscroll(pending_content_delta); | 62 result.consumed_delta = delta - AdjustOverscroll(pending_content_delta); |
| 63 } | 63 } |
| 64 | 64 |
| 65 result.content_scrolled_delta = content_delta - pending_content_delta; | 65 result.content_scrolled_delta = content_delta - pending_content_delta; |
| 66 return result; | 66 return result; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void Viewport::SnapPinchAnchorIfWithinMargin(const gfx::Point& anchor) { | 69 void Viewport::SnapPinchAnchorIfWithinMargin(const gfx::Point& anchor) { |
| 70 gfx::SizeF viewport_size = | 70 gfx::SizeF viewport_size = gfx::SizeF( |
| 71 host_impl_->active_tree()->InnerViewportContainerLayer()->bounds(); | 71 host_impl_->active_tree()->InnerViewportContainerLayer()->bounds()); |
| 72 | 72 |
| 73 if (anchor.x() < kPinchZoomSnapMarginDips) | 73 if (anchor.x() < kPinchZoomSnapMarginDips) |
| 74 pinch_anchor_adjustment_.set_x(-anchor.x()); | 74 pinch_anchor_adjustment_.set_x(-anchor.x()); |
| 75 else if (anchor.x() > viewport_size.width() - kPinchZoomSnapMarginDips) | 75 else if (anchor.x() > viewport_size.width() - kPinchZoomSnapMarginDips) |
| 76 pinch_anchor_adjustment_.set_x(viewport_size.width() - anchor.x()); | 76 pinch_anchor_adjustment_.set_x(viewport_size.width() - anchor.x()); |
| 77 | 77 |
| 78 if (anchor.y() < kPinchZoomSnapMarginDips) | 78 if (anchor.y() < kPinchZoomSnapMarginDips) |
| 79 pinch_anchor_adjustment_.set_y(-anchor.y()); | 79 pinch_anchor_adjustment_.set_y(-anchor.y()); |
| 80 else if (anchor.y() > viewport_size.height() - kPinchZoomSnapMarginDips) | 80 else if (anchor.y() > viewport_size.height() - kPinchZoomSnapMarginDips) |
| 81 pinch_anchor_adjustment_.set_y(viewport_size.height() - anchor.y()); | 81 pinch_anchor_adjustment_.set_y(viewport_size.height() - anchor.y()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 LayerImpl* Viewport::InnerScrollLayer() const { | 180 LayerImpl* Viewport::InnerScrollLayer() const { |
| 181 return host_impl_->InnerViewportScrollLayer(); | 181 return host_impl_->InnerViewportScrollLayer(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 LayerImpl* Viewport::OuterScrollLayer() const { | 184 LayerImpl* Viewport::OuterScrollLayer() const { |
| 185 return host_impl_->OuterViewportScrollLayer(); | 185 return host_impl_->OuterViewportScrollLayer(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace cc | 188 } // namespace cc |
| OLD | NEW |