SubmitEvent.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/Intrinsics.h>
  7. #include <LibWeb/HTML/SubmitEvent.h>
  8. namespace Web::HTML {
  9. JS::NonnullGCPtr<SubmitEvent> SubmitEvent::create(JS::Realm& realm, FlyString const& event_name, SubmitEventInit const& event_init)
  10. {
  11. return realm.heap().allocate<SubmitEvent>(realm, realm, event_name, event_init);
  12. }
  13. WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> SubmitEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, SubmitEventInit const& event_init)
  14. {
  15. return create(realm, event_name, event_init);
  16. }
  17. SubmitEvent::SubmitEvent(JS::Realm& realm, FlyString const& event_name, SubmitEventInit const& event_init)
  18. : DOM::Event(realm, event_name, event_init)
  19. , m_submitter(event_init.submitter)
  20. {
  21. }
  22. SubmitEvent::~SubmitEvent() = default;
  23. void SubmitEvent::initialize(JS::Realm& realm)
  24. {
  25. Base::initialize(realm);
  26. set_prototype(&Bindings::ensure_web_prototype<Bindings::SubmitEventPrototype>(realm, "SubmitEvent"));
  27. }
  28. void SubmitEvent::visit_edges(Cell::Visitor& visitor)
  29. {
  30. Base::visit_edges(visitor);
  31. visitor.visit(m_submitter.ptr());
  32. }
  33. }