| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 return false; | 855 return false; |
| 856 } | 856 } |
| 857 | 857 |
| 858 CSSParserString cssString; | 858 CSSParserString cssString; |
| 859 cssString.init(string); | 859 cssString.init(string); |
| 860 CSSValueID valueID = cssValueKeywordID(cssString); | 860 CSSValueID valueID = cssValueKeywordID(cssString); |
| 861 | 861 |
| 862 if (!valueID) | 862 if (!valueID) |
| 863 return false; | 863 return false; |
| 864 | 864 |
| 865 RefPtrWillBeRawPtr<CSSValue> value; | 865 RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
| 866 if (valueID == CSSValueInherit) | 866 if (valueID == CSSValueInherit) |
| 867 value = cssValuePool().createInheritedValue(); | 867 value = cssValuePool().createInheritedValue(); |
| 868 else if (valueID == CSSValueInitial) | 868 else if (valueID == CSSValueInitial) |
| 869 value = cssValuePool().createExplicitInitialValue(); | 869 value = cssValuePool().createExplicitInitialValue(); |
| 870 else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext)) | 870 else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext)) |
| 871 value = cssValuePool().createIdentifierValue(valueID); | 871 value = cssValuePool().createIdentifierValue(valueID); |
| 872 else | 872 else |
| 873 return false; | 873 return false; |
| 874 | 874 |
| 875 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), impo
rtant)); | 875 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), impo
rtant)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 | 940 |
| 941 RefPtrWillBeRawPtr<CSSTransformValue> transformValue = CSSTransformValue::cr
eate(transformType); | 941 RefPtrWillBeRawPtr<CSSTransformValue> transformValue = CSSTransformValue::cr
eate(transformType); |
| 942 if (!parseTransformTranslateArguments(pos, end, expectedArgumentCount, trans
formValue.get())) | 942 if (!parseTransformTranslateArguments(pos, end, expectedArgumentCount, trans
formValue.get())) |
| 943 return nullptr; | 943 return nullptr; |
| 944 return transformValue.release(); | 944 return transformValue.release(); |
| 945 } | 945 } |
| 946 | 946 |
| 947 template <typename CharType> | 947 template <typename CharType> |
| 948 static PassRefPtrWillBeRawPtr<CSSValueList> parseTranslateTransformList(CharType
*& pos, CharType* end) | 948 static PassRefPtrWillBeRawPtr<CSSValueList> parseTranslateTransformList(CharType
*& pos, CharType* end) |
| 949 { | 949 { |
| 950 RefPtrWillBeRawPtr<CSSValueList> transformList; | 950 RefPtrWillBeRawPtr<CSSValueList> transformList = nullptr; |
| 951 while (pos < end) { | 951 while (pos < end) { |
| 952 while (pos < end && isCSSSpace(*pos)) | 952 while (pos < end && isCSSSpace(*pos)) |
| 953 ++pos; | 953 ++pos; |
| 954 RefPtrWillBeRawPtr<CSSTransformValue> transformValue = parseTranslateTra
nsformValue(pos, end); | 954 RefPtrWillBeRawPtr<CSSTransformValue> transformValue = parseTranslateTra
nsformValue(pos, end); |
| 955 if (!transformValue) | 955 if (!transformValue) |
| 956 return nullptr; | 956 return nullptr; |
| 957 if (!transformList) | 957 if (!transformList) |
| 958 transformList = CSSValueList::createSpaceSeparated(); | 958 transformList = CSSValueList::createSpaceSeparated(); |
| 959 transformList->append(transformValue.release()); | 959 transformList->append(transformValue.release()); |
| 960 if (pos < end) { | 960 if (pos < end) { |
| 961 if (isCSSSpace(*pos)) | 961 if (isCSSSpace(*pos)) |
| 962 return nullptr; | 962 return nullptr; |
| 963 } | 963 } |
| 964 } | 964 } |
| 965 return transformList.release(); | 965 return transformList.release(); |
| 966 } | 966 } |
| 967 | 967 |
| 968 static bool parseTranslateTransform(MutableStylePropertySet* properties, CSSProp
ertyID propertyID, const String& string, bool important) | 968 static bool parseTranslateTransform(MutableStylePropertySet* properties, CSSProp
ertyID propertyID, const String& string, bool important) |
| 969 { | 969 { |
| 970 if (propertyID != CSSPropertyWebkitTransform) | 970 if (propertyID != CSSPropertyWebkitTransform) |
| 971 return false; | 971 return false; |
| 972 if (string.isEmpty()) | 972 if (string.isEmpty()) |
| 973 return false; | 973 return false; |
| 974 RefPtrWillBeRawPtr<CSSValueList> transformList; | 974 RefPtrWillBeRawPtr<CSSValueList> transformList = nullptr; |
| 975 if (string.is8Bit()) { | 975 if (string.is8Bit()) { |
| 976 const LChar* pos = string.characters8(); | 976 const LChar* pos = string.characters8(); |
| 977 const LChar* end = pos + string.length(); | 977 const LChar* end = pos + string.length(); |
| 978 transformList = parseTranslateTransformList(pos, end); | 978 transformList = parseTranslateTransformList(pos, end); |
| 979 if (!transformList) | 979 if (!transformList) |
| 980 return false; | 980 return false; |
| 981 } else { | 981 } else { |
| 982 const UChar* pos = string.characters16(); | 982 const UChar* pos = string.characters16(); |
| 983 const UChar* end = pos + string.length(); | 983 const UChar* end = pos + string.length(); |
| 984 transformList = parseTranslateTransformList(pos, end); | 984 transformList = parseTranslateTransformList(pos, end); |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 return 0; | 1655 return 0; |
| 1656 RefPtrWillBeRawPtr<StyleRuleImport> rule = StyleRuleImport::create(url, medi
a); | 1656 RefPtrWillBeRawPtr<StyleRuleImport> rule = StyleRuleImport::create(url, medi
a); |
| 1657 StyleRuleImport* result = rule.get(); | 1657 StyleRuleImport* result = rule.get(); |
| 1658 m_parsedRules.append(rule.release()); | 1658 m_parsedRules.append(rule.release()); |
| 1659 return result; | 1659 return result; |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 StyleRuleBase* BisonCSSParser::createMediaRule(MediaQuerySet* media, RuleList* r
ules) | 1662 StyleRuleBase* BisonCSSParser::createMediaRule(MediaQuerySet* media, RuleList* r
ules) |
| 1663 { | 1663 { |
| 1664 m_allowImportRules = m_allowNamespaceDeclarations = false; | 1664 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 1665 RefPtrWillBeRawPtr<StyleRuleMedia> rule; | 1665 RefPtrWillBeRawPtr<StyleRuleMedia> rule = nullptr; |
| 1666 if (rules) { | 1666 if (rules) { |
| 1667 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge
t(), *rules); | 1667 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge
t(), *rules); |
| 1668 } else { | 1668 } else { |
| 1669 RuleList emptyRules; | 1669 RuleList emptyRules; |
| 1670 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge
t(), emptyRules); | 1670 rule = StyleRuleMedia::create(media ? media : MediaQuerySet::create().ge
t(), emptyRules); |
| 1671 } | 1671 } |
| 1672 StyleRuleMedia* result = rule.get(); | 1672 StyleRuleMedia* result = rule.get(); |
| 1673 m_parsedRules.append(rule.release()); | 1673 m_parsedRules.append(rule.release()); |
| 1674 return result; | 1674 return result; |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul
eList* rules) | 1677 StyleRuleBase* BisonCSSParser::createSupportsRule(bool conditionIsSupported, Rul
eList* rules) |
| 1678 { | 1678 { |
| 1679 m_allowImportRules = m_allowNamespaceDeclarations = false; | 1679 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 1680 | 1680 |
| 1681 RefPtr<CSSRuleSourceData> data = popSupportsRuleData(); | 1681 RefPtr<CSSRuleSourceData> data = popSupportsRuleData(); |
| 1682 RefPtrWillBeRawPtr<StyleRuleSupports> rule; | 1682 RefPtrWillBeRawPtr<StyleRuleSupports> rule = nullptr; |
| 1683 String conditionText; | 1683 String conditionText; |
| 1684 unsigned conditionOffset = data->ruleHeaderRange.start + 9; | 1684 unsigned conditionOffset = data->ruleHeaderRange.start + 9; |
| 1685 unsigned conditionLength = data->ruleHeaderRange.length() - 9; | 1685 unsigned conditionLength = data->ruleHeaderRange.length() - 9; |
| 1686 | 1686 |
| 1687 if (m_tokenizer.is8BitSource()) | 1687 if (m_tokenizer.is8BitSource()) |
| 1688 conditionText = String(m_tokenizer.m_dataStart8.get() + conditionOffset,
conditionLength).stripWhiteSpace(); | 1688 conditionText = String(m_tokenizer.m_dataStart8.get() + conditionOffset,
conditionLength).stripWhiteSpace(); |
| 1689 else | 1689 else |
| 1690 conditionText = String(m_tokenizer.m_dataStart16.get() + conditionOffset
, conditionLength).stripWhiteSpace(); | 1690 conditionText = String(m_tokenizer.m_dataStart16.get() + conditionOffset
, conditionLength).stripWhiteSpace(); |
| 1691 | 1691 |
| 1692 if (rules) { | 1692 if (rules) { |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 rule->setProperties(createStylePropertySet()); | 2205 rule->setProperties(createStylePropertySet()); |
| 2206 clearProperties(); | 2206 clearProperties(); |
| 2207 | 2207 |
| 2208 StyleRuleViewport* result = rule.get(); | 2208 StyleRuleViewport* result = rule.get(); |
| 2209 m_parsedRules.append(rule.release()); | 2209 m_parsedRules.append(rule.release()); |
| 2210 | 2210 |
| 2211 return result; | 2211 return result; |
| 2212 } | 2212 } |
| 2213 | 2213 |
| 2214 } | 2214 } |
| OLD | NEW |