BreakNode.h 852 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.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. JS_DECLARE_ALLOCATOR(BreakNode);
  13. public:
  14. BreakNode(DOM::Document&, HTML::HTMLBRElement&, CSS::StyleProperties);
  15. virtual ~BreakNode() override;
  16. const HTML::HTMLBRElement& dom_node() const { return verify_cast<HTML::HTMLBRElement>(*Node::dom_node()); }
  17. private:
  18. virtual bool is_break_node() const final { return true; }
  19. virtual bool can_have_children() const override { return false; }
  20. };
  21. template<>
  22. inline bool Node::fast_is<BreakNode>() const { return is_break_node(); }
  23. }