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

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

Issue 1858753003: Remove RawPtr from core/css (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 RawPtr<MediaQueryListEvent> create() 17 static MediaQueryListEvent* create()
18 { 18 {
19 return new MediaQueryListEvent; 19 return new MediaQueryListEvent;
20 } 20 }
21 21
22 static RawPtr<MediaQueryListEvent> create(RawPtr<MediaQueryList> list) 22 static MediaQueryListEvent* create(MediaQueryList* list)
23 { 23 {
24 return new MediaQueryListEvent(list); 24 return new MediaQueryListEvent(list);
25 } 25 }
26 26
27 static RawPtr<MediaQueryListEvent> create(const String& media, bool matches) 27 static MediaQueryListEvent* create(const String& media, bool matches)
28 { 28 {
29 return new MediaQueryListEvent(media, matches); 29 return new MediaQueryListEvent(media, matches);
30 } 30 }
31 31
32 static RawPtr<MediaQueryListEvent> create(const AtomicString& eventType, con st MediaQueryListEventInit& initializer) 32 static MediaQueryListEvent* create(const AtomicString& eventType, const Medi aQueryListEventInit& initializer)
33 { 33 {
34 return new MediaQueryListEvent(eventType, initializer); 34 return new MediaQueryListEvent(eventType, initializer);
35 } 35 }
36 36
37 String media() const { return m_mediaQueryList ? m_mediaQueryList->media() : m_media; } 37 String media() const { return m_mediaQueryList ? m_mediaQueryList->media() : m_media; }
38 bool matches() const { return m_mediaQueryList ? m_mediaQueryList->matches() : m_matches; } 38 bool matches() const { return m_mediaQueryList ? m_mediaQueryList->matches() : m_matches; }
39 39
40 const AtomicString& interfaceName() const override { return EventNames::Medi aQueryListEvent; } 40 const AtomicString& interfaceName() const override { return EventNames::Medi aQueryListEvent; }
41 41
42 DEFINE_INLINE_VIRTUAL_TRACE() 42 DEFINE_INLINE_VIRTUAL_TRACE()
43 { 43 {
44 Event::trace(visitor); 44 Event::trace(visitor);
45 visitor->trace(m_mediaQueryList); 45 visitor->trace(m_mediaQueryList);
46 } 46 }
47 47
48 private: 48 private:
49 MediaQueryListEvent() 49 MediaQueryListEvent()
50 : m_matches(false) { } 50 : m_matches(false) { }
51 51
52 MediaQueryListEvent(const String& media, bool matches) 52 MediaQueryListEvent(const String& media, bool matches)
53 : Event(EventTypeNames::change, false, false) 53 : Event(EventTypeNames::change, false, false)
54 , m_media(media) 54 , m_media(media)
55 , m_matches(matches) { } 55 , m_matches(matches) { }
56 56
57 explicit MediaQueryListEvent(RawPtr<MediaQueryList> list) 57 explicit MediaQueryListEvent(MediaQueryList* list)
58 : Event(EventTypeNames::change, false, false) 58 : Event(EventTypeNames::change, false, false)
59 , m_mediaQueryList(list) 59 , m_mediaQueryList(list)
60 , m_matches(false) { } 60 , m_matches(false) { }
61 61
62 MediaQueryListEvent(const AtomicString& eventType, const MediaQueryListEvent Init& initializer) 62 MediaQueryListEvent(const AtomicString& eventType, const MediaQueryListEvent Init& initializer)
63 : Event(eventType, initializer) 63 : Event(eventType, initializer)
64 , m_matches(false) 64 , m_matches(false)
65 { 65 {
66 if (initializer.hasMedia()) 66 if (initializer.hasMedia())
67 m_media = initializer.media(); 67 m_media = initializer.media();
68 if (initializer.hasMatches()) 68 if (initializer.hasMatches())
69 m_matches = initializer.matches(); 69 m_matches = initializer.matches();
70 } 70 }
71 71
72 // We have m_media/m_matches for JS-created events; we use m_mediaQueryList 72 // We have m_media/m_matches for JS-created events; we use m_mediaQueryList
73 // for events that blink generates. 73 // for events that blink generates.
74 Member<MediaQueryList> m_mediaQueryList; 74 Member<MediaQueryList> m_mediaQueryList;
75 String m_media; 75 String m_media;
76 bool m_matches; 76 bool m_matches;
77 }; 77 };
78 78
79 } // namespace blink 79 } // namespace blink
80 80
81 #endif // MediaQueryListEvent_h 81 #endif // MediaQueryListEvent_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryList.cpp ('k') | third_party/WebKit/Source/core/css/MediaQueryListTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698