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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 CSSParserToken token = tokenList.first(); | 218 CSSParserToken token = tokenList.first(); |
219 | 219 |
220 if (token.type() == IdentToken) { | 220 if (token.type() == IdentToken) { |
221 CSSValueID ident = token.id(); | 221 CSSValueID ident = token.id(); |
222 if (!featureWithValidIdent(lowerMediaFeature, ident)) | 222 if (!featureWithValidIdent(lowerMediaFeature, ident)) |
223 return nullptr; | 223 return nullptr; |
224 expValue.id = ident; | 224 expValue.id = ident; |
225 expValue.isID = true; | 225 expValue.isID = true; |
226 } else if (token.type() == NumberToken || token.type() == PercentageToken || | 226 } else if (token.type() == NumberToken || token.type() == PercentageToken || |
227 token.type() == DimensionToken) { | 227 token.type() == DimensionToken) { |
228 // Check for numeric token types since it is only safe for these types to
call numericValue. | 228 // Check for numeric token types since it is only safe for these types to |
| 229 // call numericValue. |
229 if (featureWithValidDensity(lowerMediaFeature, token) || | 230 if (featureWithValidDensity(lowerMediaFeature, token) || |
230 featureWithValidPositiveLength(lowerMediaFeature, token)) { | 231 featureWithValidPositiveLength(lowerMediaFeature, token)) { |
231 // Media features that must have non-negative <density>, ie. dppx, dpi o
r dpcm, | 232 // Media features that must have non-negative <density>, ie. dppx, dpi |
232 // or Media features that must have non-negative <length> or number valu
e. | 233 // or dpcm, or Media features that must have non-negative <length> or |
| 234 // number value. |
233 expValue.value = token.numericValue(); | 235 expValue.value = token.numericValue(); |
234 expValue.unit = token.unitType(); | 236 expValue.unit = token.unitType(); |
235 expValue.isValue = true; | 237 expValue.isValue = true; |
236 } else if (featureWithPositiveInteger(lowerMediaFeature, token) || | 238 } else if (featureWithPositiveInteger(lowerMediaFeature, token) || |
237 featureWithPositiveNumber(lowerMediaFeature, token) || | 239 featureWithPositiveNumber(lowerMediaFeature, token) || |
238 featureWithZeroOrOne(lowerMediaFeature, token)) { | 240 featureWithZeroOrOne(lowerMediaFeature, token)) { |
239 // Media features that must have non-negative integer value, | 241 // Media features that must have non-negative integer value, |
240 // or media features that must have non-negative number value, | 242 // or media features that must have non-negative number value, |
241 // or media features that must have (0|1) value. | 243 // or media features that must have (0|1) value. |
242 expValue.value = token.numericValue(); | 244 expValue.value = token.numericValue(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 output.append('/'); | 312 output.append('/'); |
311 output.append(printNumber(denominator)); | 313 output.append(printNumber(denominator)); |
312 } else if (isID) { | 314 } else if (isID) { |
313 output.append(getValueName(id)); | 315 output.append(getValueName(id)); |
314 } | 316 } |
315 | 317 |
316 return output.toString(); | 318 return output.toString(); |
317 } | 319 } |
318 | 320 |
319 } // namespace blink | 321 } // namespace blink |
OLD | NEW |