OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
10 #include "core/css/CSSCounterValue.h" | 10 #include "core/css/CSSCounterValue.h" |
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 parsedValue = consumeCounterContent(consumeFunction(range), true
); | 2870 parsedValue = consumeCounterContent(consumeFunction(range), true
); |
2871 if (!parsedValue) | 2871 if (!parsedValue) |
2872 return nullptr; | 2872 return nullptr; |
2873 } | 2873 } |
2874 values->append(parsedValue.release()); | 2874 values->append(parsedValue.release()); |
2875 } while (!range.atEnd()); | 2875 } while (!range.atEnd()); |
2876 | 2876 |
2877 return values.release(); | 2877 return values.release(); |
2878 } | 2878 } |
2879 | 2879 |
| 2880 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumePerspective(CSSParserTok
enRange& range, CSSParserMode cssParserMode, CSSPropertyID unresolvedProperty) |
| 2881 { |
| 2882 if (range.peek().id() == CSSValueNone) |
| 2883 return consumeIdent(range); |
| 2884 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue = consumeLength(range, css
ParserMode, ValueRangeAll); |
| 2885 if (!parsedValue && (unresolvedProperty == CSSPropertyAliasWebkitPerspective
)) { |
| 2886 double perspective; |
| 2887 if (!consumeNumberRaw(range, perspective)) |
| 2888 return nullptr; |
| 2889 parsedValue = cssValuePool().createValue(perspective, CSSPrimitiveValue:
:UnitType::Pixels); |
| 2890 } |
| 2891 if (parsedValue && (parsedValue->isCalculated() || parsedValue->getDoubleVal
ue() > 0)) |
| 2892 return parsedValue.release(); |
| 2893 return nullptr; |
| 2894 } |
| 2895 |
2880 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID unresolvedProperty) | 2896 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID unresolvedProperty) |
2881 { | 2897 { |
2882 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 2898 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
2883 switch (property) { | 2899 switch (property) { |
2884 case CSSPropertyWillChange: | 2900 case CSSPropertyWillChange: |
2885 return consumeWillChange(m_range); | 2901 return consumeWillChange(m_range); |
2886 case CSSPropertyPage: | 2902 case CSSPropertyPage: |
2887 return consumePage(m_range); | 2903 return consumePage(m_range); |
2888 case CSSPropertyQuotes: | 2904 case CSSPropertyQuotes: |
2889 return consumeQuotes(m_range); | 2905 return consumeQuotes(m_range); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3115 case CSSPropertyCursor: | 3131 case CSSPropertyCursor: |
3116 return consumeCursor(m_range, m_context, inQuirksMode()); | 3132 return consumeCursor(m_range, m_context, inQuirksMode()); |
3117 case CSSPropertyContain: | 3133 case CSSPropertyContain: |
3118 return consumeContain(m_range); | 3134 return consumeContain(m_range); |
3119 case CSSPropertyTransformOrigin: | 3135 case CSSPropertyTransformOrigin: |
3120 return consumeTransformOrigin(m_range, m_context.mode(), UnitlessQuirk::
Forbid); | 3136 return consumeTransformOrigin(m_range, m_context.mode(), UnitlessQuirk::
Forbid); |
3121 case CSSPropertyContent: | 3137 case CSSPropertyContent: |
3122 return consumeContent(m_range, m_context); | 3138 return consumeContent(m_range, m_context); |
3123 case CSSPropertyListStyleImage: | 3139 case CSSPropertyListStyleImage: |
3124 return consumeImage(m_range, m_context); | 3140 return consumeImage(m_range, m_context); |
| 3141 case CSSPropertyPerspective: |
| 3142 return consumePerspective(m_range, m_context.mode(), unresolvedProperty)
; |
3125 default: | 3143 default: |
3126 return nullptr; | 3144 return nullptr; |
3127 } | 3145 } |
3128 } | 3146 } |
3129 | 3147 |
3130 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) | 3148 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) |
3131 { | 3149 { |
3132 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); | 3150 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); |
3133 | 3151 |
3134 do { | 3152 do { |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); | 3732 return consumeShorthandGreedily(webkitColumnRuleShorthand(), important); |
3715 case CSSPropertyListStyle: | 3733 case CSSPropertyListStyle: |
3716 return consumeShorthandGreedily(listStyleShorthand(), important); | 3734 return consumeShorthandGreedily(listStyleShorthand(), important); |
3717 default: | 3735 default: |
3718 m_currentShorthand = oldShorthand; | 3736 m_currentShorthand = oldShorthand; |
3719 return false; | 3737 return false; |
3720 } | 3738 } |
3721 } | 3739 } |
3722 | 3740 |
3723 } // namespace blink | 3741 } // namespace blink |
OLD | NEW |