mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:28:11 +00:00
LibHTML: Add LayoutNode classes for "display: list-item" and its marker
This patch removes the hard-coded hack for "display: list-item" from LayoutBlock and adds LayoutListItem and LayoutListItemMarker. Elements with "display: list-item" now generate a LayoutListItem, which may then also generate a LayoutListItemMarker if appropriate. :^)
This commit is contained in:
parent
d3d972820e
commit
f5bf8f6380
7 changed files with 81 additions and 13 deletions
24
Libraries/LibHTML/Layout/LayoutListItem.cpp
Normal file
24
Libraries/LibHTML/Layout/LayoutListItem.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#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);
|
||||
prepend_child(*m_marker);
|
||||
}
|
||||
|
||||
Rect marker_rect { rect().x() - 8, rect().y(), 4, rect().height() };
|
||||
m_marker->set_rect(marker_rect);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue