mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 00:56:14 +00:00
LibWeb: Implement <template> parsing
Note that there is currently no way to display them as we can't currently clone nodes. Adds special case for templates for dumping to console. Doesn't add it to the DOM inspector as I'm not sure how to do it.
This commit is contained in:
@@ -167,6 +167,13 @@ public:
|
||||
|
||||
void set_focused_element(Element*);
|
||||
|
||||
bool created_for_appropriate_template_contents() const { return m_created_for_appropriate_template_contents; }
|
||||
void set_created_for_appropriate_template_contents(bool value) { m_created_for_appropriate_template_contents = value; }
|
||||
|
||||
Document* associated_inert_template_document() { return m_associated_inert_template_document; }
|
||||
const Document* associated_inert_template_document() const { return m_associated_inert_template_document; }
|
||||
void set_associated_inert_template_document(Document& document) { m_associated_inert_template_document = document; }
|
||||
|
||||
private:
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override;
|
||||
|
||||
@@ -199,6 +206,9 @@ private:
|
||||
bool m_editable { false };
|
||||
|
||||
WeakPtr<Element> m_focused_element;
|
||||
|
||||
bool m_created_for_appropriate_template_contents { false };
|
||||
RefPtr<Document> m_associated_inert_template_document;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/DOM/NonElementParentNode.h>
|
||||
#include <LibWeb/DOM/ParentNode.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
@@ -36,10 +37,20 @@ class DocumentFragment
|
||||
: public ParentNode
|
||||
, public NonElementParentNode<DocumentFragment> {
|
||||
public:
|
||||
DocumentFragment(Document& document);
|
||||
using WrapperType = Bindings::DocumentFragmentWrapper;
|
||||
|
||||
explicit DocumentFragment(Document& document);
|
||||
virtual ~DocumentFragment() override;
|
||||
|
||||
virtual FlyString node_name() const override { return "#document-fragment"; }
|
||||
|
||||
Element& host() { return *m_host; }
|
||||
const Element& host() const { return *m_host; }
|
||||
|
||||
void set_host(Element& host) { m_host = host; }
|
||||
|
||||
private:
|
||||
RefPtr<Element> m_host;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user