| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 clearProperties(); | 1342 clearProperties(); |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 if (m_sourceDataHandler) | 1345 if (m_sourceDataHandler) |
| 1346 m_sourceDataHandler->endRuleBody(string.length(), false); | 1346 m_sourceDataHandler->endRuleBody(string.length(), false); |
| 1347 m_sourceDataHandler = 0; | 1347 m_sourceDataHandler = 0; |
| 1348 | 1348 |
| 1349 return ok; | 1349 return ok; |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 PassOwnPtr<MediaQuery> CSSParser::parseMediaQuery(const String& string) | 1352 PassRefPtr<MediaQuerySet> CSSParser::parseMediaQueryList(const String& string) |
| 1353 { | 1353 { |
| 1354 if (string.isEmpty()) | 1354 ASSERT(!m_mediaList); |
| 1355 return nullptr; | |
| 1356 | |
| 1357 ASSERT(!m_mediaQuery); | |
| 1358 | 1355 |
| 1359 // can't use { because tokenizer state switches from mediaquery to initial s
tate when it sees { token. | 1356 // can't use { because tokenizer state switches from mediaquery to initial s
tate when it sees { token. |
| 1360 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y) | 1357 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y) |
| 1361 setupParser("@-webkit-mediaquery ", string, "} "); | 1358 setupParser("@-internal-medialist ", string, ""); |
| 1362 cssyyparse(this); | 1359 cssyyparse(this); |
| 1363 | 1360 |
| 1364 return m_mediaQuery.release(); | 1361 ASSERT(m_mediaList.get()); |
| 1362 return m_mediaList.release(); |
| 1365 } | 1363 } |
| 1366 | 1364 |
| 1367 static inline void filterProperties(bool important, const CSSParser::ParsedPrope
rtyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitAr
ray<numCSSProperties>& seenProperties, HashSet<AtomicString>& seenVariables) | 1365 static inline void filterProperties(bool important, const CSSParser::ParsedPrope
rtyVector& input, Vector<CSSProperty, 256>& output, size_t& unusedEntries, BitAr
ray<numCSSProperties>& seenProperties, HashSet<AtomicString>& seenVariables) |
| 1368 { | 1366 { |
| 1369 // Add properties in reverse order so that highest priority definitions are
reached first. Duplicate definitions can then be ignored when found. | 1367 // Add properties in reverse order so that highest priority definitions are
reached first. Duplicate definitions can then be ignored when found. |
| 1370 for (int i = input.size() - 1; i >= 0; --i) { | 1368 for (int i = input.size() - 1; i >= 0; --i) { |
| 1371 const CSSProperty& property = input[i]; | 1369 const CSSProperty& property = input[i]; |
| 1372 if (property.isImportant() != important) | 1370 if (property.isImportant() != important) |
| 1373 continue; | 1371 continue; |
| 1374 if (property.id() == CSSPropertyVariable) { | 1372 if (property.id() == CSSPropertyVariable) { |
| (...skipping 8887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10262 m_token = WEBKIT_VIEWPORT_RULE_SYM; | 10260 m_token = WEBKIT_VIEWPORT_RULE_SYM; |
| 10263 #endif | 10261 #endif |
| 10264 return; | 10262 return; |
| 10265 | 10263 |
| 10266 case 18: | 10264 case 18: |
| 10267 if (isEqualToCSSIdentifier(name + 2, "webkit-keyframes")) | 10265 if (isEqualToCSSIdentifier(name + 2, "webkit-keyframes")) |
| 10268 m_token = WEBKIT_KEYFRAMES_SYM; | 10266 m_token = WEBKIT_KEYFRAMES_SYM; |
| 10269 return; | 10267 return; |
| 10270 | 10268 |
| 10271 case 19: | 10269 case 19: |
| 10272 if (!hasEscape && isASCIIAlphaCaselessEqual(name[18], 'r') && isEqua
lToCSSIdentifier(name + 2, "internal-selecto")) { | 10270 if (!hasEscape && isASCIIAlphaCaselessEqual(name[18], 'r') && isEqua
lToCSSIdentifier(name + 2, "internal-selecto")) |
| 10273 m_token = INTERNAL_SELECTOR_SYM; | 10271 m_token = INTERNAL_SELECTOR_SYM; |
| 10274 return; | 10272 return; |
| 10275 } | |
| 10276 | 10273 |
| 10277 if (isEqualToCSSIdentifier(name + 2, "webkit-mediaquery")) { | 10274 case 20: |
| 10275 if (isEqualToCSSIdentifier(name + 2, "internal-medialist")) { |
| 10278 m_parsingMode = MediaQueryMode; | 10276 m_parsingMode = MediaQueryMode; |
| 10279 m_token = WEBKIT_MEDIAQUERY_SYM; | 10277 m_token = INTERNAL_MEDIALIST_SYM; |
| 10280 } | 10278 } |
| 10281 return; | 10279 return; |
| 10282 | 10280 |
| 10283 case 22: | 10281 case 22: |
| 10284 if (!hasEscape && isEqualToCSSIdentifier(name + 2, "webkit-keyframe-
rule")) | 10282 if (!hasEscape && isEqualToCSSIdentifier(name + 2, "webkit-keyframe-
rule")) |
| 10285 m_token = WEBKIT_KEYFRAME_RULE_SYM; | 10283 m_token = WEBKIT_KEYFRAME_RULE_SYM; |
| 10286 return; | 10284 return; |
| 10287 | 10285 |
| 10288 case 27: | 10286 case 27: |
| 10289 if (isEqualToCSSIdentifier(name + 2, "webkit-supports-condition")) { | 10287 if (isEqualToCSSIdentifier(name + 2, "webkit-supports-condition")) { |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11804 { | 11802 { |
| 11805 // The tokenizer checks for the construct of an+b. | 11803 // The tokenizer checks for the construct of an+b. |
| 11806 // However, since the {ident} rule precedes the {nth} rule, some of those | 11804 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11807 // tokens are identified as string literal. Furthermore we need to accept | 11805 // tokens are identified as string literal. Furthermore we need to accept |
| 11808 // "odd" and "even" which does not match to an+b. | 11806 // "odd" and "even" which does not match to an+b. |
| 11809 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11807 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11810 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11808 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11811 } | 11809 } |
| 11812 | 11810 |
| 11813 } | 11811 } |
| OLD | NEW |