summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Layout/LayoutDocument.cpp
blob: 4fc43aca315309d1c3647de71db7a4cdb5396c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <LibHTML/Frame.h>
#include <LibHTML/Layout/LayoutDocument.h>

LayoutDocument::LayoutDocument(const Document& document, NonnullRefPtr<StyleProperties> style_properties)
    : LayoutBlock(&document, move(style_properties))
{
}

LayoutDocument::~LayoutDocument()
{
}

void LayoutDocument::layout()
{
    ASSERT(document().frame());
    rect().set_width(document().frame()->size().width());

    LayoutNode::layout();

    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);
}