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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 expValue.id = value->id; | 235 expValue.id = value->id; |
236 expValue.unit = CSSPrimitiveValue::CSS_VALUE_ID; | 236 expValue.unit = CSSPrimitiveValue::CSS_VALUE_ID; |
237 expValue.isID = true; | 237 expValue.isID = true; |
238 } else if (featureWithValidDensity(lowerMediaFeature, value) | 238 } else if (featureWithValidDensity(lowerMediaFeature, value) |
239 || featureWithValidPositiveLength(lowerMediaFeature, value)) { | 239 || featureWithValidPositiveLength(lowerMediaFeature, value)) { |
240 // Media features that must have non-negative <density>, ie. dpp
x, dpi or dpcm, | 240 // Media features that must have non-negative <density>, ie. dpp
x, dpi or dpcm, |
241 // or Media features that must have non-negative <length> or num
ber value. | 241 // or Media features that must have non-negative <length> or num
ber value. |
242 expValue.value = value->fValue; | 242 expValue.value = value->fValue; |
243 expValue.unit = (CSSPrimitiveValue::UnitType)value->unit; | 243 expValue.unit = (CSSPrimitiveValue::UnitType)value->unit; |
244 expValue.isValue = true; | 244 expValue.isValue = true; |
245 expValue.isInteger = value->isInt; | |
246 } else if (featureWithPositiveInteger(lowerMediaFeature, value) | 245 } else if (featureWithPositiveInteger(lowerMediaFeature, value) |
247 || featureWithPositiveNumber(lowerMediaFeature, value) | 246 || featureWithPositiveNumber(lowerMediaFeature, value) |
248 || featureWithZeroOrOne(lowerMediaFeature, value)) { | 247 || featureWithZeroOrOne(lowerMediaFeature, value)) { |
249 // Media features that must have non-negative integer value, | 248 // Media features that must have non-negative integer value, |
250 // or media features that must have non-negative number value, | 249 // or media features that must have non-negative number value, |
251 // or media features that must have (0|1) value. | 250 // or media features that must have (0|1) value. |
252 expValue.value = value->fValue; | 251 expValue.value = value->fValue; |
253 expValue.unit = CSSPrimitiveValue::CSS_NUMBER; | 252 expValue.unit = CSSPrimitiveValue::CSS_NUMBER; |
254 expValue.isValue = true; | 253 expValue.isValue = true; |
255 expValue.isInteger = value->isInt; | |
256 } | 254 } |
257 | 255 |
258 isValid = (expValue.isID || expValue.isValue); | 256 isValid = (expValue.isID || expValue.isValue); |
259 | 257 |
260 } else if (valueList->size() == 3 && featureWithAspectRatio(lowerMediaFe
ature)) { | 258 } else if (valueList->size() == 3 && featureWithAspectRatio(lowerMediaFe
ature)) { |
261 // Create list of values. | 259 // Create list of values. |
262 // Currently accepts only <integer>/<integer>. | 260 // Currently accepts only <integer>/<integer>. |
263 // Applicable to device-aspect-ratio and aspec-ratio. | 261 // Applicable to device-aspect-ratio and aspec-ratio. |
264 isValid = true; | 262 isValid = true; |
265 float numeratorValue = 0; | 263 float numeratorValue = 0; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 output.append("/"); | 335 output.append("/"); |
338 output.append(printNumber(denominator)); | 336 output.append(printNumber(denominator)); |
339 } else if (isID) { | 337 } else if (isID) { |
340 output.append(getValueName(id)); | 338 output.append(getValueName(id)); |
341 } | 339 } |
342 | 340 |
343 return output.toString(); | 341 return output.toString(); |
344 } | 342 } |
345 | 343 |
346 } // namespace | 344 } // namespace |
OLD | NEW |