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 return ((unit >= CSSPrimitiveValue::CSS_EMS && unit <= CSSPrimitiveValue::CS S_PC) | |
73 || unit == CSSPrimitiveValue::CSS_REMS || unit == CSSPrimitiveValue::CSS _CHS); | |
alancutter (OOO until 2018)
2014/07/29 03:25:15
A switch would be more explicit and readable here.
| |
74 } | |
75 | |
70 static inline bool featureWithValidPositiveLength(const String& mediaFeature, co nst CSSParserValue* value) | 76 static inline bool featureWithValidPositiveLength(const String& mediaFeature, co nst CSSParserValue* value) |
71 { | 77 { |
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) | 78 if (!(positiveLengthUnit(value->unit) || (value->unit == CSSPrimitiveValue:: CSS_NUMBER && !(value->fValue))) || value->fValue < 0) |
alancutter (OOO until 2018)
2014/07/29 03:25:15
It's within the style guide to make comparisons wi
| |
73 return false; | 79 return false; |
74 | 80 |
75 | 81 |
76 return mediaFeature == heightMediaFeature | 82 return mediaFeature == heightMediaFeature |
77 || mediaFeature == maxHeightMediaFeature | 83 || mediaFeature == maxHeightMediaFeature |
78 || mediaFeature == minHeightMediaFeature | 84 || mediaFeature == minHeightMediaFeature |
79 || mediaFeature == widthMediaFeature | 85 || mediaFeature == widthMediaFeature |
80 || mediaFeature == maxWidthMediaFeature | 86 || mediaFeature == maxWidthMediaFeature |
81 || mediaFeature == minWidthMediaFeature | 87 || mediaFeature == minWidthMediaFeature |
82 || mediaFeature == deviceHeightMediaFeature | 88 || mediaFeature == deviceHeightMediaFeature |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 output.append("/"); | 320 output.append("/"); |
315 output.append(printNumber(denominator)); | 321 output.append(printNumber(denominator)); |
316 } else if (isID) { | 322 } else if (isID) { |
317 output.append(getValueName(id)); | 323 output.append(getValueName(id)); |
318 } | 324 } |
319 | 325 |
320 return output.toString(); | 326 return output.toString(); |
321 } | 327 } |
322 | 328 |
323 } // namespace | 329 } // namespace |
OLD | NEW |