OLD | NEW |
---|---|
1 /* | 1 /* |
2 * CSS Media Query | 2 * CSS Media Query |
3 * | 3 * |
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. | 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. |
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 21 matching lines...) Expand all Loading... | |
32 #include <utility> | 32 #include <utility> |
33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "platform/wtf/Vector.h" | 35 #include "platform/wtf/Vector.h" |
36 #include "platform/wtf/text/StringHash.h" | 36 #include "platform/wtf/text/StringHash.h" |
37 #include "platform/wtf/text/WTFString.h" | 37 #include "platform/wtf/text/WTFString.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 class MediaQueryExp; | 40 class MediaQueryExp; |
41 | 41 |
42 using ExpressionHeapVector = HeapVector<Member<MediaQueryExp>>; | 42 using ExpressionHeapVector = Vector<MediaQueryExp>; |
43 | 43 |
44 class CORE_EXPORT MediaQuery : public GarbageCollectedFinalized<MediaQuery> { | 44 class CORE_EXPORT MediaQuery { |
45 public: | 45 public: |
46 enum RestrictorType { kOnly, kNot, kNone }; | 46 enum RestrictorType { kOnly, kNot, kNone }; |
47 | 47 |
48 static MediaQuery* Create(RestrictorType, | 48 static std::unique_ptr<MediaQuery> Create(RestrictorType, |
49 String media_type, | 49 String media_type, |
50 ExpressionHeapVector); | 50 ExpressionHeapVector); |
51 static MediaQuery* CreateNotAll(); | 51 static std::unique_ptr<MediaQuery> CreateNotAll(); |
52 | 52 |
53 ~MediaQuery(); | 53 ~MediaQuery(); |
54 | 54 |
55 RestrictorType Restrictor() const { return restrictor_; } | 55 RestrictorType Restrictor() const { return restrictor_; } |
56 const ExpressionHeapVector& Expressions() const { return expressions_; } | 56 const ExpressionHeapVector& Expressions() const { return expressions_; } |
57 const String& MediaType() const { return media_type_; } | 57 const String& MediaType() const { return media_type_; } |
58 bool operator==(const MediaQuery& other) const; | 58 bool operator==(const MediaQuery& other) const; |
59 String CssText() const; | 59 String CssText() const; |
60 | 60 |
61 MediaQuery* Copy() const { return new MediaQuery(*this); } | 61 std::unique_ptr<MediaQuery> Copy() const { |
62 | 62 return WTF::WrapUnique(new MediaQuery(*this)); |
haraken
2017/04/26 11:15:25
MakeUnique
keishi
2017/04/26 13:28:58
Done.
| |
63 DECLARE_TRACE(); | 63 } |
64 | 64 |
65 private: | 65 private: |
66 MediaQuery(RestrictorType, String media_type, ExpressionHeapVector); | 66 MediaQuery(RestrictorType, String media_type, ExpressionHeapVector); |
67 MediaQuery(const MediaQuery&); | 67 MediaQuery(const MediaQuery&); |
68 | 68 |
69 MediaQuery& operator=(const MediaQuery&) = delete; | 69 MediaQuery& operator=(const MediaQuery&) = delete; |
70 | 70 |
71 RestrictorType restrictor_; | 71 RestrictorType restrictor_; |
72 String media_type_; | 72 String media_type_; |
73 ExpressionHeapVector expressions_; | 73 ExpressionHeapVector expressions_; |
74 String serialization_cache_; | 74 String serialization_cache_; |
75 | 75 |
76 String Serialize() const; | 76 String Serialize() const; |
77 }; | 77 }; |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
80 | 80 |
81 #endif | 81 #endif |
OLD | NEW |