27 : owner_document_(document), node_type_(type) {
37 for (
auto& child : children_)
38 tracer->
Trace(&child);
39 tracer->
Trace(&owner_document_);
40 tracer->
Trace(&parent_);
48 return owner_document_;
56 return std::vector<RefPtr<Node>>(children_.begin(), children_.end());
60 return children_.empty() ?
nullptr : children_.front();
64 return children_.empty() ?
nullptr : children_.back();
71 if (new_child->parent_node()) {
72 new_child->parent_node()->RemoveChild(new_child);
75 new_child->parent_ =
this;
76 children_.emplace_back(new_child);
83 CHECK_EQ(to_remove->parent_node(),
this);
85 to_remove->parent_ =
nullptr;
106 AddConstant(
"DOCUMENT_POSITION_DISCONNECTED",
111 AddConstant(
"DOCUMENT_POSITION_CONTAINED_BY",
113 AddConstant(
"DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC",
129 NotImplemented(
"parentElement");
130 NotImplemented(
"previousSibling");
131 NotImplemented(
"nextSibling");
133 NotImplemented(
"hasChildNodes");
134 NotImplemented(
"getRootNode");
135 NotImplemented(
"normalize");
136 NotImplemented(
"contains");
138 NotImplemented(
"insertBefore");
139 NotImplemented(
"replaceChild");
141 NotImplemented(
"isConnected");
142 NotImplemented(
"baseURI");
144 NotImplemented(
"cloneNode");
145 NotImplemented(
"compareDocumentPosition");
146 NotImplemented(
"lookupPrefix");
147 NotImplemented(
"isDefaultNamespace");
148 NotImplemented(
"isEqualNode");
149 NotImplemented(
"isSameNode");
RefPtr< Node > RemoveChild(RefPtr< Node > to_remove)
NodeType node_type() const
RefPtr< Node > first_child() const
RefPtr< Node > last_child() const
RefPtr< Document > document() const
void Trace(const Traceable *ptr)
bool IsShortLived() const override
void Trace(memory::HeapTracer *tracer) const override
void RemoveElement(List *list, Elem &&elem)
virtual optional< std::string > TextContent() const =0
virtual optional< std::string > NodeValue() const =0
std::vector< RefPtr< Node > > child_nodes() const
RefPtr< Node > AppendChild(RefPtr< Node > new_child)
Node(NodeType type, RefPtr< Document > document)
RefPtr< Node > parent_node() const
virtual std::string node_name() const =0
void Trace(memory::HeapTracer *tracer) const override