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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include "core/CSSValueKeywords.h" | 32 #include "core/CSSValueKeywords.h" |
33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
34 #include "core/MediaFeatureNames.h" | 34 #include "core/MediaFeatureNames.h" |
35 #include "core/css/CSSPrimitiveValue.h" | 35 #include "core/css/CSSPrimitiveValue.h" |
36 #include "core/css/CSSValue.h" | 36 #include "core/css/CSSValue.h" |
37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 class CSSParserValueList; | 41 |
| 42 class CSSParserToken; |
42 | 43 |
43 struct MediaQueryExpValue { | 44 struct MediaQueryExpValue { |
44 CSSValueID id; | 45 CSSValueID id; |
45 double value; | 46 double value; |
46 CSSPrimitiveValue::UnitType unit; | 47 CSSPrimitiveValue::UnitType unit; |
47 unsigned numerator; | 48 unsigned numerator; |
48 unsigned denominator; | 49 unsigned denominator; |
49 | 50 |
50 bool isID; | 51 bool isID; |
51 bool isValue; | 52 bool isValue; |
(...skipping 21 matching lines...) Expand all Loading... |
73 return (value == expValue.value); | 74 return (value == expValue.value); |
74 if (isRatio) | 75 if (isRatio) |
75 return (numerator == expValue.numerator && denominator == expValue.d
enominator); | 76 return (numerator == expValue.numerator && denominator == expValue.d
enominator); |
76 return !expValue.isValid(); | 77 return !expValue.isValid(); |
77 } | 78 } |
78 }; | 79 }; |
79 | 80 |
80 class CORE_EXPORT MediaQueryExp : public NoBaseWillBeGarbageCollectedFinalized<
MediaQueryExp> { | 81 class CORE_EXPORT MediaQueryExp : public NoBaseWillBeGarbageCollectedFinalized<
MediaQueryExp> { |
81 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(MediaQueryExp); | 82 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(MediaQueryExp); |
82 public: | 83 public: |
83 static PassOwnPtrWillBeRawPtr<MediaQueryExp> createIfValid(const String& med
iaFeature, CSSParserValueList*); | 84 static PassOwnPtrWillBeRawPtr<MediaQueryExp> createIfValid(const String& med
iaFeature, const Vector<CSSParserToken, 4>&); |
84 ~MediaQueryExp(); | 85 ~MediaQueryExp(); |
85 | 86 |
86 const String& mediaFeature() const { return m_mediaFeature; } | 87 const String& mediaFeature() const { return m_mediaFeature; } |
87 | 88 |
88 MediaQueryExpValue expValue() const { return m_expValue; } | 89 MediaQueryExpValue expValue() const { return m_expValue; } |
89 | 90 |
90 bool operator==(const MediaQueryExp& other) const; | 91 bool operator==(const MediaQueryExp& other) const; |
91 | 92 |
92 bool isViewportDependent() const; | 93 bool isViewportDependent() const; |
93 | 94 |
94 String serialize() const; | 95 String serialize() const; |
95 | 96 |
96 PassOwnPtrWillBeRawPtr<MediaQueryExp> copy() const { return adoptPtrWillBeNo
op(new MediaQueryExp(*this)); } | 97 PassOwnPtrWillBeRawPtr<MediaQueryExp> copy() const { return adoptPtrWillBeNo
op(new MediaQueryExp(*this)); } |
97 | 98 |
98 MediaQueryExp(const MediaQueryExp& other); | 99 MediaQueryExp(const MediaQueryExp& other); |
99 | 100 |
100 DEFINE_INLINE_TRACE() { } | 101 DEFINE_INLINE_TRACE() { } |
101 | 102 |
102 private: | 103 private: |
103 MediaQueryExp(const String&, const MediaQueryExpValue&); | 104 MediaQueryExp(const String&, const MediaQueryExpValue&); |
104 | 105 |
105 String m_mediaFeature; | 106 String m_mediaFeature; |
106 MediaQueryExpValue m_expValue; | 107 MediaQueryExpValue m_expValue; |
107 }; | 108 }; |
108 | 109 |
109 } // namespace | 110 } // namespace |
110 | 111 |
111 #endif | 112 #endif |
OLD | NEW |