LayoutReplaced.cpp 690 B

123456789101112131415161718192021222324
  1. #include <LibHTML/DOM/Element.h>
  2. #include <LibHTML/Layout/LayoutBlock.h>
  3. #include <LibHTML/Layout/LayoutReplaced.h>
  4. LayoutReplaced::LayoutReplaced(const Element& element, NonnullRefPtr<StyleProperties> style)
  5. : LayoutBox(&element, move(style))
  6. {
  7. // FIXME: Allow non-inline replaced elements.
  8. set_inline(true);
  9. }
  10. LayoutReplaced::~LayoutReplaced()
  11. {
  12. }
  13. void LayoutReplaced::split_into_lines(LayoutBlock& container)
  14. {
  15. layout();
  16. auto* line_box = &container.ensure_last_line_box();
  17. if (line_box->width() > 0 && line_box->width() + width() > container.width())
  18. line_box = &container.add_line_box();
  19. line_box->add_fragment(*this, 0, 0, width(), height());
  20. }