BreakNode.cpp 732 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Layout/BlockBox.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)
  11. : Layout::NodeWithStyleAndBoxModelMetrics(document, &element, CSS::StyleProperties::create())
  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. }