Chromium Code Reviews| Index: cc/layers/overlay_scrollbar_layer.h |
| diff --git a/cc/layers/overlay_scrollbar_layer.h b/cc/layers/overlay_scrollbar_layer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e0be157f88c4bd7ffa03ee5c730e7745b75b5f66 |
| --- /dev/null |
| +++ b/cc/layers/overlay_scrollbar_layer.h |
| @@ -0,0 +1,77 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_H_ |
| +#define CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "cc/base/cc_export.h" |
| +#include "cc/input/scrollbar.h" |
| +#include "cc/layers/layer.h" |
| +#include "cc/layers/scrollbar_layer_interface.h" |
| +#include "cc/layers/scrollbar_theme_painter.h" |
| +#include "cc/resources/scoped_ui_resource.h" |
| + |
| +namespace cc { |
| + |
| +class CC_EXPORT OverlayScrollbarLayer : public ScrollbarLayerInterface, |
|
aelias_OOO_until_Jul13
2017/01/04 03:22:27
What's the planned relationship with SolidColorScr
|
| + public Layer { |
| + public: |
| + std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| + |
| + static scoped_refptr<OverlayScrollbarLayer> Create( |
| + std::unique_ptr<Scrollbar> scrollbar, |
| + int scroll_layer_id); |
| + |
| + bool OpacityCanAnimateOnImplThread() const override; |
| + bool AlwaysUseActiveTreeOpacity() const override; |
| + ScrollbarLayerInterface* ToScrollbarLayer() override; |
| + |
| + // ScrollbarLayerInterface |
| + int ScrollLayerId() const override; |
| + void SetScrollLayer(int layer_id) override; |
| + ScrollbarOrientation orientation() const override; |
| + |
| + // Layer interface |
| + bool Update() override; |
| + void SetLayerTreeHost(LayerTreeHost* host) override; |
| + void PushPropertiesTo(LayerImpl* layer) override; |
| + |
| + protected: |
| + OverlayScrollbarLayer(std::unique_ptr<Scrollbar> scrollbar, |
| + int scroll_layer_id); |
| + ~OverlayScrollbarLayer() override; |
| + |
| + private: |
| + gfx::Rect OriginThumbRectForPainting() const; |
| + |
| + template <typename T> |
| + bool UpdateProperty(T value, T* prop) { |
| + if (*prop == value) |
| + return false; |
| + *prop = value; |
| + SetNeedsPushProperties(); |
| + return true; |
| + } |
| + |
| + bool PaintThumbIfNeeded(); |
| + |
| + std::unique_ptr<Scrollbar> scrollbar_; |
| + int scroll_layer_id_; |
| + |
| + int thumb_thickness_; |
| + int thumb_length_; |
| + gfx::Point location_; |
| + gfx::Rect track_rect_; |
| + |
| + gfx::Rect aperture_; |
| + |
| + std::unique_ptr<ScopedUIResource> thumb_resource_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(OverlayScrollbarLayer); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_LAYERS_OVERLAY_SCROLLBAR_LAYER_H_ |