1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:25:06 +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:
Andreas Kling 2019-10-11 23:16:53 +02:00
parent d3d972820e
commit f5bf8f6380
7 changed files with 81 additions and 13 deletions

View file

@ -2,6 +2,7 @@
#include <LibHTML/DOM/Element.h>
#include <LibHTML/Layout/LayoutBlock.h>
#include <LibHTML/Layout/LayoutInline.h>
#include <LibHTML/Layout/LayoutListItem.h>
Element::Element(Document& document, const String& tag_name)
: ParentNode(document, NodeType::ELEMENT_NODE)
@ -78,10 +79,12 @@ RefPtr<LayoutNode> Element::create_layout_node(const StyleResolver& resolver, co
if (display == "none")
return nullptr;
if (display == "block" || display == "list-item")
if (display == "block")
return adopt(*new LayoutBlock(this, move(style)));
if (display == "inline")
return adopt(*new LayoutInline(*this, move(style)));
if (display == "list-item")
return adopt(*new LayoutListItem(*this, move(style)));
ASSERT_NOT_REACHED();
}