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 9907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9918 MediaQuerySet* CSSParser::createMediaQuerySet() | 9918 MediaQuerySet* CSSParser::createMediaQuerySet() |
9919 { | 9919 { |
9920 RefPtr<MediaQuerySet> queries = MediaQuerySet::create(); | 9920 RefPtr<MediaQuerySet> queries = MediaQuerySet::create(); |
9921 MediaQuerySet* result = queries.get(); | 9921 MediaQuerySet* result = queries.get(); |
9922 m_parsedMediaQuerySets.append(queries.release()); | 9922 m_parsedMediaQuerySets.append(queries.release()); |
9923 return result; | 9923 return result; |
9924 } | 9924 } |
9925 | 9925 |
9926 StyleRuleBase* CSSParser::createImportRule(const CSSParserString& url, MediaQuer
ySet* media) | 9926 StyleRuleBase* CSSParser::createImportRule(const CSSParserString& url, MediaQuer
ySet* media) |
9927 { | 9927 { |
9928 if (!media || !m_allowImportRules) | 9928 if (!media || !m_allowImportRules) { |
| 9929 popRuleData(); |
9929 return 0; | 9930 return 0; |
| 9931 } |
9930 RefPtr<StyleRuleImport> rule = StyleRuleImport::create(url, media); | 9932 RefPtr<StyleRuleImport> rule = StyleRuleImport::create(url, media); |
9931 StyleRuleImport* result = rule.get(); | 9933 StyleRuleImport* result = rule.get(); |
9932 m_parsedRules.append(rule.release()); | 9934 m_parsedRules.append(rule.release()); |
9933 processAndAddNewRuleToSourceTreeIfNeeded(); | 9935 processAndAddNewRuleToSourceTreeIfNeeded(); |
9934 return result; | 9936 return result; |
9935 } | 9937 } |
9936 | 9938 |
9937 StyleRuleBase* CSSParser::createMediaRule(MediaQuerySet* media, RuleList* rules) | 9939 StyleRuleBase* CSSParser::createMediaRule(MediaQuerySet* media, RuleList* rules) |
9938 { | 9940 { |
9939 m_allowImportRules = m_allowNamespaceDeclarations = false; | 9941 m_allowImportRules = m_allowNamespaceDeclarations = false; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10031 for (unsigned i = 0; i < m_parsedProperties->size(); ++i) { | 10033 for (unsigned i = 0; i < m_parsedProperties->size(); ++i) { |
10032 CSSProperty& property = m_parsedProperties->at(i); | 10034 CSSProperty& property = m_parsedProperties->at(i); |
10033 if (property.id() == CSSPropertyFontVariant && property.value()->isPrimi
tiveValue()) | 10035 if (property.id() == CSSPropertyFontVariant && property.value()->isPrimi
tiveValue()) |
10034 property.wrapValueInCommaSeparatedList(); | 10036 property.wrapValueInCommaSeparatedList(); |
10035 else if (property.id() == CSSPropertyFontFamily && (!property.value()->i
sValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) { | 10037 else if (property.id() == CSSPropertyFontFamily && (!property.value()->i
sValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) { |
10036 // Unlike font-family property, font-family descriptor in @font-face
rule | 10038 // Unlike font-family property, font-family descriptor in @font-face
rule |
10037 // has to be a value list with exactly one family name. It cannot ha
ve a | 10039 // has to be a value list with exactly one family name. It cannot ha
ve a |
10038 // have 'initial' value and cannot 'inherit' from parent. | 10040 // have 'initial' value and cannot 'inherit' from parent. |
10039 // See http://dev.w3.org/csswg/css3-fonts/#font-family-desc | 10041 // See http://dev.w3.org/csswg/css3-fonts/#font-family-desc |
10040 clearProperties(); | 10042 clearProperties(); |
| 10043 popRuleData(); |
10041 return 0; | 10044 return 0; |
10042 } | 10045 } |
10043 } | 10046 } |
10044 RefPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create(); | 10047 RefPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create(); |
10045 rule->setProperties(createStylePropertySet()); | 10048 rule->setProperties(createStylePropertySet()); |
10046 clearProperties(); | 10049 clearProperties(); |
10047 StyleRuleFontFace* result = rule.get(); | 10050 StyleRuleFontFace* result = rule.get(); |
10048 m_parsedRules.append(rule.release()); | 10051 m_parsedRules.append(rule.release()); |
10049 processAndAddNewRuleToSourceTreeIfNeeded(); | 10052 processAndAddNewRuleToSourceTreeIfNeeded(); |
10050 return result; | 10053 return result; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10120 StyleRulePage* pageRule = 0; | 10123 StyleRulePage* pageRule = 0; |
10121 if (pageSelector) { | 10124 if (pageSelector) { |
10122 RefPtr<StyleRulePage> rule = StyleRulePage::create(); | 10125 RefPtr<StyleRulePage> rule = StyleRulePage::create(); |
10123 CSSSelectorVector selectorVector; | 10126 CSSSelectorVector selectorVector; |
10124 selectorVector.append(pageSelector); | 10127 selectorVector.append(pageSelector); |
10125 rule->parserAdoptSelectorVector(selectorVector); | 10128 rule->parserAdoptSelectorVector(selectorVector); |
10126 rule->setProperties(createStylePropertySet()); | 10129 rule->setProperties(createStylePropertySet()); |
10127 pageRule = rule.get(); | 10130 pageRule = rule.get(); |
10128 m_parsedRules.append(rule.release()); | 10131 m_parsedRules.append(rule.release()); |
10129 processAndAddNewRuleToSourceTreeIfNeeded(); | 10132 processAndAddNewRuleToSourceTreeIfNeeded(); |
10130 } | 10133 } else |
| 10134 popRuleData(); |
10131 clearProperties(); | 10135 clearProperties(); |
10132 return pageRule; | 10136 return pageRule; |
10133 } | 10137 } |
10134 | 10138 |
10135 void CSSParser::setReusableRegionSelectorVector(CSSSelectorVector* selectors) | 10139 void CSSParser::setReusableRegionSelectorVector(CSSSelectorVector* selectors) |
10136 { | 10140 { |
10137 if (selectors) | 10141 if (selectors) |
10138 m_reusableRegionSelectorVector.swap(*selectors); | 10142 m_reusableRegionSelectorVector.swap(*selectors); |
10139 } | 10143 } |
10140 | 10144 |
10141 StyleRuleBase* CSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector> >* r
egionSelector, RuleList* rules) | 10145 StyleRuleBase* CSSParser::createRegionRule(Vector<OwnPtr<CSSParserSelector> >* r
egionSelector, RuleList* rules) |
10142 { | 10146 { |
10143 if (!cssRegionsEnabled() || !regionSelector || !rules) | 10147 if (!cssRegionsEnabled() || !regionSelector || !rules) { |
| 10148 popRuleData(); |
10144 return 0; | 10149 return 0; |
| 10150 } |
10145 | 10151 |
10146 m_allowImportRules = m_allowNamespaceDeclarations = false; | 10152 m_allowImportRules = m_allowNamespaceDeclarations = false; |
10147 | 10153 |
10148 RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector,
*rules); | 10154 RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector,
*rules); |
10149 | 10155 |
10150 StyleRuleRegion* result = regionRule.get(); | 10156 StyleRuleRegion* result = regionRule.get(); |
10151 m_parsedRules.append(regionRule.release()); | 10157 m_parsedRules.append(regionRule.release()); |
10152 if (isExtractingSourceData()) | 10158 if (isExtractingSourceData()) |
10153 addNewRuleToSourceTree(CSSRuleSourceData::createUnknown()); | 10159 addNewRuleToSourceTree(CSSRuleSourceData::createUnknown()); |
10154 | 10160 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10654 { | 10660 { |
10655 // The tokenizer checks for the construct of an+b. | 10661 // The tokenizer checks for the construct of an+b. |
10656 // However, since the {ident} rule precedes the {nth} rule, some of those | 10662 // However, since the {ident} rule precedes the {nth} rule, some of those |
10657 // tokens are identified as string literal. Furthermore we need to accept | 10663 // tokens are identified as string literal. Furthermore we need to accept |
10658 // "odd" and "even" which does not match to an+b. | 10664 // "odd" and "even" which does not match to an+b. |
10659 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 10665 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
10660 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 10666 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
10661 } | 10667 } |
10662 | 10668 |
10663 } | 10669 } |
OLD | NEW |