1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:38:12 +00:00

LibHTML: Add LayoutNodeWithStyle class, make LayoutText style-less

Since LayoutText always inherits style, it shouldn't store any style of
its own. This patch adds a LayoutNodeWithStyle class to sit between
LayoutNode and everyone who wants to inherit from LayoutNode except
LayoutText :^)

Since LayoutText can never have children, we also know that the parent
of any LayoutNode is always going to be a LayoutNodeWithStyle.
So this patch makes LayoutNode::parent() return LayoutNodeWithStyle*.
This commit is contained in:
Andreas Kling 2019-10-07 09:50:31 +02:00
parent 15f3e64862
commit 749e3f0f30
9 changed files with 46 additions and 17 deletions

View file

@ -7,9 +7,8 @@
//#define DRAW_BOXES_AROUND_LAYOUT_NODES
//#define DRAW_BOXES_AROUND_HOVERED_NODES
LayoutNode::LayoutNode(const Node* node, RefPtr<StyleProperties> style)
LayoutNode::LayoutNode(const Node* node)
: m_node(node)
, m_style(move(style))
{
if (m_node)
m_node->set_layout_node({}, this);