| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return (id == expValue.id); | 70 return (id == expValue.id); |
| 71 if (isValue) | 71 if (isValue) |
| 72 return (value == expValue.value); | 72 return (value == expValue.value); |
| 73 if (isRatio) | 73 if (isRatio) |
| 74 return (numerator == expValue.numerator && | 74 return (numerator == expValue.numerator && |
| 75 denominator == expValue.denominator); | 75 denominator == expValue.denominator); |
| 76 return !expValue.isValid(); | 76 return !expValue.isValid(); |
| 77 } | 77 } |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class CORE_EXPORT MediaQueryExp | 80 class CORE_EXPORT MediaQueryExp { |
| 81 : public GarbageCollectedFinalized<MediaQueryExp> { | 81 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 82 |
| 82 public: | 83 public: |
| 83 static MediaQueryExp* createIfValid(const String& mediaFeature, | 84 // Returns an invalid MediaQueryExp if the arguments are invalid. |
| 84 const Vector<CSSParserToken, 4>&); | 85 static MediaQueryExp create(const String& mediaFeature, |
| 86 const Vector<CSSParserToken, 4>&); |
| 87 static MediaQueryExp invalid() { |
| 88 return MediaQueryExp(String(), MediaQueryExpValue()); |
| 89 } |
| 90 |
| 91 MediaQueryExp(const MediaQueryExp& other); |
| 85 ~MediaQueryExp(); | 92 ~MediaQueryExp(); |
| 86 | 93 |
| 87 const String& mediaFeature() const { return m_mediaFeature; } | 94 const String& mediaFeature() const { return m_mediaFeature; } |
| 88 | 95 |
| 89 MediaQueryExpValue expValue() const { return m_expValue; } | 96 MediaQueryExpValue expValue() const { return m_expValue; } |
| 90 | 97 |
| 98 bool isValid() const { return !m_mediaFeature.isNull(); } |
| 99 |
| 91 bool operator==(const MediaQueryExp& other) const; | 100 bool operator==(const MediaQueryExp& other) const; |
| 92 | 101 |
| 93 bool isViewportDependent() const; | 102 bool isViewportDependent() const; |
| 94 | 103 |
| 95 bool isDeviceDependent() const; | 104 bool isDeviceDependent() const; |
| 96 | 105 |
| 97 String serialize() const; | 106 String serialize() const; |
| 98 | 107 |
| 99 MediaQueryExp* copy() const { return new MediaQueryExp(*this); } | |
| 100 | |
| 101 MediaQueryExp(const MediaQueryExp& other); | |
| 102 | |
| 103 DEFINE_INLINE_TRACE() {} | |
| 104 | 108 |
| 105 private: | 109 private: |
| 106 MediaQueryExp(const String&, const MediaQueryExpValue&); | 110 MediaQueryExp(const String&, const MediaQueryExpValue&); |
| 107 | 111 |
| 108 String m_mediaFeature; | 112 String m_mediaFeature; |
| 109 MediaQueryExpValue m_expValue; | 113 MediaQueryExpValue m_expValue; |
| 110 }; | 114 }; |
| 111 | 115 |
| 112 } // namespace blink | 116 } // namespace blink |
| 113 | 117 |
| 114 #endif | 118 #endif |
| OLD | NEW |