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

Side by Side Diff: cc/input/layer_scroll_offset_delegate.h

Issue 256303006: Make LayerScrollOffsetDelegate updates consistent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ 5 #ifndef CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_
6 #define CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ 6 #define CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ui/gfx/size_f.h" 9 #include "ui/gfx/size_f.h"
10 #include "ui/gfx/vector2d_f.h" 10 #include "ui/gfx/vector2d_f.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of 14 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of
15 // the scroll offset of the root layer. 15 // the scroll offset of the root layer.
16 // 16 //
17 // The LayerScrollOffsetDelegate is only used on the impl thread. 17 // The LayerScrollOffsetDelegate is only used on the impl thread.
18 class LayerScrollOffsetDelegate { 18 class LayerScrollOffsetDelegate {
19 public: 19 public:
20 // This is called by the compositor to notify the delegate what is the upper
21 // total scroll offset bound.
22 virtual void SetMaxScrollOffset(const gfx::Vector2dF& max_scroll_offset) = 0;
23
24 // This is called by the compositor when the scroll offset of the layer would 20 // This is called by the compositor when the scroll offset of the layer would
25 // have otherwise changed. 21 // have otherwise changed.
26 virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) = 0; 22 virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) = 0;
27 23
28 // This is called by the compositor to query the current scroll offset of the 24 // This is called by the compositor to query the current scroll offset of the
29 // layer. 25 // layer.
30 // There is no requirement that the return values of this method are 26 // There is no requirement that the return values of this method are
31 // stable in time (two subsequent calls may yield different results). 27 // stable in time (two subsequent calls may yield different results).
32 // The return value is not required to be related to the values passed in to 28 // The return value is not required to be related to the values passed in to
33 // the SetTotalScrollOffset method in any way however it is required to be no 29 // the SetTotalScrollOffset method in any way however it is required to be no
34 // more than the value passed to the most recent SetMaxScrollOffset call. 30 // more than the value passed to the most recent SetMaxScrollOffset call.
35 virtual gfx::Vector2dF GetTotalScrollOffset() = 0; 31 virtual gfx::Vector2dF GetTotalScrollOffset() = 0;
36 32
37 // This is called by the compositor to check whether a delegate-managed fling 33 // This is called by the compositor to check whether a delegate-managed fling
38 // is active or not. 34 // is active or not.
39 virtual bool IsExternalFlingActive() const = 0; 35 virtual bool IsExternalFlingActive() const = 0;
40 36
41 // This is called by the compositor to notify the delegate what is the current 37 // This is called by the compositor to notify the delegate of any change to
42 // page scale factor and limits are. 38 // the following parameters:
43 virtual void SetTotalPageScaleFactorAndLimits( 39 // |total_scroll_offset| current scroll offset of the root layer,
44 float page_scale_factor, 40 // |max_scroll_offset| total scroll offset upper bound for the root layer,
45 float min_page_scale_factor, 41 // |scrollable_size| root layer scrollable size,
46 float max_page_scale_factor) = 0; 42 // |page_scale_factor| current page scale,
47 43 // |min_page_scale_factor| page scale lower limit,
48 // This is called by the compositor to notify the delegate what is the layer's 44 // |max_page_scale_factor| page scale upper limit.
49 // scrollable size is. 45 //
50 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) = 0; 46 // The total_scroll_offset can also be separately updated by the
47 // SetTotalScrollOffset method for efficiency.
48 virtual void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset,
49 const gfx::Vector2dF& max_scroll_offset,
50 const gfx::SizeF& scrollable_size,
51 float page_scale_factor,
52 float min_page_scale_factor,
53 float max_page_scale_factor) = 0;
51 54
52 protected: 55 protected:
53 LayerScrollOffsetDelegate() {} 56 LayerScrollOffsetDelegate() {}
54 virtual ~LayerScrollOffsetDelegate() {} 57 virtual ~LayerScrollOffsetDelegate() {}
55 58
56 private: 59 private:
57 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate); 60 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate);
58 }; 61 };
59 62
60 } // namespace cc 63 } // namespace cc
61 64
62 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ 65 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698