OLD | NEW |
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_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 6 #define CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
7 | 7 |
8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
9 #include "cc/input/scrollbar.h" | 9 #include "cc/input/scrollbar.h" |
10 #include "cc/layers/contents_scaling_layer.h" | 10 #include "cc/layers/contents_scaling_layer.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // For unit tests | 55 // For unit tests |
56 UIResourceId track_resource_id() { | 56 UIResourceId track_resource_id() { |
57 return track_resource_.get() ? track_resource_->id() : 0; | 57 return track_resource_.get() ? track_resource_->id() : 0; |
58 } | 58 } |
59 UIResourceId thumb_resource_id() { | 59 UIResourceId thumb_resource_id() { |
60 return thumb_resource_.get() ? thumb_resource_->id() : 0; | 60 return thumb_resource_.get() ? thumb_resource_->id() : 0; |
61 } | 61 } |
62 void UpdateThumbAndTrackGeometry(); | 62 void UpdateThumbAndTrackGeometry(); |
63 | 63 |
64 private: | 64 private: |
65 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const; | 65 gfx::Rect ScrollbarLayerRectToContentRect(const gfx::Rect& layer_rect) const; |
66 gfx::Rect OriginThumbRect() const; | 66 gfx::Rect OriginThumbRect() const; |
67 | 67 |
68 template<typename T> void UpdateProperty(T value, T* prop) { | 68 template<typename T> void UpdateProperty(T value, T* prop) { |
69 if (*prop == value) | 69 if (*prop == value) |
70 return; | 70 return; |
71 *prop = value; | 71 *prop = value; |
72 SetNeedsPushProperties(); | 72 SetNeedsPushProperties(); |
73 } | 73 } |
74 | 74 |
75 int MaxTextureSize(); | 75 int MaxTextureSize(); |
76 float ClampScaleToMaxTextureSize(float scale); | 76 float ClampScaleToMaxTextureSize(float scale); |
77 | 77 |
78 UIResourceBitmap RasterizeScrollbarPart(gfx::Rect rect, | 78 UIResourceBitmap RasterizeScrollbarPart(const gfx::Rect& rect, |
79 ScrollbarPart part); | 79 ScrollbarPart part); |
80 | 80 |
81 scoped_ptr<Scrollbar> scrollbar_; | 81 scoped_ptr<Scrollbar> scrollbar_; |
82 int scroll_layer_id_; | 82 int scroll_layer_id_; |
83 | 83 |
84 // Snapshot of properties taken in UpdateThumbAndTrackGeometry and used in | 84 // Snapshot of properties taken in UpdateThumbAndTrackGeometry and used in |
85 // PushPropertiesTo. | 85 // PushPropertiesTo. |
86 int thumb_thickness_; | 86 int thumb_thickness_; |
87 int thumb_length_; | 87 int thumb_length_; |
88 gfx::Point location_; | 88 gfx::Point location_; |
89 gfx::Rect track_rect_; | 89 gfx::Rect track_rect_; |
90 bool is_overlay_; | 90 bool is_overlay_; |
91 bool has_thumb_; | 91 bool has_thumb_; |
92 | 92 |
93 scoped_ptr<ScopedUIResource> track_resource_; | 93 scoped_ptr<ScopedUIResource> track_resource_; |
94 scoped_ptr<ScopedUIResource> thumb_resource_; | 94 scoped_ptr<ScopedUIResource> thumb_resource_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); | 96 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace cc | 99 } // namespace cc |
100 | 100 |
101 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 101 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
OLD | NEW |