Chromium Code Reviews| 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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 PassOwnPtr<MediaQuery> CSSParser::parseMediaQuery(const String& string) | 1358 PassOwnPtr<MediaQuery> CSSParser::parseMediaQuery(const String& string) |
| 1359 { | 1359 { |
| 1360 if (string.isEmpty()) | 1360 if (string.isEmpty()) |
| 1361 return nullptr; | 1361 return nullptr; |
| 1362 | 1362 |
| 1363 ASSERT(!m_mediaQuery); | 1363 ASSERT(!m_mediaQuery); |
| 1364 | 1364 |
| 1365 // can't use { because tokenizer state switches from mediaquery to initial s tate when it sees { token. | 1365 // can't use { because tokenizer state switches from mediaquery to initial s tate when it sees { token. |
| 1366 // instead insert one " " (which is WHITESPACE in CSSGrammar.y) | 1366 // instead insert one " " (which is caught by maybe_space in CSSGrammar.y) |
| 1367 setupParser("@-webkit-mediaquery ", string, "} "); | 1367 setupParser("@-webkit-mediaquery ", string, "} "); |
| 1368 cssyyparse(this); | 1368 cssyyparse(this); |
| 1369 | 1369 |
| 1370 return m_mediaQuery.release(); | 1370 return m_mediaQuery.release(); |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 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) | 1373 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) |
| 1374 { | 1374 { |
| 1375 // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found. | 1375 // Add properties in reverse order so that highest priority definitions are reached first. Duplicate definitions can then be ignored when found. |
| 1376 for (int i = input.size() - 1; i >= 0; --i) { | 1376 for (int i = input.size() - 1; i >= 0; --i) { |
| (...skipping 8925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10302 m_token = IDENT; | 10302 m_token = IDENT; |
| 10303 | 10303 |
| 10304 if (UNLIKELY(*currentCharacter<SrcCharacterType>() == '(')) { | 10304 if (UNLIKELY(*currentCharacter<SrcCharacterType>() == '(')) { |
| 10305 if (m_parsingMode == SupportsMode && !hasEscape) { | 10305 if (m_parsingMode == SupportsMode && !hasEscape) { |
| 10306 detectSupportsToken<SrcCharacterType>(result - tokenStart<SrcCha racterType>()); | 10306 detectSupportsToken<SrcCharacterType>(result - tokenStart<SrcCha racterType>()); |
| 10307 if (m_token != IDENT) | 10307 if (m_token != IDENT) |
| 10308 break; | 10308 break; |
| 10309 } | 10309 } |
| 10310 | 10310 |
| 10311 m_token = FUNCTION; | 10311 m_token = FUNCTION; |
| 10312 bool shouldSkipParenthesis = true; | 10312 if (!hasEscape) |
|
SeRya
2013/06/01 06:28:03
It seems MediaQueryMode isn't used any longer and
rune
2013/06/03 09:08:11
It's still used for detectMediaQueryToken below.
| |
| 10313 if (!hasEscape) { | 10313 detectFunctionTypeToken<SrcCharacterType>(result - tokenStart<Sr cCharacterType>()); |
| 10314 bool detected = detectFunctionTypeToken<SrcCharacterType>(result - tokenStart<SrcCharacterType>()); | 10314 ++currentCharacter<SrcCharacterType>(); |
| 10315 if (!detected && m_parsingMode == MediaQueryMode) { | 10315 ++result; |
| 10316 // ... and(max-width: 480px) ... looks like a function, but in fact it is not, | 10316 ++yylval->string.m_length; |
| 10317 // so run more detection code in the MediaQueryMode. | |
| 10318 detectMediaQueryToken<SrcCharacterType>(result - tokenStart< SrcCharacterType>()); | |
| 10319 shouldSkipParenthesis = false; | |
| 10320 } | |
| 10321 } | |
| 10322 | |
| 10323 if (LIKELY(shouldSkipParenthesis)) { | |
| 10324 ++currentCharacter<SrcCharacterType>(); | |
| 10325 ++result; | |
| 10326 ++yylval->string.m_length; | |
| 10327 } | |
| 10328 | 10317 |
| 10329 if (token() == URI) { | 10318 if (token() == URI) { |
| 10330 m_token = FUNCTION; | 10319 m_token = FUNCTION; |
| 10331 // Check whether it is really an URI. | 10320 // Check whether it is really an URI. |
| 10332 if (yylval->string.is8Bit()) | 10321 if (yylval->string.is8Bit()) |
| 10333 parseURI<LChar>(yylval->string); | 10322 parseURI<LChar>(yylval->string); |
| 10334 else | 10323 else |
| 10335 parseURI<UChar>(yylval->string); | 10324 parseURI<UChar>(yylval->string); |
| 10336 } | 10325 } |
| 10337 } else if (UNLIKELY(m_parsingMode != NormalMode) && !hasEscape) { | 10326 } else if (UNLIKELY(m_parsingMode != NormalMode) && !hasEscape) { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10781 { | 10770 { |
| 10782 m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expres sions)); | 10771 m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expres sions)); |
| 10783 return m_floatingMediaQuery.get(); | 10772 return m_floatingMediaQuery.get(); |
| 10784 } | 10773 } |
| 10785 | 10774 |
| 10786 MediaQuery* CSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQu eryExp> > > expressions) | 10775 MediaQuery* CSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQu eryExp> > > expressions) |
| 10787 { | 10776 { |
| 10788 return createFloatingMediaQuery(MediaQuery::None, "all", expressions); | 10777 return createFloatingMediaQuery(MediaQuery::None, "all", expressions); |
| 10789 } | 10778 } |
| 10790 | 10779 |
| 10780 MediaQuery* CSSParser::createFloatingNotAllQuery() | |
| 10781 { | |
| 10782 return createFloatingMediaQuery(MediaQuery::Not, "all", sinkFloatingMediaQue ryExpList(createFloatingMediaQueryExpList())); | |
| 10783 } | |
| 10784 | |
| 10791 PassOwnPtr<MediaQuery> CSSParser::sinkFloatingMediaQuery(MediaQuery* query) | 10785 PassOwnPtr<MediaQuery> CSSParser::sinkFloatingMediaQuery(MediaQuery* query) |
| 10792 { | 10786 { |
| 10793 ASSERT_UNUSED(query, query == m_floatingMediaQuery); | 10787 ASSERT_UNUSED(query, query == m_floatingMediaQuery); |
| 10794 return m_floatingMediaQuery.release(); | 10788 return m_floatingMediaQuery.release(); |
| 10795 } | 10789 } |
| 10796 | 10790 |
| 10797 Vector<RefPtr<StyleKeyframe> >* CSSParser::createFloatingKeyframeVector() | 10791 Vector<RefPtr<StyleKeyframe> >* CSSParser::createFloatingKeyframeVector() |
| 10798 { | 10792 { |
| 10799 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); | 10793 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); |
| 10800 return m_floatingKeyframeVector.get(); | 10794 return m_floatingKeyframeVector.get(); |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11748 { | 11742 { |
| 11749 // The tokenizer checks for the construct of an+b. | 11743 // The tokenizer checks for the construct of an+b. |
| 11750 // However, since the {ident} rule precedes the {nth} rule, some of those | 11744 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11751 // tokens are identified as string literal. Furthermore we need to accept | 11745 // tokens are identified as string literal. Furthermore we need to accept |
| 11752 // "odd" and "even" which does not match to an+b. | 11746 // "odd" and "even" which does not match to an+b. |
| 11753 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11747 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11754 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11748 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11755 } | 11749 } |
| 11756 | 11750 |
| 11757 } | 11751 } |
| OLD | NEW |