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

Side by Side Diff: cc/layers/viewport.h

Issue 1227823005: Revert of Cleanup viewport scrolling for future scroll customization work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/layers/viewport.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class LayerTreeHostImpl; 14 class LayerTreeHostImpl;
15 15
16 // Encapsulates gesture handling logic on the viewport layers. The "viewport" 16 // Encapsulates gesture handling logic on the viewport layers. The "viewport"
17 // is made up of two scrolling layers, the inner viewport (visual) and the 17 // is made up of two scrolling layers, the inner viewport (visual) and the
18 // outer viewport (layout) scroll layers. These layers have different scroll 18 // outer viewport (layout) scroll layers. These layers have different scroll
19 // bubbling behavior from the rest of the layer tree which is encoded in this 19 // bubbling behavior from the rest of the layer tree which is encoded in this
20 // class. 20 // class.
21 class CC_EXPORT Viewport { 21 class CC_EXPORT Viewport {
22 public: 22 public:
23 // If the pinch zoom anchor on the first PinchUpdate is within this length 23 // If the pinch zoom anchor on the first PinchUpdate is within this length
24 // of the screen edge, "snap" the zoom to that edge. Experimentally 24 // of the screen edge, "snap" the zoom to that edge. Experimentally
25 // determined. 25 // determined.
26 static const int kPinchZoomSnapMarginDips = 100; 26 static const int kPinchZoomSnapMarginDips = 100;
27 27
28 struct ScrollResult {
29 gfx::Vector2dF applied_delta;
30 gfx::Vector2dF unused_scroll_delta;
31 gfx::Vector2dF top_controls_applied_delta;
32 };
33
28 static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl); 34 static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl);
29 35
30 // Differs from scrolling in that only the visual viewport is moved, without 36 // Differs from scrolling in that only the visual viewport is moved, without
31 // affecting the top controls or outer viewport. 37 // affecting the top controls or outer viewport.
32 void Pan(const gfx::Vector2dF& delta); 38 void Pan(const gfx::Vector2dF& delta);
33 39
34 // Scrolls the viewport, applying the unique bubbling between the inner and 40 // Scrolls the viewport, applying the unique bubbling between the inner and
35 // outer viewport. Scrolls can be consumed by top controls. 41 // outer viewport. Scrolls can be consumed by top controls.
36 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& delta, 42 ScrollResult ScrollBy(const gfx::Vector2dF& delta,
37 const gfx::Point& viewport_point, 43 const gfx::Point& viewport_point,
38 bool is_direct_manipulation, 44 bool is_wheel_scroll,
39 bool affect_top_controls); 45 bool affect_top_controls);
40 46
41 void PinchUpdate(float magnify_delta, const gfx::Point& anchor); 47 void PinchUpdate(float magnify_delta, const gfx::Point& anchor);
42 void PinchEnd(); 48 void PinchEnd();
43 49
44 private: 50 private:
45 explicit Viewport(LayerTreeHostImpl* host_impl); 51 explicit Viewport(LayerTreeHostImpl* host_impl);
46 52
47 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; 53 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const;
48 gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const; 54 gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const;
49 55
(...skipping 15 matching lines...) Expand all
65 // The pinch zoom anchor point is adjusted by this amount during a pinch. This 71 // The pinch zoom anchor point is adjusted by this amount during a pinch. This
66 // is used to "snap" a pinch-zoom to the edge of the screen. 72 // is used to "snap" a pinch-zoom to the edge of the screen.
67 gfx::Vector2d pinch_anchor_adjustment_; 73 gfx::Vector2d pinch_anchor_adjustment_;
68 74
69 DISALLOW_COPY_AND_ASSIGN(Viewport); 75 DISALLOW_COPY_AND_ASSIGN(Viewport);
70 }; 76 };
71 77
72 } // namespace cc 78 } // namespace cc
73 79
74 #endif // CC_LAYERS_VIEWPORT_H_ 80 #endif // CC_LAYERS_VIEWPORT_H_
OLDNEW
« no previous file with comments | « no previous file | cc/layers/viewport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698