| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (mediaFeature == pointerMediaFeature) | 60 if (mediaFeature == pointerMediaFeature) |
| 61 return ident == CSSValueNone || ident == CSSValueCoarse || ident == CSSV
alueFine; | 61 return ident == CSSValueNone || ident == CSSValueCoarse || ident == CSSV
alueFine; |
| 62 | 62 |
| 63 if (mediaFeature == scanMediaFeature) | 63 if (mediaFeature == scanMediaFeature) |
| 64 return ident == CSSValueInterlace || ident == CSSValueProgressive; | 64 return ident == CSSValueInterlace || ident == CSSValueProgressive; |
| 65 | 65 |
| 66 ASSERT_NOT_REACHED(); | 66 ASSERT_NOT_REACHED(); |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 static bool positiveLengthUnit(const int unit) |
| 71 { |
| 72 switch (unit) { |
| 73 case CSSPrimitiveValue::CSS_EMS: |
| 74 case CSSPrimitiveValue::CSS_EXS: |
| 75 case CSSPrimitiveValue::CSS_PX: |
| 76 case CSSPrimitiveValue::CSS_CM: |
| 77 case CSSPrimitiveValue::CSS_MM: |
| 78 case CSSPrimitiveValue::CSS_IN: |
| 79 case CSSPrimitiveValue::CSS_PT: |
| 80 case CSSPrimitiveValue::CSS_PC: |
| 81 case CSSPrimitiveValue::CSS_REMS: |
| 82 case CSSPrimitiveValue::CSS_CHS: |
| 83 return true; |
| 84 } |
| 85 return false; |
| 86 } |
| 87 |
| 70 static inline bool featureWithValidPositiveLength(const String& mediaFeature, co
nst CSSParserValue* value) | 88 static inline bool featureWithValidPositiveLength(const String& mediaFeature, co
nst CSSParserValue* value) |
| 71 { | 89 { |
| 72 if (!(((value->unit >= CSSPrimitiveValue::CSS_EMS && value->unit <= CSSPrimi
tiveValue::CSS_PC) || value->unit == CSSPrimitiveValue::CSS_REMS) || (value->uni
t == CSSPrimitiveValue::CSS_NUMBER && !(value->fValue))) || value->fValue < 0) | 90 if (!(positiveLengthUnit(value->unit) || (value->unit == CSSPrimitiveValue::
CSS_NUMBER && value->fValue == 0)) || value->fValue < 0) |
| 73 return false; | 91 return false; |
| 74 | 92 |
| 75 | 93 |
| 76 return mediaFeature == heightMediaFeature | 94 return mediaFeature == heightMediaFeature |
| 77 || mediaFeature == maxHeightMediaFeature | 95 || mediaFeature == maxHeightMediaFeature |
| 78 || mediaFeature == minHeightMediaFeature | 96 || mediaFeature == minHeightMediaFeature |
| 79 || mediaFeature == widthMediaFeature | 97 || mediaFeature == widthMediaFeature |
| 80 || mediaFeature == maxWidthMediaFeature | 98 || mediaFeature == maxWidthMediaFeature |
| 81 || mediaFeature == minWidthMediaFeature | 99 || mediaFeature == minWidthMediaFeature |
| 82 || mediaFeature == deviceHeightMediaFeature | 100 || mediaFeature == deviceHeightMediaFeature |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 output.append("/"); | 332 output.append("/"); |
| 315 output.append(printNumber(denominator)); | 333 output.append(printNumber(denominator)); |
| 316 } else if (isID) { | 334 } else if (isID) { |
| 317 output.append(getValueName(id)); | 335 output.append(getValueName(id)); |
| 318 } | 336 } |
| 319 | 337 |
| 320 return output.toString(); | 338 return output.toString(); |
| 321 } | 339 } |
| 322 | 340 |
| 323 } // namespace | 341 } // namespace |
| OLD | NEW |