OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_OVERLAY_SCROLLBAR_LAYER_H_ | |
6 #define CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "cc/base/cc_export.h" | |
10 #include "cc/input/scrollbar.h" | |
11 #include "cc/layers/layer.h" | |
12 #include "cc/layers/scrollbar_layer_interface.h" | |
13 #include "cc/layers/scrollbar_theme_painter.h" | |
14 #include "cc/resources/scoped_ui_resource.h" | |
15 | |
16 namespace cc { | |
17 | |
18 class CC_EXPORT OverlayScrollbarLayer : public ScrollbarLayerInterface, | |
aelias_OOO_until_Jul13
2017/01/04 03:22:27
What's the planned relationship with SolidColorScr
| |
19 public Layer { | |
20 public: | |
21 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | |
22 | |
23 static scoped_refptr<OverlayScrollbarLayer> Create( | |
24 std::unique_ptr<Scrollbar> scrollbar, | |
25 int scroll_layer_id); | |
26 | |
27 bool OpacityCanAnimateOnImplThread() const override; | |
28 bool AlwaysUseActiveTreeOpacity() const override; | |
29 ScrollbarLayerInterface* ToScrollbarLayer() override; | |
30 | |
31 // ScrollbarLayerInterface | |
32 int ScrollLayerId() const override; | |
33 void SetScrollLayer(int layer_id) override; | |
34 ScrollbarOrientation orientation() const override; | |
35 | |
36 // Layer interface | |
37 bool Update() override; | |
38 void SetLayerTreeHost(LayerTreeHost* host) override; | |
39 void PushPropertiesTo(LayerImpl* layer) override; | |
40 | |
41 protected: | |
42 OverlayScrollbarLayer(std::unique_ptr<Scrollbar> scrollbar, | |
43 int scroll_layer_id); | |
44 ~OverlayScrollbarLayer() override; | |
45 | |
46 private: | |
47 gfx::Rect OriginThumbRectForPainting() const; | |
48 | |
49 template <typename T> | |
50 bool UpdateProperty(T value, T* prop) { | |
51 if (*prop == value) | |
52 return false; | |
53 *prop = value; | |
54 SetNeedsPushProperties(); | |
55 return true; | |
56 } | |
57 | |
58 bool PaintThumbIfNeeded(); | |
59 | |
60 std::unique_ptr<Scrollbar> scrollbar_; | |
61 int scroll_layer_id_; | |
62 | |
63 int thumb_thickness_; | |
64 int thumb_length_; | |
65 gfx::Point location_; | |
66 gfx::Rect track_rect_; | |
67 | |
68 gfx::Rect aperture_; | |
69 | |
70 std::unique_ptr<ScopedUIResource> thumb_resource_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(OverlayScrollbarLayer); | |
73 }; | |
74 | |
75 } // namespace cc | |
76 | |
77 #endif // CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_H_ | |
OLD | NEW |