Node.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. /*
  2. * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Badge.h>
  8. #include <AK/DeprecatedString.h>
  9. #include <AK/JsonObjectSerializer.h>
  10. #include <AK/RefPtr.h>
  11. #include <AK/TypeCasts.h>
  12. #include <AK/Vector.h>
  13. #include <LibWeb/DOM/ARIARoleNames.h>
  14. #include <LibWeb/DOM/AccessibilityTreeNode.h>
  15. #include <LibWeb/DOM/EventTarget.h>
  16. #include <LibWeb/DOMParsing/XMLSerializer.h>
  17. #include <LibWeb/WebIDL/ExceptionOr.h>
  18. namespace Web::DOM {
  19. enum class NodeType : u16 {
  20. INVALID = 0,
  21. ELEMENT_NODE = 1,
  22. ATTRIBUTE_NODE = 2,
  23. TEXT_NODE = 3,
  24. CDATA_SECTION_NODE = 4,
  25. ENTITY_REFERENCE_NODE = 5,
  26. ENTITY_NODE = 6,
  27. PROCESSING_INSTRUCTION_NODE = 7,
  28. COMMENT_NODE = 8,
  29. DOCUMENT_NODE = 9,
  30. DOCUMENT_TYPE_NODE = 10,
  31. DOCUMENT_FRAGMENT_NODE = 11,
  32. NOTATION_NODE = 12
  33. };
  34. struct GetRootNodeOptions {
  35. bool composed { false };
  36. };
  37. class Node : public EventTarget {
  38. WEB_PLATFORM_OBJECT(Node, EventTarget);
  39. public:
  40. ParentNode* parent_or_shadow_host();
  41. ParentNode const* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); }
  42. Element* parent_or_shadow_host_element();
  43. Element const* parent_or_shadow_host_element() const { return const_cast<Node*>(this)->parent_or_shadow_host_element(); }
  44. virtual ~Node();
  45. // FIXME: Move cleanup to the regular destructor.
  46. void removed_last_ref();
  47. NodeType type() const { return m_type; }
  48. bool is_element() const { return type() == NodeType::ELEMENT_NODE; }
  49. bool is_text() const { return type() == NodeType::TEXT_NODE; }
  50. bool is_document() const { return type() == NodeType::DOCUMENT_NODE; }
  51. bool is_document_type() const { return type() == NodeType::DOCUMENT_TYPE_NODE; }
  52. bool is_comment() const { return type() == NodeType::COMMENT_NODE; }
  53. bool is_character_data() const { return type() == NodeType::TEXT_NODE || type() == NodeType::COMMENT_NODE; }
  54. bool is_document_fragment() const { return type() == NodeType::DOCUMENT_FRAGMENT_NODE; }
  55. bool is_parent_node() const { return is_element() || is_document() || is_document_fragment(); }
  56. bool is_slottable() const { return is_element() || is_text(); }
  57. bool is_attribute() const { return type() == NodeType::ATTRIBUTE_NODE; }
  58. bool is_cdata_section() const { return type() == NodeType::CDATA_SECTION_NODE; }
  59. virtual bool is_shadow_root() const { return false; }
  60. virtual bool requires_svg_container() const { return false; }
  61. virtual bool is_svg_container() const { return false; }
  62. virtual bool is_svg_svg_element() const { return false; }
  63. bool in_a_document_tree() const;
  64. // NOTE: This is intended for the JS bindings.
  65. u16 node_type() const { return (u16)m_type; }
  66. virtual bool is_editable() const;
  67. virtual bool is_html_element() const { return false; }
  68. virtual bool is_html_html_element() const { return false; }
  69. virtual bool is_html_anchor_element() const { return false; }
  70. virtual bool is_html_base_element() const { return false; }
  71. virtual bool is_html_template_element() const { return false; }
  72. virtual bool is_browsing_context_container() const { return false; }
  73. WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> pre_insert(JS::NonnullGCPtr<Node>, JS::GCPtr<Node>);
  74. WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> pre_remove(JS::NonnullGCPtr<Node>);
  75. WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> append_child(JS::NonnullGCPtr<Node>);
  76. WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> remove_child(JS::NonnullGCPtr<Node>);
  77. void insert_before(JS::NonnullGCPtr<Node> node, JS::GCPtr<Node> child, bool suppress_observers = false);
  78. void remove(bool suppress_observers = false);
  79. void remove_all_children(bool suppress_observers = false);
  80. u16 compare_document_position(JS::GCPtr<Node> other);
  81. WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> replace_child(JS::NonnullGCPtr<Node> node, JS::NonnullGCPtr<Node> child);
  82. JS::NonnullGCPtr<Node> clone_node(Document* document = nullptr, bool clone_children = false);
  83. WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> clone_node_binding(bool deep);
  84. // NOTE: This is intended for the JS bindings.
  85. bool has_child_nodes() const { return has_children(); }
  86. JS::NonnullGCPtr<NodeList> child_nodes();
  87. Vector<JS::Handle<Node>> children_as_vector() const;
  88. virtual FlyString node_name() const = 0;
  89. DeprecatedString base_uri() const;
  90. DeprecatedString descendant_text_content() const;
  91. DeprecatedString text_content() const;
  92. void set_text_content(DeprecatedString const&);
  93. DeprecatedString node_value() const;
  94. void set_node_value(DeprecatedString const&);
  95. Document& document() { return *m_document; }
  96. Document const& document() const { return *m_document; }
  97. JS::GCPtr<Document> owner_document() const;
  98. const HTML::HTMLAnchorElement* enclosing_link_element() const;
  99. const HTML::HTMLElement* enclosing_html_element() const;
  100. const HTML::HTMLElement* enclosing_html_element_with_attribute(FlyString const&) const;
  101. DeprecatedString child_text_content() const;
  102. Node& root();
  103. Node const& root() const
  104. {
  105. return const_cast<Node*>(this)->root();
  106. }
  107. Node& shadow_including_root();
  108. Node const& shadow_including_root() const
  109. {
  110. return const_cast<Node*>(this)->shadow_including_root();
  111. }
  112. bool is_connected() const;
  113. Node* parent_node() { return parent(); }
  114. Node const* parent_node() const { return parent(); }
  115. Element* parent_element();
  116. Element const* parent_element() const;
  117. virtual void inserted();
  118. virtual void removed_from(Node*) { }
  119. virtual void children_changed() { }
  120. virtual void adopted_from(Document&) { }
  121. virtual void cloned(Node&, bool) {};
  122. Layout::Node const* layout_node() const { return m_layout_node; }
  123. Layout::Node* layout_node() { return m_layout_node; }
  124. Painting::PaintableBox const* paint_box() const;
  125. Painting::Paintable const* paintable() const;
  126. void set_layout_node(Badge<Layout::Node>, JS::NonnullGCPtr<Layout::Node>);
  127. void detach_layout_node(Badge<DOM::Document>);
  128. virtual bool is_child_allowed(Node const&) const { return true; }
  129. bool needs_style_update() const { return m_needs_style_update; }
  130. void set_needs_style_update(bool);
  131. bool child_needs_style_update() const { return m_child_needs_style_update; }
  132. void set_child_needs_style_update(bool b) { m_child_needs_style_update = b; }
  133. void invalidate_style();
  134. void set_document(Badge<Document>, Document&);
  135. virtual EventTarget* get_parent(Event const&) override;
  136. template<typename T>
  137. bool fast_is() const = delete;
  138. WebIDL::ExceptionOr<void> ensure_pre_insertion_validity(JS::NonnullGCPtr<Node> node, JS::GCPtr<Node> child) const;
  139. bool is_host_including_inclusive_ancestor_of(Node const&) const;
  140. bool is_scripting_enabled() const;
  141. bool is_scripting_disabled() const;
  142. bool contains(JS::GCPtr<Node>) const;
  143. // Used for dumping the DOM Tree
  144. void serialize_tree_as_json(JsonObjectSerializer<StringBuilder>&) const;
  145. bool is_shadow_including_descendant_of(Node const&) const;
  146. bool is_shadow_including_inclusive_descendant_of(Node const&) const;
  147. bool is_shadow_including_ancestor_of(Node const&) const;
  148. bool is_shadow_including_inclusive_ancestor_of(Node const&) const;
  149. i32 id() const { return m_id; }
  150. static Node* from_id(i32 node_id);
  151. WebIDL::ExceptionOr<DeprecatedString> serialize_fragment(DOMParsing::RequireWellFormed) const;
  152. void replace_all(JS::GCPtr<Node>);
  153. void string_replace_all(DeprecatedString const&);
  154. bool is_same_node(Node const*) const;
  155. bool is_equal_node(Node const*) const;
  156. JS::NonnullGCPtr<Node> get_root_node(GetRootNodeOptions const& options = {});
  157. bool is_uninteresting_whitespace_node() const;
  158. DeprecatedString debug_description() const;
  159. size_t length() const;
  160. auto& registered_observers_list() { return m_registered_observer_list; }
  161. auto const& registered_observers_list() const { return m_registered_observer_list; }
  162. void add_registered_observer(RegisteredObserver& registered_observer) { m_registered_observer_list.append(registered_observer); }
  163. void queue_mutation_record(FlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling);
  164. // https://dom.spec.whatwg.org/#concept-shadow-including-descendant
  165. template<typename Callback>
  166. IterationDecision for_each_shadow_including_descendant(Callback);
  167. Node* parent() { return m_parent.ptr(); }
  168. Node const* parent() const { return m_parent.ptr(); }
  169. bool has_children() const { return m_first_child; }
  170. Node* next_sibling() { return m_next_sibling.ptr(); }
  171. Node* previous_sibling() { return m_previous_sibling.ptr(); }
  172. Node* first_child() { return m_first_child.ptr(); }
  173. Node* last_child() { return m_last_child.ptr(); }
  174. Node const* next_sibling() const { return m_next_sibling.ptr(); }
  175. Node const* previous_sibling() const { return m_previous_sibling.ptr(); }
  176. Node const* first_child() const { return m_first_child.ptr(); }
  177. Node const* last_child() const { return m_last_child.ptr(); }
  178. size_t child_count() const
  179. {
  180. size_t count = 0;
  181. for (auto* child = first_child(); child; child = child->next_sibling())
  182. ++count;
  183. return count;
  184. }
  185. Node* child_at_index(int index)
  186. {
  187. int count = 0;
  188. for (auto* child = first_child(); child; child = child->next_sibling()) {
  189. if (count == index)
  190. return child;
  191. ++count;
  192. }
  193. return nullptr;
  194. }
  195. Node const* child_at_index(int index) const
  196. {
  197. return const_cast<Node*>(this)->child_at_index(index);
  198. }
  199. // https://dom.spec.whatwg.org/#concept-tree-index
  200. size_t index() const
  201. {
  202. // The index of an object is its number of preceding siblings, or 0 if it has none.
  203. size_t index = 0;
  204. for (auto* node = previous_sibling(); node; node = node->previous_sibling())
  205. ++index;
  206. return index;
  207. }
  208. Optional<size_t> index_of_child(Node const& search_child)
  209. {
  210. VERIFY(search_child.parent() == this);
  211. size_t index = 0;
  212. auto* child = first_child();
  213. VERIFY(child);
  214. do {
  215. if (child == &search_child)
  216. return index;
  217. index++;
  218. } while (child && (child = child->next_sibling()));
  219. return {};
  220. }
  221. template<typename ChildType>
  222. Optional<size_t> index_of_child(Node const& search_child)
  223. {
  224. VERIFY(search_child.parent() == this);
  225. size_t index = 0;
  226. auto* child = first_child();
  227. VERIFY(child);
  228. do {
  229. if (!is<ChildType>(child))
  230. continue;
  231. if (child == &search_child)
  232. return index;
  233. index++;
  234. } while (child && (child = child->next_sibling()));
  235. return {};
  236. }
  237. bool is_ancestor_of(Node const&) const;
  238. bool is_inclusive_ancestor_of(Node const&) const;
  239. bool is_descendant_of(Node const&) const;
  240. bool is_inclusive_descendant_of(Node const&) const;
  241. bool is_following(Node const&) const;
  242. void prepend_child(JS::NonnullGCPtr<Node> node);
  243. Node* next_in_pre_order()
  244. {
  245. if (first_child())
  246. return first_child();
  247. Node* node;
  248. if (!(node = next_sibling())) {
  249. node = parent();
  250. while (node && !node->next_sibling())
  251. node = node->parent();
  252. if (node)
  253. node = node->next_sibling();
  254. }
  255. return node;
  256. }
  257. Node* next_in_pre_order(Node const* stay_within)
  258. {
  259. if (first_child())
  260. return first_child();
  261. Node* node = static_cast<Node*>(this);
  262. Node* next = nullptr;
  263. while (!(next = node->next_sibling())) {
  264. node = node->parent();
  265. if (!node || node == stay_within)
  266. return nullptr;
  267. }
  268. return next;
  269. }
  270. Node const* next_in_pre_order() const
  271. {
  272. return const_cast<Node*>(this)->next_in_pre_order();
  273. }
  274. Node const* next_in_pre_order(Node const* stay_within) const
  275. {
  276. return const_cast<Node*>(this)->next_in_pre_order(stay_within);
  277. }
  278. Node* previous_in_pre_order()
  279. {
  280. if (auto* node = previous_sibling()) {
  281. while (node->last_child())
  282. node = node->last_child();
  283. return node;
  284. }
  285. return parent();
  286. }
  287. Node const* previous_in_pre_order() const
  288. {
  289. return const_cast<Node*>(this)->previous_in_pre_order();
  290. }
  291. bool is_before(Node const& other) const
  292. {
  293. if (this == &other)
  294. return false;
  295. for (auto* node = this; node; node = node->next_in_pre_order()) {
  296. if (node == &other)
  297. return true;
  298. }
  299. return false;
  300. }
  301. // https://dom.spec.whatwg.org/#concept-tree-preceding (Object A is 'typename U' and Object B is 'this')
  302. template<typename U>
  303. bool has_preceding_node_of_type_in_tree_order() const
  304. {
  305. for (auto* node = previous_in_pre_order(); node; node = node->previous_in_pre_order()) {
  306. if (is<U>(node))
  307. return true;
  308. }
  309. return false;
  310. }
  311. // https://dom.spec.whatwg.org/#concept-tree-following (Object A is 'typename U' and Object B is 'this')
  312. template<typename U>
  313. bool has_following_node_of_type_in_tree_order() const
  314. {
  315. for (auto* node = next_in_pre_order(); node; node = node->next_in_pre_order()) {
  316. if (is<U>(node))
  317. return true;
  318. }
  319. return false;
  320. }
  321. template<typename Callback>
  322. IterationDecision for_each_in_inclusive_subtree(Callback callback) const
  323. {
  324. if (callback(static_cast<Node const&>(*this)) == IterationDecision::Break)
  325. return IterationDecision::Break;
  326. for (auto* child = first_child(); child; child = child->next_sibling()) {
  327. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  328. return IterationDecision::Break;
  329. }
  330. return IterationDecision::Continue;
  331. }
  332. template<typename Callback>
  333. IterationDecision for_each_in_inclusive_subtree(Callback callback)
  334. {
  335. if (callback(static_cast<Node&>(*this)) == IterationDecision::Break)
  336. return IterationDecision::Break;
  337. for (auto* child = first_child(); child; child = child->next_sibling()) {
  338. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  339. return IterationDecision::Break;
  340. }
  341. return IterationDecision::Continue;
  342. }
  343. template<typename U, typename Callback>
  344. IterationDecision for_each_in_inclusive_subtree_of_type(Callback callback)
  345. {
  346. if (is<U>(static_cast<Node const&>(*this))) {
  347. if (callback(static_cast<U&>(*this)) == IterationDecision::Break)
  348. return IterationDecision::Break;
  349. }
  350. for (auto* child = first_child(); child; child = child->next_sibling()) {
  351. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  352. return IterationDecision::Break;
  353. }
  354. return IterationDecision::Continue;
  355. }
  356. template<typename U, typename Callback>
  357. IterationDecision for_each_in_inclusive_subtree_of_type(Callback callback) const
  358. {
  359. if (is<U>(static_cast<Node const&>(*this))) {
  360. if (callback(static_cast<U const&>(*this)) == IterationDecision::Break)
  361. return IterationDecision::Break;
  362. }
  363. for (auto* child = first_child(); child; child = child->next_sibling()) {
  364. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  365. return IterationDecision::Break;
  366. }
  367. return IterationDecision::Continue;
  368. }
  369. template<typename Callback>
  370. IterationDecision for_each_in_subtree(Callback callback) const
  371. {
  372. for (auto* child = first_child(); child; child = child->next_sibling()) {
  373. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  374. return IterationDecision::Break;
  375. }
  376. return IterationDecision::Continue;
  377. }
  378. template<typename Callback>
  379. IterationDecision for_each_in_subtree(Callback callback)
  380. {
  381. for (auto* child = first_child(); child; child = child->next_sibling()) {
  382. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  383. return IterationDecision::Break;
  384. }
  385. return IterationDecision::Continue;
  386. }
  387. template<typename U, typename Callback>
  388. IterationDecision for_each_in_subtree_of_type(Callback callback)
  389. {
  390. for (auto* child = first_child(); child; child = child->next_sibling()) {
  391. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  392. return IterationDecision::Break;
  393. }
  394. return IterationDecision::Continue;
  395. }
  396. template<typename U, typename Callback>
  397. IterationDecision for_each_in_subtree_of_type(Callback callback) const
  398. {
  399. for (auto* child = first_child(); child; child = child->next_sibling()) {
  400. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  401. return IterationDecision::Break;
  402. }
  403. return IterationDecision::Continue;
  404. }
  405. template<typename Callback>
  406. void for_each_child(Callback callback) const
  407. {
  408. return const_cast<Node*>(this)->template for_each_child(move(callback));
  409. }
  410. template<typename Callback>
  411. void for_each_child(Callback callback)
  412. {
  413. for (auto* node = first_child(); node; node = node->next_sibling())
  414. callback(*node);
  415. }
  416. template<typename U, typename Callback>
  417. void for_each_child_of_type(Callback callback)
  418. {
  419. for (auto* node = first_child(); node; node = node->next_sibling()) {
  420. if (is<U>(node))
  421. callback(verify_cast<U>(*node));
  422. }
  423. }
  424. template<typename U, typename Callback>
  425. void for_each_child_of_type(Callback callback) const
  426. {
  427. return const_cast<Node*>(this)->template for_each_child_of_type<U>(move(callback));
  428. }
  429. template<typename U>
  430. U const* next_sibling_of_type() const
  431. {
  432. return const_cast<Node*>(this)->template next_sibling_of_type<U>();
  433. }
  434. template<typename U>
  435. inline U* next_sibling_of_type()
  436. {
  437. for (auto* sibling = next_sibling(); sibling; sibling = sibling->next_sibling()) {
  438. if (is<U>(*sibling))
  439. return &verify_cast<U>(*sibling);
  440. }
  441. return nullptr;
  442. }
  443. template<typename U>
  444. U const* previous_sibling_of_type() const
  445. {
  446. return const_cast<Node*>(this)->template previous_sibling_of_type<U>();
  447. }
  448. template<typename U>
  449. U* previous_sibling_of_type()
  450. {
  451. for (auto* sibling = previous_sibling(); sibling; sibling = sibling->previous_sibling()) {
  452. if (is<U>(*sibling))
  453. return &verify_cast<U>(*sibling);
  454. }
  455. return nullptr;
  456. }
  457. template<typename U>
  458. U const* first_child_of_type() const
  459. {
  460. return const_cast<Node*>(this)->template first_child_of_type<U>();
  461. }
  462. template<typename U>
  463. U const* last_child_of_type() const
  464. {
  465. return const_cast<Node*>(this)->template last_child_of_type<U>();
  466. }
  467. template<typename U>
  468. U* first_child_of_type()
  469. {
  470. for (auto* child = first_child(); child; child = child->next_sibling()) {
  471. if (is<U>(*child))
  472. return &verify_cast<U>(*child);
  473. }
  474. return nullptr;
  475. }
  476. template<typename U>
  477. U* last_child_of_type()
  478. {
  479. for (auto* child = last_child(); child; child = child->previous_sibling()) {
  480. if (is<U>(*child))
  481. return &verify_cast<U>(*child);
  482. }
  483. return nullptr;
  484. }
  485. template<typename U>
  486. bool has_child_of_type() const
  487. {
  488. return first_child_of_type<U>() != nullptr;
  489. }
  490. template<typename U>
  491. U const* first_ancestor_of_type() const
  492. {
  493. return const_cast<Node*>(this)->template first_ancestor_of_type<U>();
  494. }
  495. template<typename U>
  496. U* first_ancestor_of_type()
  497. {
  498. for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
  499. if (is<U>(*ancestor))
  500. return &verify_cast<U>(*ancestor);
  501. }
  502. return nullptr;
  503. }
  504. bool is_parent_of(Node const& other) const
  505. {
  506. for (auto* child = first_child(); child; child = child->next_sibling()) {
  507. if (&other == child)
  508. return true;
  509. }
  510. return false;
  511. }
  512. protected:
  513. Node(JS::Realm&, Document&, NodeType);
  514. Node(Document&, NodeType);
  515. virtual void visit_edges(Cell::Visitor&) override;
  516. virtual void finalize() override;
  517. JS::GCPtr<Document> m_document;
  518. JS::GCPtr<Layout::Node> m_layout_node;
  519. NodeType m_type { NodeType::INVALID };
  520. bool m_needs_style_update { false };
  521. bool m_child_needs_style_update { false };
  522. i32 m_id;
  523. // https://dom.spec.whatwg.org/#registered-observer-list
  524. // "Nodes have a strong reference to registered observers in their registered observer list." https://dom.spec.whatwg.org/#garbage-collection
  525. Vector<RegisteredObserver&> m_registered_observer_list;
  526. void build_accessibility_tree(AccessibilityTreeNode& parent) const;
  527. private:
  528. void queue_tree_mutation_record(JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling);
  529. void insert_before_impl(JS::NonnullGCPtr<Node>, JS::GCPtr<Node> child);
  530. void append_child_impl(JS::NonnullGCPtr<Node>);
  531. void remove_child_impl(JS::NonnullGCPtr<Node>);
  532. JS::GCPtr<Node> m_parent;
  533. JS::GCPtr<Node> m_first_child;
  534. JS::GCPtr<Node> m_last_child;
  535. JS::GCPtr<Node> m_next_sibling;
  536. JS::GCPtr<Node> m_previous_sibling;
  537. JS::GCPtr<NodeList> m_child_nodes;
  538. };
  539. }