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 13 matching lines...) Expand all Loading... | |
24 } | 24 } |
25 | 25 |
26 static String removeSVGPrefix(const String& property) | 26 static String removeSVGPrefix(const String& property) |
27 { | 27 { |
28 ASSERT(isSVGPrefixed(property)); | 28 ASSERT(isSVGPrefixed(property)); |
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 hyphenated and prefixed properties. |
35 if (property[0] == '-' || isASCIIUpper(property[0])) | 35 if (property.find('-') != kNotFound) { |
alancutter (OOO until 2018)
2016/03/10 01:26:50
Does this logic need to move? This seems more expe
Eric Willigers
2016/03/10 01:56:04
Moved back.
| |
36 if (cssPropertyID(property) != CSSPropertyInvalid) | |
37 Deprecation::countDeprecation(document, UseCounter::WebAnimationHyph enatedProperty); | |
38 return CSSPropertyInvalid; | |
39 } | |
40 if (isASCIIUpper(property[0])) | |
36 return CSSPropertyInvalid; | 41 return CSSPropertyInvalid; |
37 if (property == "cssFloat") | 42 if (property == "cssFloat") |
38 return CSSPropertyFloat; | 43 return CSSPropertyFloat; |
44 | |
39 StringBuilder builder; | 45 StringBuilder builder; |
40 for (size_t i = 0; i < property.length(); ++i) { | 46 for (size_t i = 0; i < property.length(); ++i) { |
41 if (property[i] == '-') | |
42 Deprecation::countDeprecation(document, UseCounter::WebAnimationHyph enatedProperty); | |
43 if (isASCIIUpper(property[i])) | 47 if (isASCIIUpper(property[i])) |
44 builder.append('-'); | 48 builder.append('-'); |
45 builder.append(property[i]); | 49 builder.append(property[i]); |
46 } | 50 } |
47 return cssPropertyID(builder.toString()); | 51 return cssPropertyID(builder.toString()); |
48 } | 52 } |
49 | 53 |
50 CSSPropertyID AnimationInputHelpers::keyframeAttributeToPresentationAttribute(co nst String& property, const Element& element) | 54 CSSPropertyID AnimationInputHelpers::keyframeAttributeToPresentationAttribute(co nst String& property, const Element& element) |
51 { | 55 { |
52 if (!RuntimeEnabledFeatures::webAnimationsSVGEnabled() || !element.isSVGElem ent() || !isSVGPrefixed(property)) | 56 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()); | 210 ASSERT(!value || value->isCSSWideKeyword()); |
207 return nullptr; | 211 return nullptr; |
208 } | 212 } |
209 CSSValueList* valueList = toCSSValueList(value.get()); | 213 CSSValueList* valueList = toCSSValueList(value.get()); |
210 if (valueList->length() > 1) | 214 if (valueList->length() > 1) |
211 return nullptr; | 215 return nullptr; |
212 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true); | 216 return CSSToStyleMap::mapAnimationTimingFunction(*valueList->item(0), true); |
213 } | 217 } |
214 | 218 |
215 } // namespace blink | 219 } // namespace blink |
OLD | NEW |