Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3604)

Unified Diff: cc/layers/viewport.h

Issue 986443003: Move viewport scrolling logic into separate class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/cc.gyp ('k') | cc/layers/viewport.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « cc/cc.gyp ('k') | cc/layers/viewport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698