BreakNode.h 830 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/HTML/HTMLBRElement.h>
  8. #include <LibWeb/Layout/Node.h>
  9. namespace Web::Layout {
  10. class BreakNode final : public NodeWithStyleAndBoxModelMetrics {
  11. JS_CELL(BreakNode, NodeWithStyleAndBoxModelMetrics);
  12. public:
  13. BreakNode(DOM::Document&, HTML::HTMLBRElement&, NonnullRefPtr<CSS::StyleProperties>);
  14. virtual ~BreakNode() override;
  15. const HTML::HTMLBRElement& dom_node() const { return verify_cast<HTML::HTMLBRElement>(*Node::dom_node()); }
  16. private:
  17. virtual bool is_break_node() const final { return true; }
  18. virtual bool can_have_children() const override { return false; }
  19. };
  20. template<>
  21. inline bool Node::fast_is<BreakNode>() const { return is_break_node(); }
  22. }