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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 const Vector<CSSParserToken, 4>& tokenList) { | 208 const Vector<CSSParserToken, 4>& tokenList) { |
209 ASSERT(!mediaFeature.isNull()); | 209 ASSERT(!mediaFeature.isNull()); |
210 | 210 |
211 MediaQueryExpValue expValue; | 211 MediaQueryExpValue expValue; |
212 String lowerMediaFeature = attemptStaticStringCreation(mediaFeature.lower()); | 212 String lowerMediaFeature = attemptStaticStringCreation(mediaFeature.lower()); |
213 | 213 |
214 // Create value for media query expression that must have 1 or more values. | 214 // Create value for media query expression that must have 1 or more values. |
215 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { | 215 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { |
216 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue | 216 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue |
217 } else if (tokenList.size() == 1) { | 217 } else if (tokenList.size() == 1) { |
218 CSSParserToken token = tokenList.first(); | 218 CSSParserToken token = tokenList.front(); |
219 | 219 |
220 if (token.type() == IdentToken) { | 220 if (token.type() == IdentToken) { |
221 CSSValueID ident = token.id(); | 221 CSSValueID ident = token.id(); |
222 if (!featureWithValidIdent(lowerMediaFeature, ident)) | 222 if (!featureWithValidIdent(lowerMediaFeature, ident)) |
223 return nullptr; | 223 return nullptr; |
224 expValue.id = ident; | 224 expValue.id = ident; |
225 expValue.isID = true; | 225 expValue.isID = true; |
226 } else if (token.type() == NumberToken || token.type() == PercentageToken || | 226 } else if (token.type() == NumberToken || token.type() == PercentageToken || |
227 token.type() == DimensionToken) { | 227 token.type() == DimensionToken) { |
228 // Check for numeric token types since it is only safe for these types to | 228 // Check for numeric token types since it is only safe for these types to |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 output.append('/'); | 312 output.append('/'); |
313 output.append(printNumber(denominator)); | 313 output.append(printNumber(denominator)); |
314 } else if (isID) { | 314 } else if (isID) { |
315 output.append(getValueName(id)); | 315 output.append(getValueName(id)); |
316 } | 316 } |
317 | 317 |
318 return output.toString(); | 318 return output.toString(); |
319 } | 319 } |
320 | 320 |
321 } // namespace blink | 321 } // namespace blink |
OLD | NEW |