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 * Copyright (C) 2013 Apple Inc. All rights reserved. | 6 * Copyright (C) 2013 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 static inline bool featureWithPositiveNumber(const AtomicString& mediaFeature, c
onst CSSParserValue* value) | 93 static inline bool featureWithPositiveNumber(const AtomicString& mediaFeature, c
onst CSSParserValue* value) |
94 { | 94 { |
95 if (value->unit != CSSPrimitiveValue::CSS_NUMBER || value->fValue < 0) | 95 if (value->unit != CSSPrimitiveValue::CSS_NUMBER || value->fValue < 0) |
96 return false; | 96 return false; |
97 | 97 |
98 return mediaFeature == MediaFeatureNames::transform_2dMediaFeature | 98 return mediaFeature == MediaFeatureNames::transform_2dMediaFeature |
99 || mediaFeature == MediaFeatureNames::transform_3dMediaFeature | 99 || mediaFeature == MediaFeatureNames::transform_3dMediaFeature |
100 || mediaFeature == MediaFeatureNames::transitionMediaFeature | 100 || mediaFeature == MediaFeatureNames::transitionMediaFeature |
101 || mediaFeature == MediaFeatureNames::animationMediaFeature | 101 || mediaFeature == MediaFeatureNames::animationMediaFeature |
102 || mediaFeature == MediaFeatureNames::device_pixel_ratioMediaFeature | 102 || mediaFeature == MediaFeatureNames::devicePixelRatioMediaFeature |
103 || mediaFeature == MediaFeatureNames::max_device_pixel_ratioMediaFeature | 103 || mediaFeature == MediaFeatureNames::maxDevicePixelRatioMediaFeature |
104 || mediaFeature == MediaFeatureNames::min_device_pixel_ratioMediaFeature
; | 104 || mediaFeature == MediaFeatureNames::minDevicePixelRatioMediaFeature; |
105 } | 105 } |
106 | 106 |
107 static inline bool featureWithZeroOrOne(const AtomicString& mediaFeature, const
CSSParserValue* value) | 107 static inline bool featureWithZeroOrOne(const AtomicString& mediaFeature, const
CSSParserValue* value) |
108 { | 108 { |
109 if (!value->isInt || !(value->fValue == 1 || !value->fValue)) | 109 if (!value->isInt || !(value->fValue == 1 || !value->fValue)) |
110 return false; | 110 return false; |
111 | 111 |
112 return mediaFeature == MediaFeatureNames::gridMediaFeature | 112 return mediaFeature == MediaFeatureNames::gridMediaFeature |
113 || mediaFeature == MediaFeatureNames::hoverMediaFeature; | 113 || mediaFeature == MediaFeatureNames::hoverMediaFeature; |
114 } | 114 } |
(...skipping 21 matching lines...) Expand all Loading... |
136 || mediaFeature == MediaFeatureNames::orientationMediaFeature | 136 || mediaFeature == MediaFeatureNames::orientationMediaFeature |
137 || mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature | 137 || mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature |
138 || mediaFeature == MediaFeatureNames::device_aspect_ratioMediaFeature | 138 || mediaFeature == MediaFeatureNames::device_aspect_ratioMediaFeature |
139 || mediaFeature == MediaFeatureNames::hoverMediaFeature | 139 || mediaFeature == MediaFeatureNames::hoverMediaFeature |
140 || mediaFeature == MediaFeatureNames::transform_2dMediaFeature | 140 || mediaFeature == MediaFeatureNames::transform_2dMediaFeature |
141 || mediaFeature == MediaFeatureNames::transform_3dMediaFeature | 141 || mediaFeature == MediaFeatureNames::transform_3dMediaFeature |
142 || mediaFeature == MediaFeatureNames::transitionMediaFeature | 142 || mediaFeature == MediaFeatureNames::transitionMediaFeature |
143 || mediaFeature == MediaFeatureNames::animationMediaFeature | 143 || mediaFeature == MediaFeatureNames::animationMediaFeature |
144 || mediaFeature == MediaFeatureNames::view_modeMediaFeature | 144 || mediaFeature == MediaFeatureNames::view_modeMediaFeature |
145 || mediaFeature == MediaFeatureNames::pointerMediaFeature | 145 || mediaFeature == MediaFeatureNames::pointerMediaFeature |
146 || mediaFeature == MediaFeatureNames::device_pixel_ratioMediaFeature | 146 || mediaFeature == MediaFeatureNames::devicePixelRatioMediaFeature |
147 || mediaFeature == MediaFeatureNames::resolutionMediaFeature; | 147 || mediaFeature == MediaFeatureNames::resolutionMediaFeature; |
148 } | 148 } |
149 | 149 |
150 inline MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserV
alueList* valueList) | 150 inline MediaQueryExp::MediaQueryExp(const AtomicString& mediaFeature, CSSParserV
alueList* valueList) |
151 : m_mediaFeature(mediaFeature) | 151 : m_mediaFeature(mediaFeature) |
152 , m_value(0) | 152 , m_value(0) |
153 , m_isValid(false) | 153 , m_isValid(false) |
154 { | 154 { |
155 // Initialize media query expression that must have 1 or more values. | 155 // Initialize media query expression that must have 1 or more values. |
156 if (valueList) { | 156 if (valueList) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 245 void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
246 { | 246 { |
247 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | 247 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); |
248 info.addMember(m_mediaFeature, "mediaFeature"); | 248 info.addMember(m_mediaFeature, "mediaFeature"); |
249 info.addMember(m_serializationCache, "serializationCache"); | 249 info.addMember(m_serializationCache, "serializationCache"); |
250 info.addMember(m_value, "value"); | 250 info.addMember(m_value, "value"); |
251 } | 251 } |
252 | 252 |
253 } // namespace | 253 } // namespace |
OLD | NEW |