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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { | 214 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { |
215 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue | 215 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue |
216 } else if (tokenList.size() == 1) { | 216 } else if (tokenList.size() == 1) { |
217 CSSParserToken token = tokenList.first(); | 217 CSSParserToken token = tokenList.first(); |
218 | 218 |
219 if (token.type() == IdentToken) { | 219 if (token.type() == IdentToken) { |
220 CSSValueID ident = token.id(); | 220 CSSValueID ident = token.id(); |
221 if (!featureWithValidIdent(lowerMediaFeature, ident)) | 221 if (!featureWithValidIdent(lowerMediaFeature, ident)) |
222 return nullptr; | 222 return nullptr; |
223 expValue.id = ident; | 223 expValue.id = ident; |
224 expValue.unit = CSSPrimitiveValue::UnitType::ValueID; | |
225 expValue.isID = true; | 224 expValue.isID = true; |
226 } else if (token.type() == NumberToken || token.type() == PercentageToke
n || token.type() == DimensionToken) { | 225 } else if (token.type() == NumberToken || token.type() == PercentageToke
n || token.type() == DimensionToken) { |
227 // Check for numeric token types since it is only safe for these typ
es to call numericValue. | 226 // Check for numeric token types since it is only safe for these typ
es to call numericValue. |
228 if (featureWithValidDensity(lowerMediaFeature, token) | 227 if (featureWithValidDensity(lowerMediaFeature, token) |
229 || featureWithValidPositiveLength(lowerMediaFeature, token)) { | 228 || featureWithValidPositiveLength(lowerMediaFeature, token)) { |
230 // Media features that must have non-negative <density>, ie. dpp
x, dpi or dpcm, | 229 // Media features that must have non-negative <density>, ie. dpp
x, dpi or dpcm, |
231 // or Media features that must have non-negative <length> or num
ber value. | 230 // or Media features that must have non-negative <length> or num
ber value. |
232 expValue.value = token.numericValue(); | 231 expValue.value = token.numericValue(); |
233 expValue.unit = token.unitType(); | 232 expValue.unit = token.unitType(); |
234 expValue.isValue = true; | 233 expValue.isValue = true; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 output.append('/'); | 310 output.append('/'); |
312 output.append(printNumber(denominator)); | 311 output.append(printNumber(denominator)); |
313 } else if (isID) { | 312 } else if (isID) { |
314 output.append(getValueName(id)); | 313 output.append(getValueName(id)); |
315 } | 314 } |
316 | 315 |
317 return output.toString(); | 316 return output.toString(); |
318 } | 317 } |
319 | 318 |
320 } // namespace blink | 319 } // namespace blink |
OLD | NEW |