BreakNode.cpp 816 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Layout/BlockContainer.h>
  7. #include <LibWeb/Layout/BreakNode.h>
  8. #include <LibWeb/Layout/InlineFormattingContext.h>
  9. namespace Web::Layout {
  10. BreakNode::BreakNode(DOM::Document& document, HTML::HTMLBRElement& element, NonnullRefPtr<CSS::StyleProperties> style)
  11. : Layout::NodeWithStyleAndBoxModelMetrics(document, &element, move(style))
  12. {
  13. set_inline(true);
  14. }
  15. BreakNode::~BreakNode()
  16. {
  17. }
  18. void BreakNode::split_into_lines(InlineFormattingContext& context, LayoutMode)
  19. {
  20. auto& line_box = context.containing_block().add_line_box();
  21. line_box.add_fragment(*this, 0, 0, 0, context.containing_block().line_height());
  22. }
  23. void BreakNode::paint(PaintContext&, PaintPhase)
  24. {
  25. }
  26. }