FormDataEvent.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/FormDataEventPrototype.h>
  7. #include <LibWeb/Bindings/Intrinsics.h>
  8. #include <LibWeb/HTML/FormDataEvent.h>
  9. namespace Web::HTML {
  10. WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> FormDataEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init)
  11. {
  12. return realm.heap().allocate<FormDataEvent>(realm, realm, event_name, event_init);
  13. }
  14. FormDataEvent::FormDataEvent(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init)
  15. : DOM::Event(realm, event_name, event_init)
  16. , m_form_data(event_init.form_data)
  17. {
  18. }
  19. FormDataEvent::~FormDataEvent() = default;
  20. void FormDataEvent::initialize(JS::Realm& realm)
  21. {
  22. Base::initialize(realm);
  23. set_prototype(&Bindings::ensure_web_prototype<Bindings::FormDataEventPrototype>(realm, "FormDataEvent"));
  24. }
  25. void FormDataEvent::visit_edges(Cell::Visitor& visitor)
  26. {
  27. Base::visit_edges(visitor);
  28. visitor.visit(m_form_data);
  29. }
  30. }