Index: cc/layers/viewport.h |
diff --git a/cc/layers/viewport.h b/cc/layers/viewport.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f552b8270c9d347cef5ed4ed517d763e0ca1f728 |
--- /dev/null |
+++ b/cc/layers/viewport.h |
@@ -0,0 +1,63 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
aelias_OOO_until_Jul13
2015/03/25 19:56:07
Nit: 2015
bokan
2015/03/25 20:38:34
Done.
|
+// 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" |
aelias_OOO_until_Jul13
2015/03/25 19:56:07
This looks unused, please delete
bokan
2015/03/25 20:38:35
Done.
|
+#include "cc/layers/layer_impl.h" |
+#include "ui/gfx/geometry/size.h" |
aelias_OOO_until_Jul13
2015/03/25 19:56:07
This looks unused, please delete
bokan
2015/03/25 20:38:35
Done.
|
+#include "ui/gfx/geometry/vector2d_f.h" |
+ |
+namespace cc { |
+ |
+class LayerTreeHostImpl; |
+ |
+// Encapsulates the Layers that comprise the viewport. The "viewport" is made up |
aelias_OOO_until_Jul13
2015/03/25 19:56:07
It would be more accurate to write "Encapsulates g
bokan
2015/03/25 20:38:35
Done.
|
+// of two layers, the inner viewport (visual) and the outer viewport (layout). |
+// These layers have different scroll bubbling behavior from the rest of the |
+// layer tree which is encoded in this class. |
+class CC_EXPORT Viewport { |
+ public: |
+ struct ScrollResult { |
+ ScrollResult() : did_scroll_top_controls(false) {} |
+ gfx::Vector2dF applied_delta; |
+ gfx::Vector2dF unused_scroll_delta; |
+ bool did_scroll_top_controls; |
aelias_OOO_until_Jul13
2015/03/25 19:56:07
I think in this struct, it would be more natural t
bokan
2015/03/25 20:38:35
Done.
|
+ }; |
+ |
+ static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl); |
+ |
+ // Scrolls the viewport, applying the unique bubbling between the inner and |
+ // outer viewport. Scrolls can be consumed by top controls. |
+ ScrollResult ScrollBy(const gfx::Vector2dF& delta, |
+ const gfx::Point& viewport_point, |
aelias_OOO_until_Jul13
2015/03/25 19:56:07
Indent wrong, please run "git cl format"
bokan
2015/03/25 20:38:35
It seems to do nothing for me, maybe because I've
|
+ bool is_wheel_scroll); |
+ |
+ private: |
+ explicit Viewport(LayerTreeHostImpl* host_impl); |
+ |
+ bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; |
+ gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const; |
+ |
+ // Sends the delta to the top controls, returns the amount applied. |
+ gfx::Vector2dF ScrollTopControls(const gfx::Vector2dF& delta); |
+ |
+ gfx::ScrollOffset MaxTotalScrollOffset() const; |
+ gfx::ScrollOffset TotalScrollOffset() const; |
+ |
+ LayerImpl* InnerScrollLayer() const; |
+ LayerImpl* OuterScrollLayer() const; |
+ |
+ LayerTreeHostImpl* host_impl_; |
+ LayerImpl* inner_scroll_layer_; |
aelias_OOO_until_Jul13
2015/03/25 19:56:07
Looks like you deleted all use of these but not th
bokan
2015/03/25 20:38:35
Done.
|
+ LayerImpl* outer_scroll_layer_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(Viewport); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_LAYERS_VIEWPORT_H_ |