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