Chromium Code Reviews| Index: cc/layers/viewport.h |
| diff --git a/cc/layers/viewport.h b/cc/layers/viewport.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c842186d4143fb2d9dda2d5ca18f6b42b8cdfa42 |
| --- /dev/null |
| +++ b/cc/layers/viewport.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_LAYERS_VIEWPORT_H_ |
| +#define CC_LAYERS_VIEWPORT_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "cc/layers/layer_impl.h" |
| +#include "ui/gfx/geometry/size.h" |
| +#include "ui/gfx/geometry/vector2d_f.h" |
| + |
| +namespace cc { |
| + |
| +class LayerTreeHostImpl; |
| + |
| +class CC_EXPORT Viewport { |
| + public: |
| + struct ScrollResult { |
| + gfx::Vector2dF applied_delta; |
| + gfx::Vector2dF unused_scroll_delta; |
| + }; |
| + |
| + static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl); |
| + virtual ~Viewport(); |
| + |
| + void SetViewportLayers(LayerImpl* inner_viewport_scroll, |
| + LayerImpl* outer_viewport_scroll); |
| + bool IsViewportLayer(LayerImpl* layer) const; |
| + bool IsViewportScrollingLayer(LayerImpl* layer) const; |
| + |
| + ScrollResult ScrollBy(const gfx::Vector2dF& delta, |
| + const gfx::Point& viewport_point, |
| + bool is_wheel_scroll); |
| + |
| + private: |
| + explicit Viewport(LayerTreeHostImpl* host_impl); |
| + |
| + bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; |
| + gfx::Vector2dF ScrollTopControls(const gfx::Vector2dF& delta); |
| + gfx::Vector2dF ScrollViewport(const gfx::Vector2dF& delta, |
| + const gfx::Point& viewport_point, |
| + bool is_wheel_scroll); |
| + gfx::Vector2dF ScrollLayer(LayerImpl* layer_impl, |
| + const gfx::Vector2dF& delta, |
| + const gfx::Point& viewport_point, |
| + bool is_wheel_scroll); |
| + |
| + gfx::ScrollOffset MaxTotalScrollOffset() const; |
| + gfx::ScrollOffset TotalScrollOffset() const; |
| + |
| + LayerTreeHostImpl* host_impl_; |
| + 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
|
| + LayerImpl* outer_scroll_layer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Viewport); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_LAYERS_VIEWPORT_H_ |