scrollbar_layer_base.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2019 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. #ifndef CC_LAYERS_SCROLLBAR_LAYER_BASE_H_
  5. #define CC_LAYERS_SCROLLBAR_LAYER_BASE_H_
  6. #include "cc/cc_export.h"
  7. #include "cc/input/scrollbar.h"
  8. #include "cc/layers/layer.h"
  9. namespace cc {
  10. class CC_EXPORT ScrollbarLayerBase : public Layer {
  11. public:
  12. static scoped_refptr<ScrollbarLayerBase> CreateOrReuse(
  13. scoped_refptr<Scrollbar>,
  14. ScrollbarLayerBase* existing_layer);
  15. void SetScrollElementId(ElementId element_id);
  16. ElementId scroll_element_id() const { return scroll_element_id_.Read(*this); }
  17. ScrollbarOrientation orientation() const { return orientation_; }
  18. bool is_left_side_vertical_scrollbar() const {
  19. return is_left_side_vertical_scrollbar_;
  20. }
  21. void PushPropertiesTo(LayerImpl* layer,
  22. const CommitState& commit_state,
  23. const ThreadUnsafeCommitState& unsafe_state) override;
  24. enum ScrollbarLayerType {
  25. kSolidColor,
  26. kPainted,
  27. kPaintedOverlay,
  28. };
  29. virtual ScrollbarLayerType GetScrollbarLayerType() const = 0;
  30. protected:
  31. ScrollbarLayerBase(ScrollbarOrientation orientation,
  32. bool is_left_side_vertical_scrollbar);
  33. ~ScrollbarLayerBase() override;
  34. private:
  35. bool IsScrollbarLayerForTesting() const final;
  36. const ScrollbarOrientation orientation_;
  37. const bool is_left_side_vertical_scrollbar_;
  38. ProtectedSequenceReadable<ElementId> scroll_element_id_;
  39. };
  40. } // namespace cc
  41. #endif // CC_LAYERS_SCROLLBAR_LAYER_BASE_H_