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

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

Issue 2388563002: Clean up viewport scrolling methods in CC (Closed)
Patch Set: Fix tests Created 4 years, 2 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 | « cc/input/input_handler.h ('k') | 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 <memory> 8 #include <memory>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 30 matching lines...) Expand all
41 // affecting the top controls or outer viewport. 41 // affecting the top controls or outer viewport.
42 void Pan(const gfx::Vector2dF& delta); 42 void Pan(const gfx::Vector2dF& delta);
43 43
44 // Scrolls the viewport, applying the unique bubbling between the inner and 44 // Scrolls the viewport, applying the unique bubbling between the inner and
45 // outer viewport. Scrolls can be consumed by top controls. 45 // outer viewport. Scrolls can be consumed by top controls.
46 ScrollResult ScrollBy(const gfx::Vector2dF& delta, 46 ScrollResult ScrollBy(const gfx::Vector2dF& delta,
47 const gfx::Point& viewport_point, 47 const gfx::Point& viewport_point,
48 bool is_wheel_scroll, 48 bool is_wheel_scroll,
49 bool affect_top_controls); 49 bool affect_top_controls);
50 50
51 // Scrolls the viewport. Unlike the above method, scrolls the inner before
52 // the outer viewport. Doesn't affect top controls or return a result since
53 // callers don't need it.
54 void ScrollByInnerFirst(const gfx::Vector2dF& delta);
55
51 // Scrolls the viewport, bubbling the delta between the inner and outer 56 // Scrolls the viewport, bubbling the delta between the inner and outer
52 // viewport. Only animates either of the two viewports. 57 // viewport. Only animates either of the two viewports.
53 gfx::Vector2dF ScrollAnimated(const gfx::Vector2dF& delta, 58 gfx::Vector2dF ScrollAnimated(const gfx::Vector2dF& delta,
54 base::TimeDelta delayed_by); 59 base::TimeDelta delayed_by);
55 60
56 void PinchUpdate(float magnify_delta, const gfx::Point& anchor); 61 void PinchUpdate(float magnify_delta, const gfx::Point& anchor);
57 void PinchEnd(); 62 void PinchEnd();
58 63
64 // Returns the "representative" viewport layer. That is, the one that's set
65 // as the currently scrolling layer when the viewport scrolls and the one used
66 // in the scrolling code to indicate scrolling should happen via this class.
67 LayerImpl* MainScrollLayer() const;
68
59 private: 69 private:
60 explicit Viewport(LayerTreeHostImpl* host_impl); 70 explicit Viewport(LayerTreeHostImpl* host_impl);
61 71
62 // Returns true if viewport_delta is stricly less than pending_delta. 72 // Returns true if viewport_delta is stricly less than pending_delta.
63 static bool ShouldAnimateViewport(const gfx::Vector2dF& viewport_delta, 73 static bool ShouldAnimateViewport(const gfx::Vector2dF& viewport_delta,
64 const gfx::Vector2dF& pending_delta); 74 const gfx::Vector2dF& pending_delta);
65 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; 75 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const;
66 gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const; 76 gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const;
67 77
68 // Sends the delta to the top controls, returns the amount applied. 78 // Sends the delta to the top controls, returns the amount applied.
(...skipping 16 matching lines...) Expand all
85 gfx::Vector2d pinch_anchor_adjustment_; 95 gfx::Vector2d pinch_anchor_adjustment_;
86 96
87 FRIEND_TEST_ALL_PREFIXES(ViewportTest, ShouldAnimateViewport); 97 FRIEND_TEST_ALL_PREFIXES(ViewportTest, ShouldAnimateViewport);
88 98
89 DISALLOW_COPY_AND_ASSIGN(Viewport); 99 DISALLOW_COPY_AND_ASSIGN(Viewport);
90 }; 100 };
91 101
92 } // namespace cc 102 } // namespace cc
93 103
94 #endif // CC_LAYERS_VIEWPORT_H_ 104 #endif // CC_LAYERS_VIEWPORT_H_
OLDNEW
« no previous file with comments | « cc/input/input_handler.h ('k') | cc/layers/viewport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698