2019-10-04 10:50:04 -03:00
|
|
|
#include <LibHTML/Frame.h>
|
2019-06-15 18:41:15 -03:00
|
|
|
#include <LibHTML/Layout/LayoutDocument.h>
|
2019-06-15 17:49:44 -03:00
|
|
|
|
2019-10-04 07:12:39 -03:00
|
|
|
LayoutDocument::LayoutDocument(const Document& document, NonnullRefPtr<StyleProperties> style_properties)
|
2019-09-21 09:32:17 -03:00
|
|
|
: LayoutBlock(&document, move(style_properties))
|
2019-06-15 17:49:44 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LayoutDocument::~LayoutDocument()
|
|
|
|
|
{
|
|
|
|
|
}
|
2019-06-16 16:35:03 -03:00
|
|
|
|
|
|
|
|
void LayoutDocument::layout()
|
|
|
|
|
{
|
2019-10-04 10:50:04 -03:00
|
|
|
ASSERT(document().frame());
|
|
|
|
|
rect().set_width(document().frame()->size().width());
|
2019-09-25 06:29:25 -03:00
|
|
|
|
2019-06-16 16:35:03 -03:00
|
|
|
LayoutNode::layout();
|
2019-09-25 06:29:25 -03:00
|
|
|
|
|
|
|
|
int lowest_bottom = 0;
|
|
|
|
|
for_each_child([&](auto& child) {
|
|
|
|
|
if (child.rect().bottom() > lowest_bottom)
|
|
|
|
|
lowest_bottom = child.rect().bottom();
|
|
|
|
|
});
|
|
|
|
|
rect().set_bottom(lowest_bottom);
|
2019-06-16 16:35:03 -03:00
|
|
|
}
|