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

LibHTML: Add basic <!DOCTYPE> parsing and a DocumentType class

Plus, Document::fixup() will now make sure that the document always
starts with a doctype node, followed by an <html> element.
This commit is contained in:
Andreas Kling 2019-10-09 20:17:01 +02:00
parent 850955053f
commit fc53867937
9 changed files with 84 additions and 6 deletions

View file

@ -11,6 +11,7 @@ enum class NodeType : unsigned {
ELEMENT_NODE = 1,
TEXT_NODE = 3,
DOCUMENT_NODE = 9,
DOCUMENT_TYPE_NODE = 10,
};
class Document;
@ -30,9 +31,10 @@ public:
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_document_type() const { return type() == NodeType::DOCUMENT_TYPE_NODE; }
bool is_parent_node() const { return is_element() || is_document(); }
virtual RefPtr<LayoutNode> create_layout_node(const StyleResolver&, const StyleProperties* parent_style) const = 0;
virtual RefPtr<LayoutNode> create_layout_node(const StyleResolver&, const StyleProperties* parent_style) const;
RefPtr<LayoutNode> create_layout_tree(const StyleResolver&, const StyleProperties* parent_style) const;
virtual String tag_name() const = 0;