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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 const CSSValue* styleValueToCSSValue(CSSPropertyID propertyID, | 24 const CSSValue* styleValueToCSSValue(CSSPropertyID propertyID, |
25 const CSSStyleValue& styleValue) { | 25 const CSSStyleValue& styleValue) { |
26 if (!CSSOMTypes::propertyCanTake(propertyID, styleValue)) | 26 if (!CSSOMTypes::propertyCanTake(propertyID, styleValue)) |
27 return nullptr; | 27 return nullptr; |
28 return styleValue.toCSSValueWithProperty(propertyID); | 28 return styleValue.toCSSValueWithProperty(propertyID); |
29 } | 29 } |
30 | 30 |
31 const CSSValue* singleStyleValueAsCSSValue(CSSPropertyID propertyID, | 31 const CSSValue* singleStyleValueAsCSSValue(CSSPropertyID propertyID, |
32 const CSSStyleValue& styleValue) { | 32 const CSSStyleValue& styleValue) { |
33 if (!CSSPropertyMetadata::propertyIsRepeated(propertyID)) | |
34 return styleValueToCSSValue(propertyID, styleValue); | |
35 | |
36 const CSSValue* cssValue = styleValueToCSSValue(propertyID, styleValue); | 33 const CSSValue* cssValue = styleValueToCSSValue(propertyID, styleValue); |
37 if (!cssValue) | 34 if (!cssValue) |
38 return nullptr; | 35 return nullptr; |
39 | 36 |
| 37 if (!CSSPropertyMetadata::propertyIsRepeated(propertyID) || |
| 38 cssValue->isCSSWideKeyword()) |
| 39 return cssValue; |
| 40 |
40 // TODO(meade): Determine the correct separator for each property. | 41 // TODO(meade): Determine the correct separator for each property. |
41 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); | 42 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); |
42 valueList->append(*cssValue); | 43 valueList->append(*cssValue); |
43 return valueList; | 44 return valueList; |
44 } | 45 } |
45 | 46 |
46 CSSValueList* asCSSValueList(CSSPropertyID propertyID, | 47 CSSValueList* asCSSValueList(CSSPropertyID propertyID, |
47 const CSSStyleValueVector& styleValueVector) { | 48 const CSSStyleValueVector& styleValueVector) { |
48 // TODO(meade): Determine the correct separator for each property. | 49 // TODO(meade): Determine the correct separator for each property. |
49 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); | 50 CSSValueList* valueList = CSSValueList::createSpaceSeparated(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 value.setCSSStyleValue(styleValueVector[0]); | 227 value.setCSSStyleValue(styleValueVector[0]); |
227 else | 228 else |
228 value.setCSSStyleValueSequence(styleValueVector); | 229 value.setCSSStyleValueSequence(styleValueVector); |
229 } | 230 } |
230 result.push_back(std::make_pair(name, value)); | 231 result.push_back(std::make_pair(name, value)); |
231 } | 232 } |
232 return result; | 233 return result; |
233 } | 234 } |
234 | 235 |
235 } // namespace blink | 236 } // namespace blink |
OLD | NEW |