Index: Source/core/css/MediaQueryListEvent.h |
diff --git a/Source/core/css/MediaQueryListEvent.h b/Source/core/css/MediaQueryListEvent.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..48b9370a8b4d8dbe1324a9c0e6112cfc8e32324b |
--- /dev/null |
+++ b/Source/core/css/MediaQueryListEvent.h |
@@ -0,0 +1,71 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MediaQueryListEvent_h |
+#define MediaQueryListEvent_h |
+ |
+#include "core/events/Event.h" |
+ |
+namespace WebCore { |
+ |
+struct MediaQueryListEventInit : public EventInit { |
+ MediaQueryListEventInit() : matches(false) { } |
+ |
+ String media; |
+ bool matches; |
+}; |
+ |
+class MediaQueryListEvent FINAL : public Event { |
+public: |
+ static PassRefPtrWillBeRawPtr<MediaQueryListEvent> create() |
+ { |
+ return adoptRefWillBeNoop(new MediaQueryListEvent); |
+ } |
+ |
+ static PassRefPtrWillBeRawPtr<MediaQueryListEvent> create(const String& media, bool matches) |
+ { |
+ return adoptRefWillBeNoop(new MediaQueryListEvent(media, matches)); |
+ } |
+ |
+ static PassRefPtrWillBeRawPtr<MediaQueryListEvent> create(const AtomicString& eventType, const MediaQueryListEventInit& initializer) |
+ { |
+ return adoptRefWillBeNoop(new MediaQueryListEvent(eventType, initializer)); |
+ } |
+ |
+ const String& media() const { return m_media; } |
+ bool matches() const { return m_matches; } |
+ |
+ virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::MediaQueryListEvent; } |
+ |
+ virtual void trace(Visitor* visitor) OVERRIDE { Event::trace(visitor); } |
+ |
+private: |
+ MediaQueryListEvent() |
+ { |
+ ScriptWrappable::init(this); |
+ } |
+ |
+ MediaQueryListEvent(const String& media, bool matches) |
+ : Event(EventTypeNames::change, false, false) |
+ , m_media(media) |
+ , m_matches(matches) |
+ { |
+ ScriptWrappable::init(this); |
+ } |
+ |
+ MediaQueryListEvent(const AtomicString& eventType, const MediaQueryListEventInit& initializer) |
+ : Event(eventType, initializer) |
+ , m_media(initializer.media) |
+ , m_matches(initializer.matches) |
+ { |
+ ScriptWrappable::init(this); |
+ } |
+ |
+ String m_media; |
+ bool m_matches; |
+}; |
+ |
+} // namespace WebCore |
+ |
+#endif // MediaQueryListEvent_h |