#include #include #include LayoutNode::LayoutNode(const Node* node, const StyledNode* styled_node) : m_node(node) , m_styled_node(styled_node) { } LayoutNode::~LayoutNode() { } void LayoutNode::layout() { for_each_child([](auto& child) { child.layout(); }); } const LayoutBlock* LayoutNode::containing_block() const { for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) { if (ancestor->is_block()) return static_cast(ancestor); } return nullptr; }