| 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 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 9968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9979 else | 9979 else |
| 9980 m_currentRuleDataStack->last()->childRules.append(rule); | 9980 m_currentRuleDataStack->last()->childRules.append(rule); |
| 9981 } | 9981 } |
| 9982 | 9982 |
| 9983 PassRefPtr<CSSRuleSourceData> CSSParser::popRuleData() | 9983 PassRefPtr<CSSRuleSourceData> CSSParser::popRuleData() |
| 9984 { | 9984 { |
| 9985 if (!m_ruleSourceDataResult) | 9985 if (!m_ruleSourceDataResult) |
| 9986 return 0; | 9986 return 0; |
| 9987 | 9987 |
| 9988 ASSERT(!m_currentRuleDataStack->isEmpty()); | 9988 ASSERT(!m_currentRuleDataStack->isEmpty()); |
| 9989 m_currentRuleData.clear(); |
| 9989 RefPtr<CSSRuleSourceData> data = m_currentRuleDataStack->last(); | 9990 RefPtr<CSSRuleSourceData> data = m_currentRuleDataStack->last(); |
| 9990 m_currentRuleDataStack->removeLast(); | 9991 m_currentRuleDataStack->removeLast(); |
| 9991 return data.release(); | 9992 return data.release(); |
| 9992 } | 9993 } |
| 9993 | 9994 |
| 9994 StyleRuleKeyframes* CSSParser::createKeyframesRule(const String& name, PassOwnPt
r<Vector<RefPtr<StyleKeyframe> > > popKeyframes) | 9995 StyleRuleKeyframes* CSSParser::createKeyframesRule(const String& name, PassOwnPt
r<Vector<RefPtr<StyleKeyframe> > > popKeyframes) |
| 9995 { | 9996 { |
| 9996 OwnPtr<Vector<RefPtr<StyleKeyframe> > > keyframes = popKeyframes; | 9997 OwnPtr<Vector<RefPtr<StyleKeyframe> > > keyframes = popKeyframes; |
| 9997 m_allowImportRules = m_allowNamespaceDeclarations = false; | 9998 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 9998 RefPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create(); | 9999 RefPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create(); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10283 return; | 10284 return; |
| 10284 } | 10285 } |
| 10285 | 10286 |
| 10286 fixUnparsedProperties<UChar>(m_dataStart16.get() + m_parsedTextPrefixLength,
ruleData); | 10287 fixUnparsedProperties<UChar>(m_dataStart16.get() + m_parsedTextPrefixLength,
ruleData); |
| 10287 } | 10288 } |
| 10288 | 10289 |
| 10289 void CSSParser::markRuleHeaderStart(CSSRuleSourceData::Type ruleType) | 10290 void CSSParser::markRuleHeaderStart(CSSRuleSourceData::Type ruleType) |
| 10290 { | 10291 { |
| 10291 if (!isExtractingSourceData()) | 10292 if (!isExtractingSourceData()) |
| 10292 return; | 10293 return; |
| 10294 |
| 10295 // Pop off data for a previous invalid rule. |
| 10296 if (m_currentRuleData) |
| 10297 m_currentRuleDataStack->removeLast(); |
| 10298 |
| 10293 RefPtr<CSSRuleSourceData> data = CSSRuleSourceData::create(ruleType); | 10299 RefPtr<CSSRuleSourceData> data = CSSRuleSourceData::create(ruleType); |
| 10294 data->ruleHeaderRange.start = tokenStartOffset(); | 10300 data->ruleHeaderRange.start = tokenStartOffset(); |
| 10301 m_currentRuleData = data; |
| 10295 m_currentRuleDataStack->append(data.release()); | 10302 m_currentRuleDataStack->append(data.release()); |
| 10296 } | 10303 } |
| 10297 | 10304 |
| 10298 template <typename CharacterType> | 10305 template <typename CharacterType> |
| 10299 inline void CSSParser::setRuleHeaderEnd(const CharacterType* dataStart) | 10306 inline void CSSParser::setRuleHeaderEnd(const CharacterType* dataStart) |
| 10300 { | 10307 { |
| 10301 CharacterType* listEnd = tokenStart<CharacterType>(); | 10308 CharacterType* listEnd = tokenStart<CharacterType>(); |
| 10302 while (listEnd > dataStart + 1) { | 10309 while (listEnd > dataStart + 1) { |
| 10303 if (isHTMLSpace(*(listEnd - 1))) | 10310 if (isHTMLSpace(*(listEnd - 1))) |
| 10304 --listEnd; | 10311 --listEnd; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 10318 if (is8BitSource()) | 10325 if (is8BitSource()) |
| 10319 setRuleHeaderEnd<LChar>(m_dataStart8.get()); | 10326 setRuleHeaderEnd<LChar>(m_dataStart8.get()); |
| 10320 else | 10327 else |
| 10321 setRuleHeaderEnd<UChar>(m_dataStart16.get()); | 10328 setRuleHeaderEnd<UChar>(m_dataStart16.get()); |
| 10322 } | 10329 } |
| 10323 | 10330 |
| 10324 void CSSParser::markRuleBodyStart() | 10331 void CSSParser::markRuleBodyStart() |
| 10325 { | 10332 { |
| 10326 if (!isExtractingSourceData()) | 10333 if (!isExtractingSourceData()) |
| 10327 return; | 10334 return; |
| 10335 m_currentRuleData.clear(); |
| 10328 unsigned offset = tokenStartOffset(); | 10336 unsigned offset = tokenStartOffset(); |
| 10329 if (tokenStartChar() == '{') | 10337 if (tokenStartChar() == '{') |
| 10330 ++offset; // Skip the rule body opening brace. | 10338 ++offset; // Skip the rule body opening brace. |
| 10331 ASSERT(!m_currentRuleDataStack->isEmpty()); | 10339 ASSERT(!m_currentRuleDataStack->isEmpty()); |
| 10332 m_currentRuleDataStack->last()->ruleBodyRange.start = offset; | 10340 m_currentRuleDataStack->last()->ruleBodyRange.start = offset; |
| 10333 } | 10341 } |
| 10334 | 10342 |
| 10335 void CSSParser::markRuleBodyEnd() | 10343 void CSSParser::markRuleBodyEnd() |
| 10336 { | 10344 { |
| 10337 // Precondition: (!isExtractingSourceData()) | 10345 // Precondition: (!isExtractingSourceData()) |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10646 { | 10654 { |
| 10647 // The tokenizer checks for the construct of an+b. | 10655 // The tokenizer checks for the construct of an+b. |
| 10648 // However, since the {ident} rule precedes the {nth} rule, some of those | 10656 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 10649 // tokens are identified as string literal. Furthermore we need to accept | 10657 // tokens are identified as string literal. Furthermore we need to accept |
| 10650 // "odd" and "even" which does not match to an+b. | 10658 // "odd" and "even" which does not match to an+b. |
| 10651 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10659 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 10652 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10660 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 10653 } | 10661 } |
| 10654 | 10662 |
| 10655 } | 10663 } |
| OLD | NEW |