#pragma once #include #include #include #include enum class NodeType : unsigned { INVALID = 0, ELEMENT_NODE = 1, TEXT_NODE = 3, DOCUMENT_NODE = 9, }; class ParentNode; class LayoutNode; class StyleResolver; class StyleProperties; class Node : public TreeNode { public: virtual ~Node(); NodeType type() const { return m_type; } bool is_element() const { return type() == NodeType::ELEMENT_NODE; } bool is_text() const { return type() == NodeType::TEXT_NODE; } bool is_document() const { return type() == NodeType::DOCUMENT_NODE; } bool is_parent_node() const { return is_element() || is_document(); } RefPtr create_layout_node(const StyleResolver&, const StyleProperties* parent_properties) const; RefPtr create_layout_tree(const StyleResolver&, const StyleProperties* parent_properties) const; protected: explicit Node(NodeType); NodeType m_type { NodeType::INVALID }; };