| 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 25 matching lines...) Expand all Loading... |
| 36 const gfx::Point& viewport_point, | 36 const gfx::Point& viewport_point, |
| 37 bool is_direct_manipulation, | 37 bool is_direct_manipulation, |
| 38 bool affect_top_controls) { | 38 bool affect_top_controls) { |
| 39 gfx::Vector2dF content_delta = delta; | 39 gfx::Vector2dF content_delta = delta; |
| 40 | 40 |
| 41 if (affect_top_controls && ShouldTopControlsConsumeScroll(delta)) | 41 if (affect_top_controls && ShouldTopControlsConsumeScroll(delta)) |
| 42 content_delta -= ScrollTopControls(delta); | 42 content_delta -= ScrollTopControls(delta); |
| 43 | 43 |
| 44 gfx::Vector2dF pending_content_delta = content_delta; | 44 gfx::Vector2dF pending_content_delta = content_delta; |
| 45 | 45 |
| 46 pending_content_delta -= host_impl_->ScrollLayer(InnerScrollLayer(), | 46 ScrollTree& scroll_tree = |
| 47 pending_content_delta, | 47 host_impl_->active_tree()->property_trees()->scroll_tree; |
| 48 viewport_point, | 48 ScrollNode* inner_node = |
| 49 is_direct_manipulation); | 49 scroll_tree.Node(InnerScrollLayer()->scroll_tree_index()); |
| 50 pending_content_delta -= host_impl_->ScrollSingleNode( |
| 51 inner_node, pending_content_delta, viewport_point, is_direct_manipulation, |
| 52 &scroll_tree); |
| 50 | 53 |
| 51 ScrollResult result; | 54 ScrollResult result; |
| 52 | 55 |
| 53 pending_content_delta -= host_impl_->ScrollLayer(OuterScrollLayer(), | 56 ScrollNode* outer_node = |
| 54 pending_content_delta, | 57 scroll_tree.Node(OuterScrollLayer()->scroll_tree_index()); |
| 55 viewport_point, | 58 pending_content_delta -= host_impl_->ScrollSingleNode( |
| 56 is_direct_manipulation); | 59 outer_node, pending_content_delta, viewport_point, is_direct_manipulation, |
| 60 &scroll_tree); |
| 57 result.consumed_delta = delta - AdjustOverscroll(pending_content_delta); | 61 result.consumed_delta = delta - AdjustOverscroll(pending_content_delta); |
| 58 | 62 |
| 59 result.content_scrolled_delta = content_delta - pending_content_delta; | 63 result.content_scrolled_delta = content_delta - pending_content_delta; |
| 60 return result; | 64 return result; |
| 61 } | 65 } |
| 62 | 66 |
| 63 void Viewport::SnapPinchAnchorIfWithinMargin(const gfx::Point& anchor) { | 67 void Viewport::SnapPinchAnchorIfWithinMargin(const gfx::Point& anchor) { |
| 64 gfx::SizeF viewport_size = gfx::SizeF( | 68 gfx::SizeF viewport_size = gfx::SizeF( |
| 65 host_impl_->active_tree()->InnerViewportContainerLayer()->bounds()); | 69 host_impl_->active_tree()->InnerViewportContainerLayer()->bounds()); |
| 66 | 70 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 177 |
| 174 LayerImpl* Viewport::InnerScrollLayer() const { | 178 LayerImpl* Viewport::InnerScrollLayer() const { |
| 175 return host_impl_->InnerViewportScrollLayer(); | 179 return host_impl_->InnerViewportScrollLayer(); |
| 176 } | 180 } |
| 177 | 181 |
| 178 LayerImpl* Viewport::OuterScrollLayer() const { | 182 LayerImpl* Viewport::OuterScrollLayer() const { |
| 179 return host_impl_->OuterViewportScrollLayer(); | 183 return host_impl_->OuterViewportScrollLayer(); |
| 180 } | 184 } |
| 181 | 185 |
| 182 } // namespace cc | 186 } // namespace cc |
| OLD | NEW |