SubmitEvent.cpp 1.1 KB

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