MutationRecord.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. namespace Web::DOM {
  9. // https://dom.spec.whatwg.org/#mutationrecord
  10. class MutationRecord : public Bindings::PlatformObject {
  11. WEB_PLATFORM_OBJECT(MutationRecord, Bindings::PlatformObject);
  12. public:
  13. static WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationRecord>> create(JS::Realm&, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
  14. virtual ~MutationRecord() override;
  15. DeprecatedFlyString const& type() const { return m_type; }
  16. Node const* target() const { return m_target; }
  17. NodeList const* added_nodes() const { return m_added_nodes; }
  18. NodeList const* removed_nodes() const { return m_removed_nodes; }
  19. Node const* previous_sibling() const { return m_previous_sibling; }
  20. Node const* next_sibling() const { return m_next_sibling; }
  21. DeprecatedString const& attribute_name() const { return m_attribute_name; }
  22. DeprecatedString const& attribute_namespace() const { return m_attribute_namespace; }
  23. DeprecatedString const& old_value() const { return m_old_value; }
  24. private:
  25. MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
  26. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  27. virtual void visit_edges(Cell::Visitor&) override;
  28. DeprecatedFlyString m_type;
  29. JS::GCPtr<Node const> m_target;
  30. JS::GCPtr<NodeList> m_added_nodes;
  31. JS::GCPtr<NodeList> m_removed_nodes;
  32. JS::GCPtr<Node> m_previous_sibling;
  33. JS::GCPtr<Node> m_next_sibling;
  34. DeprecatedString m_attribute_name;
  35. DeprecatedString m_attribute_namespace;
  36. DeprecatedString m_old_value;
  37. };
  38. }