Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_LAYERS_VIEWPORT_H_ | |
| 6 #define CC_LAYERS_VIEWPORT_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "cc/layers/layer_impl.h" | |
| 11 #include "ui/gfx/geometry/size.h" | |
| 12 #include "ui/gfx/geometry/vector2d_f.h" | |
| 13 | |
| 14 namespace cc { | |
| 15 | |
| 16 class LayerTreeHostImpl; | |
| 17 | |
| 18 class CC_EXPORT Viewport { | |
| 19 public: | |
| 20 struct ScrollResult { | |
| 21 gfx::Vector2dF applied_delta; | |
| 22 gfx::Vector2dF unused_scroll_delta; | |
| 23 }; | |
| 24 | |
| 25 static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl); | |
| 26 virtual ~Viewport(); | |
| 27 | |
| 28 void SetViewportLayers(LayerImpl* inner_viewport_scroll, | |
| 29 LayerImpl* outer_viewport_scroll); | |
| 30 bool IsViewportLayer(LayerImpl* layer) const; | |
| 31 bool IsViewportScrollingLayer(LayerImpl* layer) const; | |
| 32 | |
| 33 ScrollResult ScrollBy(const gfx::Vector2dF& delta, | |
| 34 const gfx::Point& viewport_point, | |
| 35 bool is_wheel_scroll); | |
| 36 | |
| 37 private: | |
| 38 explicit Viewport(LayerTreeHostImpl* host_impl); | |
| 39 | |
| 40 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; | |
| 41 gfx::Vector2dF ScrollTopControls(const gfx::Vector2dF& delta); | |
| 42 gfx::Vector2dF ScrollViewport(const gfx::Vector2dF& delta, | |
| 43 const gfx::Point& viewport_point, | |
| 44 bool is_wheel_scroll); | |
| 45 gfx::Vector2dF ScrollLayer(LayerImpl* layer_impl, | |
| 46 const gfx::Vector2dF& delta, | |
| 47 const gfx::Point& viewport_point, | |
| 48 bool is_wheel_scroll); | |
| 49 | |
| 50 gfx::ScrollOffset MaxTotalScrollOffset() const; | |
| 51 gfx::ScrollOffset TotalScrollOffset() const; | |
| 52 | |
| 53 LayerTreeHostImpl* host_impl_; | |
| 54 LayerImpl* inner_scroll_layer_; | |
|
aelias_OOO_until_Jul13
2015/03/06 04:19:37
I'd rather this call out to the active tree every
| |
| 55 LayerImpl* outer_scroll_layer_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(Viewport); | |
| 58 }; | |
| 59 | |
| 60 } // namespace cc | |
| 61 | |
| 62 #endif // CC_LAYERS_VIEWPORT_H_ | |
| OLD | NEW |