ladybird/Libraries/LibHTML/Layout/LayoutListItem.cpp
Andreas Kling 1f9c4ffd21 LibHTML: Make sure the marker has the same inline state as siblings
Or LayoutBlock will assert when trying to layout its children since
they have inconsistent inline state.
2019-10-11 23:26:25 +02:00

26 lines
646 B
C++

#include <LibHTML/Layout/LayoutListItem.h>
#include <LibHTML/Layout/LayoutListItemMarker.h>
LayoutListItem::LayoutListItem(const Element& element, NonnullRefPtr<StyleProperties> style)
: LayoutBlock(&element, move(style))
{
}
LayoutListItem::~LayoutListItem()
{
}
void LayoutListItem::layout()
{
LayoutBlock::layout();
if (!m_marker) {
m_marker = adopt(*new LayoutListItemMarker);
if (first_child())
m_marker->set_inline(first_child()->is_inline());
append_child(*m_marker);
}
Rect marker_rect { rect().x() - 8, rect().y(), 4, rect().height() };
m_marker->set_rect(marker_rect);
}