| OLD | NEW |
| 1 /* | 1 /* |
| 2 * CSS Media Query Evaluator | 2 * CSS Media Query Evaluator |
| 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) 2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 * Copyright (C) 2013 Intel Corporation. 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 UseCounter::count(mediaValues.document(), UseCounter::PrefixedDevicePixelRat
ioMediaFeature); | 308 UseCounter::count(mediaValues.document(), UseCounter::PrefixedDevicePixelRat
ioMediaFeature); |
| 309 | 309 |
| 310 return (!value.isValid() || value.unit == CSSPrimitiveValue::CSS_NUMBER) &&
evalResolution(value, op, mediaValues); | 310 return (!value.isValid() || value.unit == CSSPrimitiveValue::CSS_NUMBER) &&
evalResolution(value, op, mediaValues); |
| 311 } | 311 } |
| 312 | 312 |
| 313 static bool resolutionMediaFeatureEval(const MediaQueryExpValue& value, MediaFea
turePrefix op, const MediaValues& MediaValues) | 313 static bool resolutionMediaFeatureEval(const MediaQueryExpValue& value, MediaFea
turePrefix op, const MediaValues& MediaValues) |
| 314 { | 314 { |
| 315 return (!value.isValid() || CSSPrimitiveValue::isResolution(value.unit)) &&
evalResolution(value, op, MediaValues); | 315 return (!value.isValid() || CSSPrimitiveValue::isResolution(value.unit)) &&
evalResolution(value, op, MediaValues); |
| 316 } | 316 } |
| 317 | 317 |
| 318 static bool gridMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePr
efix op, const MediaValues&) | |
| 319 { | |
| 320 // if output device is bitmap, grid: 0 == true | |
| 321 // assume we have bitmap device | |
| 322 float number; | |
| 323 if (value.isValid() && numberValue(value, number)) | |
| 324 return compareValue(static_cast<int>(number), 0, op); | |
| 325 return false; | |
| 326 } | |
| 327 | |
| 328 static bool computeLength(const MediaQueryExpValue& value, const MediaValues& me
diaValues, int& result) | 318 static bool computeLength(const MediaQueryExpValue& value, const MediaValues& me
diaValues, int& result) |
| 329 { | 319 { |
| 330 if (!value.isValue) | 320 if (!value.isValue) |
| 331 return false; | 321 return false; |
| 332 | 322 |
| 333 if (value.unit == CSSPrimitiveValue::CSS_NUMBER) { | 323 if (value.unit == CSSPrimitiveValue::CSS_NUMBER) { |
| 334 result = clampTo<int>(value.value); | 324 result = clampTo<int>(value.value); |
| 335 return !mediaValues.strictMode() || !result; | 325 return !mediaValues.strictMode() || !result; |
| 336 } | 326 } |
| 337 | 327 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // Call the media feature evaluation function. Assume no prefix and let | 642 // Call the media feature evaluation function. Assume no prefix and let |
| 653 // trampoline functions override the prefix if prefix is used. | 643 // trampoline functions override the prefix if prefix is used. |
| 654 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 644 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
| 655 if (func) | 645 if (func) |
| 656 return func(expr->expValue(), NoPrefix, *m_mediaValues); | 646 return func(expr->expValue(), NoPrefix, *m_mediaValues); |
| 657 | 647 |
| 658 return false; | 648 return false; |
| 659 } | 649 } |
| 660 | 650 |
| 661 } // namespace | 651 } // namespace |
| OLD | NEW |