OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/css/cssom/InlineStylePropertyMap.h" | 5 #include "core/css/cssom/InlineStylePropertyMap.h" |
6 | 6 |
7 #include "bindings/core/v8/Iterable.h" | 7 #include "bindings/core/v8/Iterable.h" |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/css/CSSCustomIdentValue.h" | 9 #include "core/css/CSSCustomIdentValue.h" |
10 #include "core/css/CSSCustomPropertyDeclaration.h" | 10 #include "core/css/CSSCustomPropertyDeclaration.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { | 201 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { |
202 StylePropertySet::PropertyReference propertyReference = | 202 StylePropertySet::PropertyReference propertyReference = |
203 inlineStyleSet.propertyAt(i); | 203 inlineStyleSet.propertyAt(i); |
204 CSSPropertyID propertyID = propertyReference.id(); | 204 CSSPropertyID propertyID = propertyReference.id(); |
205 String name; | 205 String name; |
206 CSSStyleValueOrCSSStyleValueSequence value; | 206 CSSStyleValueOrCSSStyleValueSequence value; |
207 if (propertyID == CSSPropertyVariable) { | 207 if (propertyID == CSSPropertyVariable) { |
208 const CSSCustomPropertyDeclaration& customDeclaration = | 208 const CSSCustomPropertyDeclaration& customDeclaration = |
209 toCSSCustomPropertyDeclaration(propertyReference.value()); | 209 toCSSCustomPropertyDeclaration(propertyReference.value()); |
210 name = customDeclaration.name(); | 210 name = customDeclaration.name(); |
211 // TODO(meade): Eventually custom properties will support other types, so
actually return them instead of always returning a CSSUnsupportedStyleValue. | 211 // TODO(meade): Eventually custom properties will support other types, so |
| 212 // actually return them instead of always returning a |
| 213 // CSSUnsupportedStyleValue. |
212 value.setCSSStyleValue( | 214 value.setCSSStyleValue( |
213 CSSUnsupportedStyleValue::create(customDeclaration.customCSSText())); | 215 CSSUnsupportedStyleValue::create(customDeclaration.customCSSText())); |
214 } else if (propertyID == CSSPropertyApplyAtRule) { | 216 } else if (propertyID == CSSPropertyApplyAtRule) { |
215 name = kAtApply; | 217 name = kAtApply; |
216 value.setCSSStyleValue(CSSUnsupportedStyleValue::create( | 218 value.setCSSStyleValue(CSSUnsupportedStyleValue::create( |
217 toCSSCustomIdentValue(propertyReference.value()).value())); | 219 toCSSCustomIdentValue(propertyReference.value()).value())); |
218 } else { | 220 } else { |
219 name = getPropertyNameString(propertyID); | 221 name = getPropertyNameString(propertyID); |
220 CSSStyleValueVector styleValueVector = | 222 CSSStyleValueVector styleValueVector = |
221 StyleValueFactory::cssValueToStyleValueVector( | 223 StyleValueFactory::cssValueToStyleValueVector( |
222 propertyID, propertyReference.value()); | 224 propertyID, propertyReference.value()); |
223 if (styleValueVector.size() == 1) | 225 if (styleValueVector.size() == 1) |
224 value.setCSSStyleValue(styleValueVector[0]); | 226 value.setCSSStyleValue(styleValueVector[0]); |
225 else | 227 else |
226 value.setCSSStyleValueSequence(styleValueVector); | 228 value.setCSSStyleValueSequence(styleValueVector); |
227 } | 229 } |
228 result.append(std::make_pair(name, value)); | 230 result.append(std::make_pair(name, value)); |
229 } | 231 } |
230 return result; | 232 return result; |
231 } | 233 } |
232 | 234 |
233 } // namespace blink | 235 } // namespace blink |
OLD | NEW |