Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: third_party/WebKit/Source/core/css/MediaQueryListEvent.h

Issue 2217763003: Remove Blink-WebKit-only document.createEvent strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MediaQueryListEvent_h 5 #ifndef MediaQueryListEvent_h
6 #define MediaQueryListEvent_h 6 #define MediaQueryListEvent_h
7 7
8 #include "core/css/MediaQueryList.h" 8 #include "core/css/MediaQueryList.h"
9 #include "core/css/MediaQueryListEventInit.h" 9 #include "core/css/MediaQueryListEventInit.h"
10 #include "core/events/Event.h" 10 #include "core/events/Event.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class MediaQueryListEvent final : public Event { 14 class MediaQueryListEvent final : public Event {
15 DEFINE_WRAPPERTYPEINFO(); 15 DEFINE_WRAPPERTYPEINFO();
16 public: 16 public:
17 static MediaQueryListEvent* create()
18 {
19 return new MediaQueryListEvent;
20 }
21
22 static MediaQueryListEvent* create(MediaQueryList* list) 17 static MediaQueryListEvent* create(MediaQueryList* list)
23 { 18 {
24 return new MediaQueryListEvent(list); 19 return new MediaQueryListEvent(list);
25 } 20 }
26 21
27 static MediaQueryListEvent* create(const String& media, bool matches) 22 static MediaQueryListEvent* create(const String& media, bool matches)
28 { 23 {
29 return new MediaQueryListEvent(media, matches); 24 return new MediaQueryListEvent(media, matches);
30 } 25 }
31 26
32 static MediaQueryListEvent* create(const AtomicString& eventType, const Medi aQueryListEventInit& initializer) 27 static MediaQueryListEvent* create(const AtomicString& eventType, const Medi aQueryListEventInit& initializer)
33 { 28 {
34 return new MediaQueryListEvent(eventType, initializer); 29 return new MediaQueryListEvent(eventType, initializer);
35 } 30 }
36 31
37 String media() const { return m_mediaQueryList ? m_mediaQueryList->media() : m_media; } 32 String media() const { return m_mediaQueryList ? m_mediaQueryList->media() : m_media; }
38 bool matches() const { return m_mediaQueryList ? m_mediaQueryList->matches() : m_matches; } 33 bool matches() const { return m_mediaQueryList ? m_mediaQueryList->matches() : m_matches; }
39 34
40 const AtomicString& interfaceName() const override { return EventNames::Medi aQueryListEvent; } 35 const AtomicString& interfaceName() const override { return EventNames::Medi aQueryListEvent; }
41 36
42 DEFINE_INLINE_VIRTUAL_TRACE() 37 DEFINE_INLINE_VIRTUAL_TRACE()
43 { 38 {
44 Event::trace(visitor); 39 Event::trace(visitor);
45 visitor->trace(m_mediaQueryList); 40 visitor->trace(m_mediaQueryList);
46 } 41 }
47 42
48 private: 43 private:
49 MediaQueryListEvent()
50 : m_matches(false) { }
51
52 MediaQueryListEvent(const String& media, bool matches) 44 MediaQueryListEvent(const String& media, bool matches)
53 : Event(EventTypeNames::change, false, false) 45 : Event(EventTypeNames::change, false, false)
54 , m_media(media) 46 , m_media(media)
55 , m_matches(matches) { } 47 , m_matches(matches) { }
56 48
57 explicit MediaQueryListEvent(MediaQueryList* list) 49 explicit MediaQueryListEvent(MediaQueryList* list)
58 : Event(EventTypeNames::change, false, false) 50 : Event(EventTypeNames::change, false, false)
59 , m_mediaQueryList(list) 51 , m_mediaQueryList(list)
60 , m_matches(false) { } 52 , m_matches(false) { }
61 53
(...skipping 10 matching lines...) Expand all
72 // We have m_media/m_matches for JS-created events; we use m_mediaQueryList 64 // We have m_media/m_matches for JS-created events; we use m_mediaQueryList
73 // for events that blink generates. 65 // for events that blink generates.
74 Member<MediaQueryList> m_mediaQueryList; 66 Member<MediaQueryList> m_mediaQueryList;
75 String m_media; 67 String m_media;
76 bool m_matches; 68 bool m_matches;
77 }; 69 };
78 70
79 } // namespace blink 71 } // namespace blink
80 72
81 #endif // MediaQueryListEvent_h 73 #endif // MediaQueryListEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698