| 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 #ifndef AnimationHelpers_h | 5 #ifndef AnimationHelpers_h |
| 6 #define AnimationHelpers_h | 6 #define AnimationHelpers_h |
| 7 | 7 |
| 8 #include "core/css/parser/BisonCSSParser.h" | 8 #include "core/css/parser/CSSParser.h" |
| 9 #include "wtf/text/StringBuilder.h" | 9 #include "wtf/text/StringBuilder.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 static inline CSSPropertyID camelCaseCSSPropertyNameToID(const String& propertyN
ame) | 13 static inline CSSPropertyID camelCaseCSSPropertyNameToID(const String& propertyN
ame) |
| 14 { | 14 { |
| 15 if (propertyName.find('-') != kNotFound) | 15 if (propertyName.find('-') != kNotFound) |
| 16 return CSSPropertyInvalid; | 16 return CSSPropertyInvalid; |
| 17 | 17 |
| 18 StringBuilder builder; | 18 StringBuilder builder; |
| 19 size_t position = 0; | 19 size_t position = 0; |
| 20 size_t end; | 20 size_t end; |
| 21 while ((end = propertyName.find(isASCIIUpper, position)) != kNotFound) { | 21 while ((end = propertyName.find(isASCIIUpper, position)) != kNotFound) { |
| 22 builder.append(propertyName.substring(position, end - position) + "-" +
toASCIILower((propertyName)[end])); | 22 builder.append(propertyName.substring(position, end - position) + "-" +
toASCIILower((propertyName)[end])); |
| 23 position = end + 1; | 23 position = end + 1; |
| 24 } | 24 } |
| 25 builder.append(propertyName.substring(position)); | 25 builder.append(propertyName.substring(position)); |
| 26 // Doesn't handle prefixed properties. | 26 // Doesn't handle prefixed properties. |
| 27 CSSPropertyID id = cssPropertyID(builder.toString()); | 27 CSSPropertyID id = cssPropertyID(builder.toString()); |
| 28 return id; | 28 return id; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace blink | 31 } // namespace blink |
| 32 | 32 |
| 33 #endif // AnimationHelpers_h | 33 #endif // AnimationHelpers_h |
| OLD | NEW |