OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/CSSStyleDeclaration.h" | 6 #include "core/css/CSSStyleDeclaration.h" |
7 | 7 |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
9 #include "core/css/CSSPropertyMetadata.h" | 9 #include "core/css/CSSPropertyMetadata.h" |
10 #include "core/css/parser/CSSParser.h" | 10 #include "core/css/parser/CSSParser.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 CSSPropertyID unresolvedProperty = cssPropertyInfo(name, scriptState->isolat
e()); | 118 CSSPropertyID unresolvedProperty = cssPropertyInfo(name, scriptState->isolat
e()); |
119 if (!unresolvedProperty) | 119 if (!unresolvedProperty) |
120 return false; | 120 return false; |
121 | 121 |
122 setPropertyInternal(unresolvedProperty, propertyValue, false, exceptionState
); | 122 setPropertyInternal(unresolvedProperty, propertyValue, false, exceptionState
); |
123 if (exceptionState.throwIfNeeded()) | 123 if (exceptionState.throwIfNeeded()) |
124 return false; | 124 return false; |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
| 128 void CSSStyleDeclaration::namedPropertyEnumerator(Vector<String>& names, Excepti
onState&) |
| 129 { |
| 130 typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector; |
| 131 DEFINE_STATIC_LOCAL(PreAllocatedPropertyVector, propertyNames, ()); |
| 132 static unsigned propertyNamesLength = 0; |
| 133 if (propertyNames.isEmpty()) { |
| 134 for (int id = firstCSSProperty; id <= lastCSSProperty; ++id) { |
| 135 CSSPropertyID propertyId = static_cast<CSSPropertyID>(id); |
| 136 if (CSSPropertyMetadata::isEnabledProperty(propertyId)) |
| 137 propertyNames.append(getJSPropertyName(propertyId)); |
| 138 } |
| 139 std::sort(propertyNames.begin(), propertyNames.end(), codePointCompareLe
ssThan); |
| 140 propertyNamesLength = propertyNames.size(); |
| 141 } |
| 142 for (unsigned i = 0; i < propertyNamesLength; ++i) { |
| 143 String key = propertyNames.at(i); |
| 144 ASSERT(!key.isNull()); |
| 145 names.append(key); |
| 146 } |
128 } | 147 } |
| 148 |
| 149 } |
OLD | NEW |