MediaQueryListEvent.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/Intrinsics.h>
  7. #include <LibWeb/Bindings/MediaQueryListEventPrototype.h>
  8. #include <LibWeb/CSS/MediaQueryListEvent.h>
  9. namespace Web::CSS {
  10. GC_DEFINE_ALLOCATOR(MediaQueryListEvent);
  11. GC::Ref<MediaQueryListEvent> MediaQueryListEvent::create(JS::Realm& realm, FlyString const& event_name, MediaQueryListEventInit const& event_init)
  12. {
  13. auto event = realm.create<MediaQueryListEvent>(realm, event_name, event_init);
  14. event->set_is_trusted(true);
  15. return event;
  16. }
  17. GC::Ref<MediaQueryListEvent> MediaQueryListEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, MediaQueryListEventInit const& event_init)
  18. {
  19. return realm.create<MediaQueryListEvent>(realm, event_name, event_init);
  20. }
  21. MediaQueryListEvent::MediaQueryListEvent(JS::Realm& realm, FlyString const& event_name, MediaQueryListEventInit const& event_init)
  22. : DOM::Event(realm, event_name, event_init)
  23. , m_media(event_init.media)
  24. , m_matches(event_init.matches)
  25. {
  26. }
  27. MediaQueryListEvent::~MediaQueryListEvent() = default;
  28. void MediaQueryListEvent::initialize(JS::Realm& realm)
  29. {
  30. Base::initialize(realm);
  31. WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaQueryListEvent);
  32. }
  33. }