ladybird/Libraries/LibHTML/Layout/LayoutDocument.cpp
Andreas Kling 7bc9310170 LibHTML: Add a Frame class and use it for document layout width
Each HtmlView now has a main_frame(), which represents the main frame
of the web page. Frame inherits from TreeNode<Frame>, which will allow
us to someday implement a Frame tree (to support the <frame> element.)
2019-10-04 15:50:04 +02:00

26 lines
639 B
C++

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