summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/DOM/Text.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-12 23:26:47 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-12 23:34:05 +0200
commitb083a233d8482ed7106d7a102866ee0dd42acc94 (patch)
treed32b52a7cc55fcd66dcaa94bb51f01e4bd04f398 /Libraries/LibHTML/DOM/Text.h
parent6d150df58a0b64c4cb583fc374fd05e60d387dc6 (diff)
downloadserenity-b083a233d8482ed7106d7a102866ee0dd42acc94.zip
LibHTML: Add Comment and CharacterData nodes and improve HTML parsing
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.
Diffstat (limited to 'Libraries/LibHTML/DOM/Text.h')
-rw-r--r--Libraries/LibHTML/DOM/Text.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/Libraries/LibHTML/DOM/Text.h b/Libraries/LibHTML/DOM/Text.h
index c507dbb3ba..30dd7d02c8 100644
--- a/Libraries/LibHTML/DOM/Text.h
+++ b/Libraries/LibHTML/DOM/Text.h
@@ -1,23 +1,17 @@
#pragma once
#include <AK/String.h>
-#include <LibHTML/DOM/Node.h>
+#include <LibHTML/DOM/CharacterData.h>
-class Text final : public Node {
+class Text final : public CharacterData {
public:
explicit Text(Document&, const String&);
virtual ~Text() override;
- const String& data() const { return m_data; }
-
virtual String tag_name() const override { return "#text"; }
- virtual String text_content() const override { return m_data; }
-
private:
virtual RefPtr<LayoutNode> create_layout_node(const StyleResolver&, const StyleProperties* parent_style) const override;
-
- String m_data;
};
template<>