| 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 19 matching lines...) Expand all Loading... |
| 30 #define MediaQuery_h | 30 #define MediaQuery_h |
| 31 | 31 |
| 32 #include "core/CoreExport.h" | 32 #include "core/CoreExport.h" |
| 33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
| 34 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
| 35 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
| 36 #include "wtf/text/StringHash.h" | 36 #include "wtf/text/StringHash.h" |
| 37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 |
| 41 class CSSDeserializeStream; |
| 42 class CSSSerializeStream; |
| 40 class MediaQueryExp; | 43 class MediaQueryExp; |
| 41 | 44 |
| 42 using ExpressionHeapVector = WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp>>
; | 45 using ExpressionHeapVector = WillBeHeapVector<OwnPtrWillBeMember<MediaQueryExp>>
; |
| 43 | 46 |
| 44 class CORE_EXPORT MediaQuery : public NoBaseWillBeGarbageCollectedFinalized<Medi
aQuery> { | 47 class CORE_EXPORT MediaQuery : public NoBaseWillBeGarbageCollectedFinalized<Medi
aQuery> { |
| 45 USING_FAST_MALLOC_WILL_BE_REMOVED(MediaQuery); | 48 USING_FAST_MALLOC_WILL_BE_REMOVED(MediaQuery); |
| 46 public: | 49 public: |
| 47 enum Restrictor { | 50 enum Restrictor { |
| 48 Only, Not, None | 51 Only, Not, None |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 static PassOwnPtrWillBeRawPtr<MediaQuery> createNotAll(); | 54 static PassOwnPtrWillBeRawPtr<MediaQuery> createNotAll(); |
| 55 static PassOwnPtrWillBeRawPtr<MediaQuery> deserialize(CSSDeserializeStream*)
; |
| 52 | 56 |
| 53 MediaQuery(Restrictor, const String& mediaType, PassOwnPtrWillBeRawPtr<Expre
ssionHeapVector> exprs); | 57 MediaQuery(Restrictor, const String& mediaType, PassOwnPtrWillBeRawPtr<Expre
ssionHeapVector> exprs); |
| 54 ~MediaQuery(); | 58 ~MediaQuery(); |
| 55 | 59 |
| 56 Restrictor restrictor() const { return m_restrictor; } | 60 Restrictor restrictor() const { return m_restrictor; } |
| 57 const ExpressionHeapVector& expressions() const { return *m_expressions; } | 61 const ExpressionHeapVector& expressions() const { return *m_expressions; } |
| 58 const String& mediaType() const { return m_mediaType; } | 62 const String& mediaType() const { return m_mediaType; } |
| 59 bool operator==(const MediaQuery& other) const; | 63 bool operator==(const MediaQuery& other) const; |
| 60 String cssText() const; | 64 String cssText() const; |
| 61 | 65 |
| 62 PassOwnPtrWillBeRawPtr<MediaQuery> copy() const { return adoptPtrWillBeNoop(
new MediaQuery(*this)); } | 66 PassOwnPtrWillBeRawPtr<MediaQuery> copy() const { return adoptPtrWillBeNoop(
new MediaQuery(*this)); } |
| 63 | 67 |
| 68 void serialize(CSSSerializeStream*) const; |
| 69 |
| 64 DECLARE_TRACE(); | 70 DECLARE_TRACE(); |
| 65 | 71 |
| 66 private: | 72 private: |
| 67 MediaQuery(const MediaQuery&); | 73 MediaQuery(const MediaQuery&); |
| 68 | 74 |
| 69 Restrictor m_restrictor; | 75 Restrictor m_restrictor; |
| 70 String m_mediaType; | 76 String m_mediaType; |
| 71 OwnPtrWillBeMember<ExpressionHeapVector> m_expressions; | 77 OwnPtrWillBeMember<ExpressionHeapVector> m_expressions; |
| 72 String m_serializationCache; | 78 String m_serializationCache; |
| 73 | 79 |
| 74 String serialize() const; | 80 String serialize() const; |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 } // namespace | 83 } // namespace |
| 78 | 84 |
| 79 #endif | 85 #endif |
| OLD | NEW |