Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 // WARNING: DO NOT EDIT THIS TEMPLATE FILE. | 6 // WARNING: DO NOT EDIT THIS TEMPLATE FILE. |
| 7 // The template file was generated by scripts/css_code_generator.py | 7 // The template file was generated by scripts/css_code_generator.py |
| 8 | 8 |
| 9 // Source of CSS properties: | 9 // Source of CSS properties: |
| 10 // CSSPropertyNames.in | 10 // CSSPropertyNames.in |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 @DomName('CSSStyleDeclaration.setProperty') | 68 @DomName('CSSStyleDeclaration.setProperty') |
| 69 void setProperty(String propertyName, String value, [String priority]) { | 69 void setProperty(String propertyName, String value, [String priority]) { |
| 70 if (_supportsProperty(_camelCase(propertyName))) { | 70 if (_supportsProperty(_camelCase(propertyName))) { |
| 71 return _setPropertyHelper(propertyName, value, priority); | 71 return _setPropertyHelper(propertyName, value, priority); |
| 72 } else { | 72 } else { |
| 73 return _setPropertyHelper(Device.cssPrefix + propertyName, value, | 73 return _setPropertyHelper(Device.cssPrefix + propertyName, value, |
| 74 priority); | 74 priority); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 String _camelCase(String hyphenated) { | 78 String _camelCase(String hyphenated) { |
|
sra1
2014/08/07 22:16:20
static
| |
| 79 bool firstWord = true; | 79 // The "ms" prefix is always lowercased. |
| 80 return hyphenated.splitMapJoin('-', onMatch : (_) => '', | 80 return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped( |
| 81 onNonMatch : (String word) { | 81 new RegExp('-([a-z]+)', caseSensitive: false), |
|
sra1
2014/08/07 21:46:38
Put the regexps in private static fields to avoid
| |
| 82 if (word.length > 0) { | 82 (match) => match[0][1].toUpperCase() + match[0].substring(2)); |
| 83 if (firstWord) { | |
| 84 firstWord = false; | |
| 85 return word; | |
| 86 } | |
| 87 return word[0].toUpperCase() + word.substring(1); | |
| 88 } | |
| 89 return ''; | |
| 90 }); | |
| 91 } | 83 } |
| 92 | 84 |
| 93 $if DART2JS | 85 $if DART2JS |
| 94 void _setPropertyHelper(String propertyName, String value, [String priority]) { | 86 void _setPropertyHelper(String propertyName, String value, [String priority]) { |
| 95 // try/catch for IE9 which throws on unsupported values. | 87 // try/catch for IE9 which throws on unsupported values. |
| 96 try { | 88 try { |
| 97 if (value == null) value = ''; | 89 if (value == null) value = ''; |
| 98 if (priority == null) { | 90 if (priority == null) { |
| 99 priority = ''; | 91 priority = ''; |
| 100 } | 92 } |
| (...skipping 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3233 | 3225 |
| 3234 /** Gets the value of "zoom" */ | 3226 /** Gets the value of "zoom" */ |
| 3235 String get zoom => | 3227 String get zoom => |
| 3236 getPropertyValue('zoom'); | 3228 getPropertyValue('zoom'); |
| 3237 | 3229 |
| 3238 /** Sets the value of "zoom" */ | 3230 /** Sets the value of "zoom" */ |
| 3239 void set zoom(String value) { | 3231 void set zoom(String value) { |
| 3240 setProperty('zoom', value, ''); | 3232 setProperty('zoom', value, ''); |
| 3241 } | 3233 } |
| 3242 } | 3234 } |
| OLD | NEW |