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 9548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9559 MediaQuerySet* CSSParser::createMediaQuerySet() | 9559 MediaQuerySet* CSSParser::createMediaQuerySet() |
9560 { | 9560 { |
9561 RefPtr<MediaQuerySet> queries = MediaQuerySet::create(); | 9561 RefPtr<MediaQuerySet> queries = MediaQuerySet::create(); |
9562 MediaQuerySet* result = queries.get(); | 9562 MediaQuerySet* result = queries.get(); |
9563 m_parsedMediaQuerySets.append(queries.release()); | 9563 m_parsedMediaQuerySets.append(queries.release()); |
9564 return result; | 9564 return result; |
9565 } | 9565 } |
9566 | 9566 |
9567 StyleRuleBase* CSSParser::createImportRule(const CSSParserString& url, MediaQuer
ySet* media) | 9567 StyleRuleBase* CSSParser::createImportRule(const CSSParserString& url, MediaQuer
ySet* media) |
9568 { | 9568 { |
9569 if (!media || !m_allowImportRules) | 9569 if (!media || !m_allowImportRules) { |
| 9570 popRuleData(); |
9570 return 0; | 9571 return 0; |
| 9572 } |
9571 RefPtr<StyleRuleImport> rule = StyleRuleImport::create(url, media); | 9573 RefPtr<StyleRuleImport> rule = StyleRuleImport::create(url, media); |
9572 StyleRuleImport* result = rule.get(); | 9574 StyleRuleImport* result = rule.get(); |
9573 m_parsedRules.append(rule.release()); | 9575 m_parsedRules.append(rule.release()); |
9574 processAndAddNewRuleToSourceTreeIfNeeded(); | 9576 processAndAddNewRuleToSourceTreeIfNeeded(); |
9575 return result; | 9577 return result; |
9576 } | 9578 } |
9577 | 9579 |
9578 StyleRuleBase* CSSParser::createMediaRule(MediaQuerySet* media, RuleList* rules) | 9580 StyleRuleBase* CSSParser::createMediaRule(MediaQuerySet* media, RuleList* rules) |
9579 { | 9581 { |
9580 m_allowImportRules = m_allowNamespaceDeclarations = false; | 9582 m_allowImportRules = m_allowNamespaceDeclarations = false; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9672 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { | 9674 for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { |
9673 CSSProperty& property = m_parsedProperties[i]; | 9675 CSSProperty& property = m_parsedProperties[i]; |
9674 if (property.id() == CSSPropertyFontVariant && property.value()->isPrimi
tiveValue()) | 9676 if (property.id() == CSSPropertyFontVariant && property.value()->isPrimi
tiveValue()) |
9675 property.wrapValueInCommaSeparatedList(); | 9677 property.wrapValueInCommaSeparatedList(); |
9676 else if (property.id() == CSSPropertyFontFamily && (!property.value()->i
sValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) { | 9678 else if (property.id() == CSSPropertyFontFamily && (!property.value()->i
sValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) { |
9677 // Unlike font-family property, font-family descriptor in @font-face
rule | 9679 // Unlike font-family property, font-family descriptor in @font-face
rule |
9678 // has to be a value list with exactly one family name. It cannot ha
ve a | 9680 // has to be a value list with exactly one family name. It cannot ha
ve a |
9679 // have 'initial' value and cannot 'inherit' from parent. | 9681 // have 'initial' value and cannot 'inherit' from parent. |
9680 // See http://dev.w3.org/csswg/css3-fonts/#font-family-desc | 9682 // See http://dev.w3.org/csswg/css3-fonts/#font-family-desc |
9681 clearProperties(); | 9683 clearProperties(); |
| 9684 popRuleData(); |
9682 return 0; | 9685 return 0; |
9683 } | 9686 } |
9684 } | 9687 } |
9685 RefPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create(); | 9688 RefPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create(); |
9686 rule->setProperties(createStylePropertySet()); | 9689 rule->setProperties(createStylePropertySet()); |
9687 clearProperties(); | 9690 clearProperties(); |
9688 StyleRuleFontFace* result = rule.get(); | 9691 StyleRuleFontFace* result = rule.get(); |
9689 m_parsedRules.append(rule.release()); | 9692 m_parsedRules.append(rule.release()); |
9690 processAndAddNewRuleToSourceTreeIfNeeded(); | 9693 processAndAddNewRuleToSourceTreeIfNeeded(); |
9691 return result; | 9694 return result; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9761 StyleRulePage* pageRule = 0; | 9764 StyleRulePage* pageRule = 0; |
9762 if (pageSelector) { | 9765 if (pageSelector) { |
9763 RefPtr<StyleRulePage> rule = StyleRulePage::create(); | 9766 RefPtr<StyleRulePage> rule = StyleRulePage::create(); |
9764 Vector<OwnPtr<CSSParserSelector> > selectorVector; | 9767 Vector<OwnPtr<CSSParserSelector> > selectorVector; |
9765 selectorVector.append(pageSelector); | 9768 selectorVector.append(pageSelector); |
9766 rule->parserAdoptSelectorVector(selectorVector); | 9769 rule->parserAdoptSelectorVector(selectorVector); |
9767 rule->setProperties(createStylePropertySet()); | 9770 rule->setProperties(createStylePropertySet()); |
9768 pageRule = rule.get(); | 9771 pageRule = rule.get(); |
9769 m_parsedRules.append(rule.release()); | 9772 m_parsedRules.append(rule.release()); |
9770 processAndAddNewRuleToSourceTreeIfNeeded(); | 9773 processAndAddNewRuleToSourceTreeIfNeeded(); |
9771 } | 9774 } else |
| 9775 popRuleData(); |
9772 clearProperties(); | 9776 clearProperties(); |
9773 return pageRule; | 9777 return pageRule; |
9774 } | 9778 } |
9775 | 9779 |
9776 void CSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSelector>
>* selectors) | 9780 void CSSParser::setReusableRegionSelectorVector(Vector<OwnPtr<CSSParserSelector>
>* selectors) |
9777 { | 9781 { |
9778 if (selectors) | 9782 if (selectors) |
9779 m_reusableRegionSelectorVector.swap(*selectors); | 9783 m_reusableRegionSelectorVector.swap(*selectors); |
9780 } | 9784 } |
9781 | 9785 |
9782 StyleRuleBase* CSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector> >* r
egionSelector, RuleList* rules) | 9786 StyleRuleBase* CSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector> >* r
egionSelector, RuleList* rules) |
9783 { | 9787 { |
9784 if (!cssRegionsEnabled() || !regionSelector || !rules) | 9788 if (!cssRegionsEnabled() || !regionSelector || !rules) { |
| 9789 popRuleData(); |
9785 return 0; | 9790 return 0; |
| 9791 } |
9786 | 9792 |
9787 m_allowImportRules = m_allowNamespaceDeclarations = false; | 9793 m_allowImportRules = m_allowNamespaceDeclarations = false; |
9788 | 9794 |
9789 RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector,
*rules); | 9795 RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector,
*rules); |
9790 | 9796 |
9791 StyleRuleRegion* result = regionRule.get(); | 9797 StyleRuleRegion* result = regionRule.get(); |
9792 m_parsedRules.append(regionRule.release()); | 9798 m_parsedRules.append(regionRule.release()); |
9793 if (isExtractingSourceData()) | 9799 if (isExtractingSourceData()) |
9794 addNewRuleToSourceTree(CSSRuleSourceData::createUnknown()); | 9800 addNewRuleToSourceTree(CSSRuleSourceData::createUnknown()); |
9795 | 9801 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10220 { | 10226 { |
10221 // The tokenizer checks for the construct of an+b. | 10227 // The tokenizer checks for the construct of an+b. |
10222 // However, since the {ident} rule precedes the {nth} rule, some of those | 10228 // However, since the {ident} rule precedes the {nth} rule, some of those |
10223 // tokens are identified as string literal. Furthermore we need to accept | 10229 // tokens are identified as string literal. Furthermore we need to accept |
10224 // "odd" and "even" which does not match to an+b. | 10230 // "odd" and "even" which does not match to an+b. |
10225 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10231 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
10226 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10232 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
10227 } | 10233 } |
10228 | 10234 |
10229 } | 10235 } |
OLD | NEW |