Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 | 47 |
| 48 return StyleValueFactory::cssValueToStyleValueVector(CSSPropertyInvalid, *cs sValue); | 48 return StyleValueFactory::cssValueToStyleValueVector(CSSPropertyInvalid, *cs sValue); |
| 49 } | 49 } |
| 50 | 50 |
| 51 Vector<String> InlineStylePropertyMap::getProperties() | 51 Vector<String> InlineStylePropertyMap::getProperties() |
| 52 { | 52 { |
| 53 Vector<String> result; | 53 Vector<String> result; |
| 54 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle( ); | 54 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle( ); |
| 55 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { | 55 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { |
| 56 CSSPropertyID propertyID = inlineStyleSet.propertyAt(i).id(); | 56 CSSPropertyID propertyID = inlineStyleSet.propertyAt(i).id(); |
| 57 result.append(getPropertyNameString(propertyID)); | 57 if (propertyID == CSSPropertyVariable) { |
| 58 StylePropertySet::PropertyReference propertyReference = inlineStyleS et.propertyAt(i); | |
| 59 const CSSCustomPropertyDeclaration& customDeclaration = toCSSCustomP ropertyDeclaration(propertyReference.value()); | |
| 60 result.append(customDeclaration.name()); | |
| 61 } else if (propertyID == CSSPropertyApplyAtRule) { | |
| 62 result.append("@apply"); | |
| 63 } else if (propertyID >= firstCSSProperty && propertyID <= lastUnresolve dCSSProperty) { | |
|
sashab
2016/08/08 05:30:38
This should really be a function... But it's used
meade_UTC10
2016/08/08 06:04:00
Oops, that shouldn't even be there! Removed.
| |
| 64 result.append(getPropertyNameString(propertyID)); | |
| 65 } | |
| 58 } | 66 } |
| 59 return result; | 67 return result; |
| 60 } | 68 } |
| 61 | 69 |
| 62 void InlineStylePropertyMap::set(CSSPropertyID propertyID, CSSStyleValueOrCSSSty leValueSequenceOrString& item, ExceptionState& exceptionState) | 70 void InlineStylePropertyMap::set(CSSPropertyID propertyID, CSSStyleValueOrCSSSty leValueSequenceOrString& item, ExceptionState& exceptionState) |
| 63 { | 71 { |
| 64 if (item.isCSSStyleValue()) { | 72 if (item.isCSSStyleValue()) { |
| 65 const CSSValue* cssValue = styleValueToCSSValue(propertyID, *item.getAsC SSStyleValue()); | 73 const CSSValue* cssValue = styleValueToCSSValue(propertyID, *item.getAsC SSStyleValue()); |
| 66 if (!cssValue) { | 74 if (!cssValue) { |
| 67 exceptionState.throwTypeError("Invalid type for property"); | 75 exceptionState.throwTypeError("Invalid type for property"); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 else | 177 else |
| 170 value.setCSSStyleValueSequence(styleValueVector); | 178 value.setCSSStyleValueSequence(styleValueVector); |
| 171 } | 179 } |
| 172 result.append(std::make_pair(name, value)); | 180 result.append(std::make_pair(name, value)); |
| 173 } | 181 } |
| 174 return result; | 182 return result; |
| 175 } | 183 } |
| 176 | 184 |
| 177 } // namespace blink | 185 } // namespace blink |
| 178 | 186 |
| OLD | NEW |