| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 using namespace WTF; | 102 using namespace WTF; |
| 103 | 103 |
| 104 namespace WebCore { | 104 namespace WebCore { |
| 105 | 105 |
| 106 static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX; | 106 static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX; |
| 107 | 107 |
| 108 BisonCSSParser::BisonCSSParser(const CSSParserContext& context) | 108 BisonCSSParser::BisonCSSParser(const CSSParserContext& context) |
| 109 : m_context(context) | 109 : m_context(context) |
| 110 , m_important(false) | 110 , m_important(false) |
| 111 , m_id(CSSPropertyInvalid) | 111 , m_id(CSSPropertyInvalid) |
| 112 , m_styleSheet(0) | 112 , m_styleSheet(nullptr) |
| 113 , m_supportsCondition(false) | 113 , m_supportsCondition(false) |
| 114 , m_selectorListForParseSelector(0) | 114 , m_selectorListForParseSelector(0) |
| 115 , m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES) | 115 , m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES) |
| 116 , m_hasFontFaceOnlyValues(false) | 116 , m_hasFontFaceOnlyValues(false) |
| 117 , m_hadSyntacticallyValidCSSRule(false) | 117 , m_hadSyntacticallyValidCSSRule(false) |
| 118 , m_logErrors(false) | 118 , m_logErrors(false) |
| 119 , m_ignoreErrors(false) | 119 , m_ignoreErrors(false) |
| 120 , m_defaultNamespace(starAtom) | 120 , m_defaultNamespace(starAtom) |
| 121 , m_observer(0) | 121 , m_observer(0) |
| 122 , m_source(0) | 122 , m_source(0) |
| 123 , m_ruleHeaderType(CSSRuleSourceData::UNKNOWN_RULE) | 123 , m_ruleHeaderType(CSSRuleSourceData::UNKNOWN_RULE) |
| 124 , m_allowImportRules(true) | 124 , m_allowImportRules(true) |
| 125 , m_allowNamespaceDeclarations(true) | 125 , m_allowNamespaceDeclarations(true) |
| 126 , m_inViewport(false) | 126 , m_inViewport(false) |
| 127 , m_tokenizer(*this) | 127 , m_tokenizer(*this) |
| 128 { | 128 { |
| 129 #if YYDEBUG > 0 | 129 #if YYDEBUG > 0 |
| 130 cssyydebug = 1; | 130 cssyydebug = 1; |
| 131 #endif | 131 #endif |
| 132 CSSPropertySourceData::init(); | |
| 133 } | 132 } |
| 134 | 133 |
| 135 BisonCSSParser::~BisonCSSParser() | 134 BisonCSSParser::~BisonCSSParser() |
| 136 { | 135 { |
| 137 clearProperties(); | 136 clearProperties(); |
| 138 | 137 |
| 139 deleteAllValues(m_floatingSelectors); | 138 deleteAllValues(m_floatingSelectors); |
| 140 deleteAllValues(m_floatingSelectorVectors); | 139 deleteAllValues(m_floatingSelectorVectors); |
| 141 deleteAllValues(m_floatingValueLists); | 140 deleteAllValues(m_floatingValueLists); |
| 142 deleteAllValues(m_floatingFunctions); | 141 deleteAllValues(m_floatingFunctions); |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 } | 1688 } |
| 1690 StyleRuleMedia* result = rule.get(); | 1689 StyleRuleMedia* result = rule.get(); |
| 1691 m_parsedRules.append(rule.release()); | 1690 m_parsedRules.append(rule.release()); |
| 1692 return result; | 1691 return result; |
| 1693 } | 1692 } |
| 1694 | 1693 |
| 1695 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul
eList* rules) | 1694 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul
eList* rules) |
| 1696 { | 1695 { |
| 1697 m_allowImportRules = m_allowNamespaceDeclarations = false; | 1696 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 1698 | 1697 |
| 1699 RefPtr<CSSRuleSourceData> data = popSupportsRuleData(); | 1698 RefPtrWillBeRawPtr<CSSRuleSourceData> data = popSupportsRuleData(); |
| 1700 RefPtrWillBeRawPtr<StyleRuleSupports> rule = nullptr; | 1699 RefPtrWillBeRawPtr<StyleRuleSupports> rule = nullptr; |
| 1701 String conditionText; | 1700 String conditionText; |
| 1702 unsigned conditionOffset = data->ruleHeaderRange.start + 9; | 1701 unsigned conditionOffset = data->ruleHeaderRange.start + 9; |
| 1703 unsigned conditionLength = data->ruleHeaderRange.length() - 9; | 1702 unsigned conditionLength = data->ruleHeaderRange.length() - 9; |
| 1704 | 1703 |
| 1705 if (m_tokenizer.is8BitSource()) | 1704 if (m_tokenizer.is8BitSource()) |
| 1706 conditionText = String(m_tokenizer.m_dataStart8.get() + conditionOffset,
conditionLength).stripWhiteSpace(); | 1705 conditionText = String(m_tokenizer.m_dataStart8.get() + conditionOffset,
conditionLength).stripWhiteSpace(); |
| 1707 else | 1706 else |
| 1708 conditionText = String(m_tokenizer.m_dataStart16.get() + conditionOffset
, conditionLength).stripWhiteSpace(); | 1707 conditionText = String(m_tokenizer.m_dataStart16.get() + conditionOffset
, conditionLength).stripWhiteSpace(); |
| 1709 | 1708 |
| 1710 if (rules) { | 1709 if (rules) { |
| 1711 rule = StyleRuleSupports::create(conditionText, conditionIsSupported, *r
ules); | 1710 rule = StyleRuleSupports::create(conditionText, conditionIsSupported, *r
ules); |
| 1712 } else { | 1711 } else { |
| 1713 RuleList emptyRules; | 1712 RuleList emptyRules; |
| 1714 rule = StyleRuleSupports::create(conditionText, conditionIsSupported, em
ptyRules); | 1713 rule = StyleRuleSupports::create(conditionText, conditionIsSupported, em
ptyRules); |
| 1715 } | 1714 } |
| 1716 | 1715 |
| 1717 StyleRuleSupports* result = rule.get(); | 1716 StyleRuleSupports* result = rule.get(); |
| 1718 m_parsedRules.append(rule.release()); | 1717 m_parsedRules.append(rule.release()); |
| 1719 | 1718 |
| 1720 return result; | 1719 return result; |
| 1721 } | 1720 } |
| 1722 | 1721 |
| 1723 void BisonCSSParser::markSupportsRuleHeaderStart() | 1722 void BisonCSSParser::markSupportsRuleHeaderStart() |
| 1724 { | 1723 { |
| 1725 if (!m_supportsRuleDataStack) | 1724 if (!m_supportsRuleDataStack) |
| 1726 m_supportsRuleDataStack = adoptPtr(new RuleSourceDataList()); | 1725 m_supportsRuleDataStack = adoptPtrWillBeNoop(new RuleSourceDataList()); |
| 1727 | 1726 |
| 1728 RefPtr<CSSRuleSourceData> data = CSSRuleSourceData::create(CSSRuleSourceData
::SUPPORTS_RULE); | 1727 RefPtrWillBeRawPtr<CSSRuleSourceData> data = CSSRuleSourceData::create(CSSRu
leSourceData::SUPPORTS_RULE); |
| 1729 data->ruleHeaderRange.start = m_tokenizer.tokenStartOffset(); | 1728 data->ruleHeaderRange.start = m_tokenizer.tokenStartOffset(); |
| 1730 m_supportsRuleDataStack->append(data); | 1729 m_supportsRuleDataStack->append(data); |
| 1731 } | 1730 } |
| 1732 | 1731 |
| 1733 void BisonCSSParser::markSupportsRuleHeaderEnd() | 1732 void BisonCSSParser::markSupportsRuleHeaderEnd() |
| 1734 { | 1733 { |
| 1735 ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty()); | 1734 ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty()); |
| 1736 | 1735 |
| 1737 if (m_tokenizer.is8BitSource()) | 1736 if (m_tokenizer.is8BitSource()) |
| 1738 m_supportsRuleDataStack->last()->ruleHeaderRange.end = m_tokenizer.token
Start<LChar>() - m_tokenizer.m_dataStart8.get(); | 1737 m_supportsRuleDataStack->last()->ruleHeaderRange.end = m_tokenizer.token
Start<LChar>() - m_tokenizer.m_dataStart8.get(); |
| 1739 else | 1738 else |
| 1740 m_supportsRuleDataStack->last()->ruleHeaderRange.end = m_tokenizer.token
Start<UChar>() - m_tokenizer.m_dataStart16.get(); | 1739 m_supportsRuleDataStack->last()->ruleHeaderRange.end = m_tokenizer.token
Start<UChar>() - m_tokenizer.m_dataStart16.get(); |
| 1741 } | 1740 } |
| 1742 | 1741 |
| 1743 PassRefPtr<CSSRuleSourceData> BisonCSSParser::popSupportsRuleData() | 1742 PassRefPtrWillBeRawPtr<CSSRuleSourceData> BisonCSSParser::popSupportsRuleData() |
| 1744 { | 1743 { |
| 1745 ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty()); | 1744 ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty()); |
| 1746 RefPtr<CSSRuleSourceData> data = m_supportsRuleDataStack->last(); | 1745 RefPtrWillBeRawPtr<CSSRuleSourceData> data = m_supportsRuleDataStack->last()
; |
| 1747 m_supportsRuleDataStack->removeLast(); | 1746 m_supportsRuleDataStack->removeLast(); |
| 1748 return data.release(); | 1747 return data.release(); |
| 1749 } | 1748 } |
| 1750 | 1749 |
| 1751 BisonCSSParser::RuleList* BisonCSSParser::createRuleList() | 1750 BisonCSSParser::RuleList* BisonCSSParser::createRuleList() |
| 1752 { | 1751 { |
| 1753 OwnPtrWillBeRawPtr<RuleList> list = adoptPtrWillBeNoop(new RuleList); | 1752 OwnPtrWillBeRawPtr<RuleList> list = adoptPtrWillBeNoop(new RuleList); |
| 1754 RuleList* listPtr = list.get(); | 1753 RuleList* listPtr = list.get(); |
| 1755 | 1754 |
| 1756 m_parsedRuleLists.append(list.release()); | 1755 m_parsedRuleLists.append(list.release()); |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 rule->setProperties(createStylePropertySet()); | 2185 rule->setProperties(createStylePropertySet()); |
| 2187 clearProperties(); | 2186 clearProperties(); |
| 2188 | 2187 |
| 2189 StyleRuleViewport* result = rule.get(); | 2188 StyleRuleViewport* result = rule.get(); |
| 2190 m_parsedRules.append(rule.release()); | 2189 m_parsedRules.append(rule.release()); |
| 2191 | 2190 |
| 2192 return result; | 2191 return result; |
| 2193 } | 2192 } |
| 2194 | 2193 |
| 2195 } | 2194 } |
| OLD | NEW |