FocusEvent.cpp 900 B

123456789101112131415161718192021222324252627282930313233
  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/UIEvents/FocusEvent.h>
  8. namespace Web::UIEvents {
  9. JS_DEFINE_ALLOCATOR(FocusEvent);
  10. WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> FocusEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init)
  11. {
  12. return realm.heap().allocate<FocusEvent>(realm, realm, event_name, event_init);
  13. }
  14. FocusEvent::FocusEvent(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init)
  15. : UIEvent(realm, event_name)
  16. {
  17. set_related_target(const_cast<DOM::EventTarget*>(event_init.related_target.ptr()));
  18. }
  19. FocusEvent::~FocusEvent() = default;
  20. void FocusEvent::initialize(JS::Realm& realm)
  21. {
  22. Base::initialize(realm);
  23. WEB_SET_PROTOTYPE_FOR_INTERFACE(FocusEvent);
  24. }
  25. }