| 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 30 matching lines...) Expand all Loading... |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 using namespace MediaFeatureNames; | 43 using namespace MediaFeatureNames; |
| 44 | 44 |
| 45 static inline bool featureWithCSSValueID(const String& mediaFeature, const CSSPa
rserValue* value) | 45 static inline bool featureWithCSSValueID(const String& mediaFeature, const CSSPa
rserValue* value) |
| 46 { | 46 { |
| 47 if (!value->id) | 47 if (!value->id) |
| 48 return false; | 48 return false; |
| 49 | 49 |
| 50 return mediaFeature == orientationMediaFeature | 50 return mediaFeature == orientationMediaFeature |
| 51 || mediaFeature == viewModeMediaFeature | |
| 52 || mediaFeature == pointerMediaFeature | 51 || mediaFeature == pointerMediaFeature |
| 53 || mediaFeature == scanMediaFeature; | 52 || mediaFeature == scanMediaFeature; |
| 54 } | 53 } |
| 55 | 54 |
| 56 static inline bool featureWithValidIdent(const String& mediaFeature, CSSValueID
ident) | 55 static inline bool featureWithValidIdent(const String& mediaFeature, CSSValueID
ident) |
| 57 { | 56 { |
| 58 if (mediaFeature == orientationMediaFeature) | 57 if (mediaFeature == orientationMediaFeature) |
| 59 return ident == CSSValuePortrait || ident == CSSValueLandscape; | 58 return ident == CSSValuePortrait || ident == CSSValueLandscape; |
| 60 | 59 |
| 61 if (mediaFeature == viewModeMediaFeature) { | |
| 62 switch (ident) { | |
| 63 case CSSValueWindowed: | |
| 64 case CSSValueFloating: | |
| 65 case CSSValueFullscreen: | |
| 66 case CSSValueMaximized: | |
| 67 case CSSValueMinimized: | |
| 68 return true; | |
| 69 default: | |
| 70 return false; | |
| 71 } | |
| 72 } | |
| 73 | |
| 74 if (mediaFeature == pointerMediaFeature) | 60 if (mediaFeature == pointerMediaFeature) |
| 75 return ident == CSSValueNone || ident == CSSValueCoarse || ident == CSSV
alueFine; | 61 return ident == CSSValueNone || ident == CSSValueCoarse || ident == CSSV
alueFine; |
| 76 | 62 |
| 77 if (mediaFeature == scanMediaFeature) | 63 if (mediaFeature == scanMediaFeature) |
| 78 return ident == CSSValueInterlace || ident == CSSValueProgressive; | 64 return ident == CSSValueInterlace || ident == CSSValueProgressive; |
| 79 | 65 |
| 80 ASSERT_NOT_REACHED(); | 66 ASSERT_NOT_REACHED(); |
| 81 return false; | 67 return false; |
| 82 } | 68 } |
| 83 | 69 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 || mediaFeature == monochromeMediaFeature | 111 || mediaFeature == monochromeMediaFeature |
| 126 || mediaFeature == maxMonochromeMediaFeature | 112 || mediaFeature == maxMonochromeMediaFeature |
| 127 || mediaFeature == minMonochromeMediaFeature; | 113 || mediaFeature == minMonochromeMediaFeature; |
| 128 } | 114 } |
| 129 | 115 |
| 130 static inline bool featureWithPositiveNumber(const String& mediaFeature, const C
SSParserValue* value) | 116 static inline bool featureWithPositiveNumber(const String& mediaFeature, const C
SSParserValue* value) |
| 131 { | 117 { |
| 132 if (value->unit != CSSPrimitiveValue::CSS_NUMBER || value->fValue < 0) | 118 if (value->unit != CSSPrimitiveValue::CSS_NUMBER || value->fValue < 0) |
| 133 return false; | 119 return false; |
| 134 | 120 |
| 135 return mediaFeature == transform2dMediaFeature | 121 return mediaFeature == transform3dMediaFeature |
| 136 || mediaFeature == transform3dMediaFeature | |
| 137 || mediaFeature == animationMediaFeature | |
| 138 || mediaFeature == devicePixelRatioMediaFeature | 122 || mediaFeature == devicePixelRatioMediaFeature |
| 139 || mediaFeature == maxDevicePixelRatioMediaFeature | 123 || mediaFeature == maxDevicePixelRatioMediaFeature |
| 140 || mediaFeature == minDevicePixelRatioMediaFeature; | 124 || mediaFeature == minDevicePixelRatioMediaFeature; |
| 141 } | 125 } |
| 142 | 126 |
| 143 static inline bool featureWithZeroOrOne(const String& mediaFeature, const CSSPar
serValue* value) | 127 static inline bool featureWithZeroOrOne(const String& mediaFeature, const CSSPar
serValue* value) |
| 144 { | 128 { |
| 145 if (!value->isInt || !(value->fValue == 1 || !value->fValue)) | 129 if (!value->isInt || !(value->fValue == 1 || !value->fValue)) |
| 146 return false; | 130 return false; |
| 147 | 131 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 167 || mediaFeature == colorIndexMediaFeature | 151 || mediaFeature == colorIndexMediaFeature |
| 168 || mediaFeature == gridMediaFeature | 152 || mediaFeature == gridMediaFeature |
| 169 || mediaFeature == heightMediaFeature | 153 || mediaFeature == heightMediaFeature |
| 170 || mediaFeature == widthMediaFeature | 154 || mediaFeature == widthMediaFeature |
| 171 || mediaFeature == deviceHeightMediaFeature | 155 || mediaFeature == deviceHeightMediaFeature |
| 172 || mediaFeature == deviceWidthMediaFeature | 156 || mediaFeature == deviceWidthMediaFeature |
| 173 || mediaFeature == orientationMediaFeature | 157 || mediaFeature == orientationMediaFeature |
| 174 || mediaFeature == aspectRatioMediaFeature | 158 || mediaFeature == aspectRatioMediaFeature |
| 175 || mediaFeature == deviceAspectRatioMediaFeature | 159 || mediaFeature == deviceAspectRatioMediaFeature |
| 176 || mediaFeature == hoverMediaFeature | 160 || mediaFeature == hoverMediaFeature |
| 177 || mediaFeature == transform2dMediaFeature | |
| 178 || mediaFeature == transform3dMediaFeature | 161 || mediaFeature == transform3dMediaFeature |
| 179 || mediaFeature == animationMediaFeature | |
| 180 || mediaFeature == viewModeMediaFeature | |
| 181 || mediaFeature == pointerMediaFeature | 162 || mediaFeature == pointerMediaFeature |
| 182 || mediaFeature == devicePixelRatioMediaFeature | 163 || mediaFeature == devicePixelRatioMediaFeature |
| 183 || mediaFeature == resolutionMediaFeature | 164 || mediaFeature == resolutionMediaFeature |
| 184 || mediaFeature == scanMediaFeature; | 165 || mediaFeature == scanMediaFeature; |
| 185 } | 166 } |
| 186 | 167 |
| 187 bool MediaQueryExp::isViewportDependent() const | 168 bool MediaQueryExp::isViewportDependent() const |
| 188 { | 169 { |
| 189 return m_mediaFeature == widthMediaFeature | 170 return m_mediaFeature == widthMediaFeature |
| 190 || m_mediaFeature == heightMediaFeature | 171 || m_mediaFeature == heightMediaFeature |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 output.append("/"); | 317 output.append("/"); |
| 337 output.append(printNumber(denominator)); | 318 output.append(printNumber(denominator)); |
| 338 } else if (isID) { | 319 } else if (isID) { |
| 339 output.append(getValueName(id)); | 320 output.append(getValueName(id)); |
| 340 } | 321 } |
| 341 | 322 |
| 342 return output.toString(); | 323 return output.toString(); |
| 343 } | 324 } |
| 344 | 325 |
| 345 } // namespace | 326 } // namespace |
| OLD | NEW |