
This patch adds the CharacterData subclass of Node, which is now the parent class of Text and a new Comment class. A Comment node is one of these in HTML: <!--hello friends--> Since these occur somewhat frequently on the web, we need to be able to parse them. This patch also adds a child rejection mechanism to the DOM tree. Nodes can now override is_child_allowed(Node) and return false if they don't want a particular Node to become a child of theirs. This is used to prevent Document from taking on unwanted children.
16 lines
344 B
C++
16 lines
344 B
C++
#include <LibHTML/DOM/Text.h>
|
|
#include <LibHTML/Layout/LayoutText.h>
|
|
|
|
Text::Text(Document& document, const String& data)
|
|
: CharacterData(document, NodeType::TEXT_NODE, data)
|
|
{
|
|
}
|
|
|
|
Text::~Text()
|
|
{
|
|
}
|
|
|
|
RefPtr<LayoutNode> Text::create_layout_node(const StyleResolver&, const StyleProperties*) const
|
|
{
|
|
return adopt(*new LayoutText(*this));
|
|
}
|