| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const CSSValue* cssValue = | 65 const CSSValue* cssValue = |
| 66 m_ownerElement->ensureMutableInlineStyle().getPropertyCSSValue( | 66 m_ownerElement->ensureMutableInlineStyle().getPropertyCSSValue( |
| 67 propertyID); | 67 propertyID); |
| 68 if (!cssValue) | 68 if (!cssValue) |
| 69 return CSSStyleValueVector(); | 69 return CSSStyleValueVector(); |
| 70 | 70 |
| 71 return StyleValueFactory::cssValueToStyleValueVector(propertyID, *cssValue); | 71 return StyleValueFactory::cssValueToStyleValueVector(propertyID, *cssValue); |
| 72 } | 72 } |
| 73 | 73 |
| 74 CSSStyleValueVector InlineStylePropertyMap::getAllInternal( | 74 CSSStyleValueVector InlineStylePropertyMap::getAllInternal( |
| 75 AtomicString customPropertyName) { | 75 AtomicString customPropertyName, |
| 76 const CSSValue* cssValue = | 76 ExceptionState& exceptionState) { |
| 77 m_ownerElement->ensureMutableInlineStyle().getPropertyCSSValue( | 77 // TODO(rjwright/meade): Handle custom properties. |
| 78 customPropertyName); | 78 exceptionState.throwTypeError("Invalid propertyName: " + customPropertyName); |
| 79 if (!cssValue) | 79 return CSSStyleValueVector(); |
| 80 return CSSStyleValueVector(); | |
| 81 | |
| 82 return StyleValueFactory::cssValueToStyleValueVector(CSSPropertyInvalid, | |
| 83 *cssValue); | |
| 84 } | 80 } |
| 85 | 81 |
| 86 Vector<String> InlineStylePropertyMap::getProperties() { | 82 Vector<String> InlineStylePropertyMap::getProperties() { |
| 87 DEFINE_STATIC_LOCAL(const String, kAtApply, ("@apply")); | 83 DEFINE_STATIC_LOCAL(const String, kAtApply, ("@apply")); |
| 88 Vector<String> result; | 84 Vector<String> result; |
| 89 bool containsAtApply = false; | 85 bool containsAtApply = false; |
| 90 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle(); | 86 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle(); |
| 91 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { | 87 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { |
| 92 CSSPropertyID propertyID = inlineStyleSet.propertyAt(i).id(); | 88 CSSPropertyID propertyID = inlineStyleSet.propertyAt(i).id(); |
| 93 if (propertyID == CSSPropertyVariable) { | 89 if (propertyID == CSSPropertyVariable) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 value.setCSSStyleValue(styleValueVector[0]); | 223 value.setCSSStyleValue(styleValueVector[0]); |
| 228 else | 224 else |
| 229 value.setCSSStyleValueSequence(styleValueVector); | 225 value.setCSSStyleValueSequence(styleValueVector); |
| 230 } | 226 } |
| 231 result.push_back(std::make_pair(name, value)); | 227 result.push_back(std::make_pair(name, value)); |
| 232 } | 228 } |
| 233 return result; | 229 return result; |
| 234 } | 230 } |
| 235 | 231 |
| 236 } // namespace blink | 232 } // namespace blink |
| OLD | NEW |