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

Side by Side 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, 9 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
OLDNEW
(Empty)
1 // 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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_LAYERS_VIEWPORT_H_
6 #define CC_LAYERS_VIEWPORT_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #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.
10 #include "cc/layers/layer_impl.h"
11 #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.
12 #include "ui/gfx/geometry/vector2d_f.h"
13
14 namespace cc {
15
16 class LayerTreeHostImpl;
17
18 // 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.
19 // of two layers, the inner viewport (visual) and the outer viewport (layout).
20 // These layers have different scroll bubbling behavior from the rest of the
21 // layer tree which is encoded in this class.
22 class CC_EXPORT Viewport {
23 public:
24 struct ScrollResult {
25 ScrollResult() : did_scroll_top_controls(false) {}
26 gfx::Vector2dF applied_delta;
27 gfx::Vector2dF unused_scroll_delta;
28 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.
29 };
30
31 static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl);
32
33 // Scrolls the viewport, applying the unique bubbling between the inner and
34 // outer viewport. Scrolls can be consumed by top controls.
35 ScrollResult ScrollBy(const gfx::Vector2dF& delta,
36 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
37 bool is_wheel_scroll);
38
39 private:
40 explicit Viewport(LayerTreeHostImpl* host_impl);
41
42 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const;
43 gfx::Vector2dF AdjustOverscroll(const gfx::Vector2dF& delta) const;
44
45 // Sends the delta to the top controls, returns the amount applied.
46 gfx::Vector2dF ScrollTopControls(const gfx::Vector2dF& delta);
47
48 gfx::ScrollOffset MaxTotalScrollOffset() const;
49 gfx::ScrollOffset TotalScrollOffset() const;
50
51 LayerImpl* InnerScrollLayer() const;
52 LayerImpl* OuterScrollLayer() const;
53
54 LayerTreeHostImpl* host_impl_;
55 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.
56 LayerImpl* outer_scroll_layer_;
57
58 DISALLOW_COPY_AND_ASSIGN(Viewport);
59 };
60
61 } // namespace cc
62
63 #endif // CC_LAYERS_VIEWPORT_H_
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/layers/viewport.cc » ('j') | cc/layers/viewport.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698