ListItemMarkerBox.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. String const& text() const { return m_text; }
  15. virtual RefPtr<Painting::Paintable> create_paintable() const override;
  16. CSS::ListStyleType list_style_type() const { return m_list_style_type; }
  17. private:
  18. virtual bool is_list_item_marker_box() const final { return true; }
  19. virtual bool can_have_children() const override { return false; }
  20. CSS::ListStyleType m_list_style_type { CSS::ListStyleType::None };
  21. size_t m_index;
  22. String m_text {};
  23. };
  24. template<>
  25. inline bool Node::fast_is<ListItemMarkerBox>() const { return is_list_item_marker_box(); }
  26. }