SubmitEvent.cpp 1.2 KB

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