MediaQueryListEvent.cpp 1023 B

1234567891011121314151617181920212223242526272829303132333435
  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. JS_DEFINE_ALLOCATOR(MediaQueryListEvent);
  11. JS::NonnullGCPtr<MediaQueryListEvent> MediaQueryListEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, MediaQueryListEventInit const& event_init)
  12. {
  13. return realm.create<MediaQueryListEvent>(realm, event_name, event_init);
  14. }
  15. MediaQueryListEvent::MediaQueryListEvent(JS::Realm& realm, FlyString const& event_name, MediaQueryListEventInit const& event_init)
  16. : DOM::Event(realm, event_name, event_init)
  17. , m_media(event_init.media)
  18. , m_matches(event_init.matches)
  19. {
  20. }
  21. MediaQueryListEvent::~MediaQueryListEvent() = default;
  22. void MediaQueryListEvent::initialize(JS::Realm& realm)
  23. {
  24. Base::initialize(realm);
  25. WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaQueryListEvent);
  26. }
  27. }