| 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 15 matching lines...) Expand all Loading... |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef MediaQueryExp_h | 29 #ifndef MediaQueryExp_h |
| 30 #define MediaQueryExp_h | 30 #define MediaQueryExp_h |
| 31 | 31 |
| 32 #include "core/css/CSSValue.h" | 32 #include "core/css/CSSValue.h" |
| 33 #include "core/css/MediaFeatureNames.h" | 33 #include "core/css/MediaFeatureNames.h" |
| 34 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
| 35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
| 36 #include "wtf/text/AtomicString.h" | |
| 37 | 36 |
| 38 namespace WebCore { | 37 namespace WebCore { |
| 39 class CSSParserValueList; | 38 class CSSParserValueList; |
| 40 | 39 |
| 41 class MediaQueryExp { | 40 class MediaQueryExp { |
| 42 WTF_MAKE_FAST_ALLOCATED; | 41 WTF_MAKE_FAST_ALLOCATED; |
| 43 public: | 42 public: |
| 44 static PassOwnPtr<MediaQueryExp> create(const AtomicString& mediaFeature, CS
SParserValueList*); | 43 static PassOwnPtr<MediaQueryExp> create(const String& mediaFeature, CSSParse
rValueList*); |
| 45 ~MediaQueryExp(); | 44 ~MediaQueryExp(); |
| 46 | 45 |
| 47 AtomicString mediaFeature() const { return m_mediaFeature; } | 46 String mediaFeature() const { return m_mediaFeature; } |
| 48 | 47 |
| 49 CSSValue* value() const { return m_value.get(); } | 48 CSSValue* value() const { return m_value.get(); } |
| 50 | 49 |
| 51 bool operator==(const MediaQueryExp& other) const | 50 bool operator==(const MediaQueryExp& other) const |
| 52 { | 51 { |
| 53 return (other.m_mediaFeature == m_mediaFeature) | 52 return (other.m_mediaFeatureHash == m_mediaFeatureHash) |
| 54 && ((!other.m_value && !m_value) | 53 && ((!other.m_value && !m_value) |
| 55 || (other.m_value && m_value && other.m_value->equals(*m_value))
); | 54 || (other.m_value && m_value && other.m_value->equals(*m_value))
); |
| 56 } | 55 } |
| 57 | 56 |
| 58 bool isViewportDependent() const; | 57 bool isViewportDependent() const; |
| 59 | 58 |
| 60 String serialize() const; | 59 String serialize() const; |
| 61 | 60 |
| 62 PassOwnPtr<MediaQueryExp> copy() const { return adoptPtr(new MediaQueryExp(*
this)); } | 61 PassOwnPtr<MediaQueryExp> copy() const { return adoptPtr(new MediaQueryExp(*
this)); } |
| 63 | 62 |
| 64 private: | 63 private: |
| 65 MediaQueryExp(const AtomicString& mediaFeature, PassRefPtr<CSSValue>); | 64 MediaQueryExp(StringImpl*, PassRefPtr<CSSValue>); |
| 66 | 65 |
| 67 AtomicString m_mediaFeature; | 66 String m_mediaFeature; |
| 67 unsigned m_mediaFeatureHash; |
| 68 RefPtr<CSSValue> m_value; | 68 RefPtr<CSSValue> m_value; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 #endif | 73 #endif |
| OLD | NEW |