ListItemMarkerBox.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibWeb/Layout/Box.h>
  9. namespace Web::Layout {
  10. class ListItemMarkerBox final : public Box {
  11. public:
  12. explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, size_t index, NonnullRefPtr<CSS::StyleProperties>);
  13. virtual ~ListItemMarkerBox() override;
  14. Gfx::Bitmap const* list_style_image_bitmap() const;
  15. String const& text() const { return m_text; }
  16. virtual RefPtr<Painting::Paintable> create_paintable() const override;
  17. CSS::ListStyleType list_style_type() const { return m_list_style_type; }
  18. private:
  19. virtual bool is_list_item_marker_box() const final { return true; }
  20. virtual bool can_have_children() const override { return false; }
  21. CSS::ListStyleType m_list_style_type { CSS::ListStyleType::None };
  22. size_t m_index;
  23. String m_text {};
  24. };
  25. template<>
  26. inline bool Node::fast_is<ListItemMarkerBox>() const { return is_list_item_marker_box(); }
  27. }