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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 virtual ~PaintedScrollbarLayer(); | 52 virtual ~PaintedScrollbarLayer(); |
53 | 53 |
54 // For unit tests | 54 // For unit tests |
55 UIResourceId track_resource_id() { | 55 UIResourceId track_resource_id() { |
56 return track_resource_.get() ? track_resource_->id() : 0; | 56 return track_resource_.get() ? track_resource_->id() : 0; |
57 } | 57 } |
58 UIResourceId thumb_resource_id() { | 58 UIResourceId thumb_resource_id() { |
59 return thumb_resource_.get() ? thumb_resource_->id() : 0; | 59 return thumb_resource_.get() ? thumb_resource_->id() : 0; |
60 } | 60 } |
61 void UpdateThumbAndTrackGeometry(); | 61 void UpdateThumbAndTrackGeometry(); |
| 62 void ReleaseThumbAndTrackUIResourcesIfNecessary(); |
62 | 63 |
63 private: | 64 private: |
64 gfx::Rect ScrollbarLayerRectToContentRect(const gfx::Rect& layer_rect) const; | 65 gfx::Rect ScrollbarLayerRectToContentRect(const gfx::Rect& layer_rect) const; |
65 gfx::Rect OriginThumbRect() const; | 66 gfx::Rect OriginThumbRect() const; |
66 | 67 |
67 template<typename T> void UpdateProperty(T value, T* prop) { | 68 template<typename T> void UpdateProperty(T value, T* prop) { |
68 if (*prop == value) | 69 if (*prop == value) |
69 return; | 70 return; |
70 *prop = value; | 71 *prop = value; |
71 SetNeedsPushProperties(); | 72 SetNeedsPushProperties(); |
(...skipping 21 matching lines...) Expand all Loading... |
93 | 94 |
94 scoped_ptr<ScopedUIResource> track_resource_; | 95 scoped_ptr<ScopedUIResource> track_resource_; |
95 scoped_ptr<ScopedUIResource> thumb_resource_; | 96 scoped_ptr<ScopedUIResource> thumb_resource_; |
96 | 97 |
97 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); | 98 DISALLOW_COPY_AND_ASSIGN(PaintedScrollbarLayer); |
98 }; | 99 }; |
99 | 100 |
100 } // namespace cc | 101 } // namespace cc |
101 | 102 |
102 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ | 103 #endif // CC_LAYERS_PAINTED_SCROLLBAR_LAYER_H_ |
OLD | NEW |