OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/animation/AnimationInputHelpers.h" | 5 #include "core/animation/AnimationInputHelpers.h" |
6 | 6 |
7 #include "core/SVGNames.h" | 7 #include "core/SVGNames.h" |
8 #include "core/css/CSSValueList.h" | 8 #include "core/css/CSSValueList.h" |
9 #include "core/css/parser/CSSParser.h" | 9 #include "core/css/parser/CSSParser.h" |
10 #include "core/css/resolver/CSSToStyleMap.h" | 10 #include "core/css/resolver/CSSToStyleMap.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 return property.substring(kSVGPrefixLength); | 29 return property.substring(kSVGPrefixLength); |
30 } | 30 } |
31 | 31 |
32 CSSPropertyID AnimationInputHelpers::keyframeAttributeToCSSProperty(const String
& property, const Document& document) | 32 CSSPropertyID AnimationInputHelpers::keyframeAttributeToCSSProperty(const String
& property, const Document& document) |
33 { | 33 { |
34 // Disallow prefixed properties. | 34 // Disallow prefixed properties. |
35 if (property[0] == '-' || isASCIIUpper(property[0])) | 35 if (property[0] == '-' || isASCIIUpper(property[0])) |
36 return CSSPropertyInvalid; | 36 return CSSPropertyInvalid; |
37 if (property == "cssFloat") | 37 if (property == "cssFloat") |
38 return CSSPropertyFloat; | 38 return CSSPropertyFloat; |
| 39 |
39 StringBuilder builder; | 40 StringBuilder builder; |
40 for (size_t i = 0; i < property.length(); ++i) { | 41 for (size_t i = 0; i < property.length(); ++i) { |
41 if (property[i] == '-') | 42 // Disallow hyphenated properties. |
42 Deprecation::countDeprecation(document, UseCounter::WebAnimationHyph
enatedProperty); | 43 if (property[i] == '-') { |
| 44 if (cssPropertyID(property) != CSSPropertyInvalid) |
| 45 Deprecation::countDeprecation(document, UseCounter::WebAnimation
HyphenatedProperty); |
| 46 return CSSPropertyInvalid; |
| 47 } |
43 if (isASCIIUpper(property[i])) | 48 if (isASCIIUpper(property[i])) |
44 builder.append('-'); | 49 builder.append('-'); |
45 builder.append(property[i]); | 50 builder.append(property[i]); |
46 } | 51 } |
47 return cssPropertyID(builder.toString()); | 52 return cssPropertyID(builder.toString()); |
48 } | 53 } |
49 | 54 |
50 CSSPropertyID AnimationInputHelpers::keyframeAttributeToPresentationAttribute(co
nst String& property, const Element& element) | 55 CSSPropertyID AnimationInputHelpers::keyframeAttributeToPresentationAttribute(co
nst String& property, const Element& element) |
51 { | 56 { |
52 if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElem
ent() || !isSVGPrefixed(property)) | 57 if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElem
ent() || !isSVGPrefixed(property)) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 ASSERT(!value || value->isCSSWideKeyword()); | 211 ASSERT(!value || value->isCSSWideKeyword()); |
207 return nullptr; | 212 return nullptr; |
208 } | 213 } |
209 CSSValueList* valueList = toCSSValueList(value.get()); | 214 CSSValueList* valueList = toCSSValueList(value.get()); |
210 if (valueList->length() > 1) | 215 if (valueList->length() > 1) |
211 return nullptr; | 216 return nullptr; |
212 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true); | 217 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true); |
213 } | 218 } |
214 | 219 |
215 } // namespace blink | 220 } // namespace blink |
OLD | NEW |