Node.h 21 KB

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