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

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

Issue 18341009: Refactor cc scrollbar layers to separate solid-color vs desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments; plumb scrollbar color via flag. Created 7 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_
6 #define CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_
7
8 #include "cc/base/cc_export.h"
9 #include "cc/input/scrollbar.h"
10 #include "cc/layers/layer_impl.h"
11
12 namespace cc {
13
14 class LayerTreeImpl;
15
16 class CC_EXPORT ScrollbarLayerImplBase : public LayerImpl {
17 public:
18 int ScrollLayerId() const { return scroll_layer_id_; }
19 void set_scroll_layer_id(int id) { scroll_layer_id_ = id; }
20
21 float current_pos() const { return current_pos_; }
22 void SetCurrentPos(float current_pos);
23 int maximum() const { return maximum_; }
24 void SetMaximum(int maximum);
25
26 void set_visible_to_total_length_ratio(float ratio) {
27 visible_to_total_length_ratio_ = ratio;
28 }
29
30 void SetVerticalAdjust(float vertical_adjust);
31
32 bool is_overlay_scrollbar() const { return is_overlay_scrollbar_; }
33 void set_is_overlay_scrollbar(bool is_overlay) {
34 is_overlay_scrollbar_ = is_overlay;
35 }
36
37 ScrollbarOrientation orientation() const { return orientation_; }
38
39 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
40 virtual ScrollbarLayerImplBase* ToScrollbarLayer() OVERRIDE;
41
42 void SetVisibleToTotalLengthRatio(float ratio);
43 virtual gfx::Rect ComputeThumbQuadRect() const;
44
45 protected:
46 ScrollbarLayerImplBase(LayerTreeImpl* tree_impl,
47 int id,
48 ScrollbarOrientation orientation);
49 virtual ~ScrollbarLayerImplBase() {}
50
51 gfx::Rect ScrollbarLayerRectToContentRect(gfx::RectF layer_rect) const;
52
53 float visible_to_total_length_ratio() const {
54 return visible_to_total_length_ratio_;
55 }
56 float vertical_adjust() const { return vertical_adjust_; }
57
58 virtual int ThumbThickness() const = 0;
59 virtual int ThumbLength() const = 0;
60 virtual float TrackLength() const = 0;
61 virtual int TrackStart() const = 0;
62
63 private:
64 int scroll_layer_id_;
65 bool is_overlay_scrollbar_;
66
67 float current_pos_;
68 int maximum_;
69 ScrollbarOrientation orientation_;
70
71 // Difference between the clip layer's height and the visible viewport
72 // height (which may differ in the presence of top-controls hiding).
73 float vertical_adjust_;
74
75 float visible_to_total_length_ratio_;
76
77 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayerImplBase);
78 };
79
80 } // namespace cc
81
82 #endif // CC_LAYERS_SCROLLBAR_LAYER_IMPL_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698