2019-10-05 22:07:45 +02:00
|
|
|
#include <LibHTML/DOM/Element.h>
|
2019-10-05 23:20:35 +02:00
|
|
|
#include <LibHTML/Layout/LayoutBlock.h>
|
2019-10-05 22:07:45 +02:00
|
|
|
#include <LibHTML/Layout/LayoutReplaced.h>
|
|
|
|
|
|
|
|
LayoutReplaced::LayoutReplaced(const Element& element, NonnullRefPtr<StyleProperties> style)
|
2019-10-15 16:48:38 +02:00
|
|
|
: LayoutBox(&element, move(style))
|
2019-10-05 22:07:45 +02:00
|
|
|
{
|
|
|
|
// FIXME: Allow non-inline replaced elements.
|
|
|
|
set_inline(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
LayoutReplaced::~LayoutReplaced()
|
|
|
|
{
|
|
|
|
}
|
2019-10-05 23:20:35 +02:00
|
|
|
|
|
|
|
void LayoutReplaced::split_into_lines(LayoutBlock& container)
|
|
|
|
{
|
|
|
|
layout();
|
|
|
|
|
2019-10-13 17:24:00 +02:00
|
|
|
auto* line_box = &container.ensure_last_line_box();
|
2019-10-19 09:44:40 +02:00
|
|
|
if (line_box->width() > 0 && line_box->width() + width() > container.width())
|
2019-10-13 17:24:00 +02:00
|
|
|
line_box = &container.add_line_box();
|
|
|
|
line_box->add_fragment(*this, 0, 0, width(), height());
|
2019-10-05 23:20:35 +02:00
|
|
|
}
|