LayoutDocument.cpp 639 B

1234567891011121314151617181920212223242526
  1. #include <LibHTML/Frame.h>
  2. #include <LibHTML/Layout/LayoutDocument.h>
  3. LayoutDocument::LayoutDocument(const Document& document, NonnullRefPtr<StyleProperties> style_properties)
  4. : LayoutBlock(&document, move(style_properties))
  5. {
  6. }
  7. LayoutDocument::~LayoutDocument()
  8. {
  9. }
  10. void LayoutDocument::layout()
  11. {
  12. ASSERT(document().frame());
  13. rect().set_width(document().frame()->size().width());
  14. LayoutNode::layout();
  15. int lowest_bottom = 0;
  16. for_each_child([&](auto& child) {
  17. if (child.rect().bottom() > lowest_bottom)
  18. lowest_bottom = child.rect().bottom();
  19. });
  20. rect().set_bottom(lowest_bottom);
  21. }