| 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 8942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10319 } | 10319 } |
| 10320 | 10320 |
| 10321 m_token = FUNCTION; | 10321 m_token = FUNCTION; |
| 10322 bool shouldSkipParenthesis = true; | 10322 bool shouldSkipParenthesis = true; |
| 10323 if (!hasEscape) { | 10323 if (!hasEscape) { |
| 10324 bool detected = detectFunctionTypeToken<SrcCharacterType>(result
- tokenStart<SrcCharacterType>()); | 10324 bool detected = detectFunctionTypeToken<SrcCharacterType>(result
- tokenStart<SrcCharacterType>()); |
| 10325 if (!detected && m_parsingMode == MediaQueryMode) { | 10325 if (!detected && m_parsingMode == MediaQueryMode) { |
| 10326 // ... and(max-width: 480px) ... looks like a function, but
in fact it is not, | 10326 // ... and(max-width: 480px) ... looks like a function, but
in fact it is not, |
| 10327 // so run more detection code in the MediaQueryMode. | 10327 // so run more detection code in the MediaQueryMode. |
| 10328 detectMediaQueryToken<SrcCharacterType>(result - tokenStart<
SrcCharacterType>()); | 10328 detectMediaQueryToken<SrcCharacterType>(result - tokenStart<
SrcCharacterType>()); |
| 10329 shouldSkipParenthesis = false; | 10329 if (m_token == MEDIA_AND) |
| 10330 shouldSkipParenthesis = false; |
| 10330 } | 10331 } |
| 10331 } | 10332 } |
| 10332 | 10333 |
| 10333 if (LIKELY(shouldSkipParenthesis)) { | 10334 if (LIKELY(shouldSkipParenthesis)) { |
| 10334 ++currentCharacter<SrcCharacterType>(); | 10335 ++currentCharacter<SrcCharacterType>(); |
| 10335 ++result; | 10336 ++result; |
| 10336 ++yylval->string.m_length; | 10337 ++yylval->string.m_length; |
| 10337 } | 10338 } |
| 10338 | 10339 |
| 10339 if (token() == URI) { | 10340 if (token() == URI) { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10791 { | 10792 { |
| 10792 m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expres
sions)); | 10793 m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expres
sions)); |
| 10793 return m_floatingMediaQuery.get(); | 10794 return m_floatingMediaQuery.get(); |
| 10794 } | 10795 } |
| 10795 | 10796 |
| 10796 MediaQuery* CSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQu
eryExp> > > expressions) | 10797 MediaQuery* CSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQu
eryExp> > > expressions) |
| 10797 { | 10798 { |
| 10798 return createFloatingMediaQuery(MediaQuery::None, "all", expressions); | 10799 return createFloatingMediaQuery(MediaQuery::None, "all", expressions); |
| 10799 } | 10800 } |
| 10800 | 10801 |
| 10802 MediaQuery* CSSParser::createFloatingNotAllQuery() |
| 10803 { |
| 10804 return createFloatingMediaQuery(MediaQuery::Not, "all", sinkFloatingMediaQue
ryExpList(createFloatingMediaQueryExpList())); |
| 10805 } |
| 10806 |
| 10801 PassOwnPtr<MediaQuery> CSSParser::sinkFloatingMediaQuery(MediaQuery* query) | 10807 PassOwnPtr<MediaQuery> CSSParser::sinkFloatingMediaQuery(MediaQuery* query) |
| 10802 { | 10808 { |
| 10803 ASSERT_UNUSED(query, query == m_floatingMediaQuery); | 10809 ASSERT_UNUSED(query, query == m_floatingMediaQuery); |
| 10804 return m_floatingMediaQuery.release(); | 10810 return m_floatingMediaQuery.release(); |
| 10805 } | 10811 } |
| 10806 | 10812 |
| 10807 Vector<RefPtr<StyleKeyframe> >* CSSParser::createFloatingKeyframeVector() | 10813 Vector<RefPtr<StyleKeyframe> >* CSSParser::createFloatingKeyframeVector() |
| 10808 { | 10814 { |
| 10809 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); | 10815 m_floatingKeyframeVector = adoptPtr(new Vector<RefPtr<StyleKeyframe> >()); |
| 10810 return m_floatingKeyframeVector.get(); | 10816 return m_floatingKeyframeVector.get(); |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11758 { | 11764 { |
| 11759 // The tokenizer checks for the construct of an+b. | 11765 // The tokenizer checks for the construct of an+b. |
| 11760 // However, since the {ident} rule precedes the {nth} rule, some of those | 11766 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11761 // tokens are identified as string literal. Furthermore we need to accept | 11767 // tokens are identified as string literal. Furthermore we need to accept |
| 11762 // "odd" and "even" which does not match to an+b. | 11768 // "odd" and "even" which does not match to an+b. |
| 11763 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11769 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11764 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11770 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11765 } | 11771 } |
| 11766 | 11772 |
| 11767 } | 11773 } |
| OLD | NEW |