| 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 #ifndef CC_LAYERS_VIEWPORT_H_ | 5 #ifndef CC_LAYERS_VIEWPORT_H_ |
| 6 #define CC_LAYERS_VIEWPORT_H_ | 6 #define CC_LAYERS_VIEWPORT_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
| 10 #include "ui/gfx/geometry/vector2d_f.h" | 10 #include "ui/gfx/geometry/vector2d_f.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class CC_EXPORT Viewport { | 21 class CC_EXPORT Viewport { |
| 22 public: | 22 public: |
| 23 struct ScrollResult { | 23 struct ScrollResult { |
| 24 gfx::Vector2dF applied_delta; | 24 gfx::Vector2dF applied_delta; |
| 25 gfx::Vector2dF unused_scroll_delta; | 25 gfx::Vector2dF unused_scroll_delta; |
| 26 gfx::Vector2dF top_controls_applied_delta; | 26 gfx::Vector2dF top_controls_applied_delta; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl); | 29 static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl); |
| 30 | 30 |
| 31 // Differs from scrolling in that only the visual viewport is moved, without |
| 32 // affecting the top controls or outer viewport. |
| 33 void Pan(const gfx::Vector2dF& delta); |
| 34 |
| 31 // Scrolls the viewport, applying the unique bubbling between the inner and | 35 // Scrolls the viewport, applying the unique bubbling between the inner and |
| 32 // outer viewport. Scrolls can be consumed by top controls. | 36 // outer viewport. Scrolls can be consumed by top controls. |
| 33 ScrollResult ScrollBy(const gfx::Vector2dF& delta, | 37 ScrollResult ScrollBy(const gfx::Vector2dF& delta, |
| 34 const gfx::Point& viewport_point, | 38 const gfx::Point& viewport_point, |
| 35 bool is_wheel_scroll); | 39 bool is_wheel_scroll, |
| 40 bool affect_top_controls); |
| 36 | 41 |
| 37 private: | 42 private: |
| 38 explicit Viewport(LayerTreeHostImpl* host_impl); | 43 explicit Viewport(LayerTreeHostImpl* host_impl); |
| 39 | 44 |
| 40 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; | 45 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; |
| 41 gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const; | 46 gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const; |
| 42 | 47 |
| 43 // Sends the delta to the top controls, returns the amount applied. | 48 // Sends the delta to the top controls, returns the amount applied. |
| 44 gfx::Vector2dF ScrollTopControls(const gfx::Vector2dF& delta); | 49 gfx::Vector2dF ScrollTopControls(const gfx::Vector2dF& delta); |
| 45 | 50 |
| 46 gfx::ScrollOffset MaxTotalScrollOffset() const; | 51 gfx::ScrollOffset MaxTotalScrollOffset() const; |
| 47 gfx::ScrollOffset TotalScrollOffset() const; | 52 gfx::ScrollOffset TotalScrollOffset() const; |
| 48 | 53 |
| 49 LayerImpl* InnerScrollLayer() const; | 54 LayerImpl* InnerScrollLayer() const; |
| 50 LayerImpl* OuterScrollLayer() const; | 55 LayerImpl* OuterScrollLayer() const; |
| 51 | 56 |
| 52 LayerTreeHostImpl* host_impl_; | 57 LayerTreeHostImpl* host_impl_; |
| 53 | 58 |
| 54 DISALLOW_COPY_AND_ASSIGN(Viewport); | 59 DISALLOW_COPY_AND_ASSIGN(Viewport); |
| 55 }; | 60 }; |
| 56 | 61 |
| 57 } // namespace cc | 62 } // namespace cc |
| 58 | 63 |
| 59 #endif // CC_LAYERS_VIEWPORT_H_ | 64 #endif // CC_LAYERS_VIEWPORT_H_ |
| OLD | NEW |