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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 HeapVector<StylePropertyMap::StylePropertyMapEntry> InlineStylePropertyMap::getI
terationEntries() | 147 HeapVector<StylePropertyMap::StylePropertyMapEntry> InlineStylePropertyMap::getI
terationEntries() |
148 { | 148 { |
149 HeapVector<StylePropertyMap::StylePropertyMapEntry> result; | 149 HeapVector<StylePropertyMap::StylePropertyMapEntry> result; |
150 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle(
); | 150 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle(
); |
151 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { | 151 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { |
152 StylePropertySet::PropertyReference propertyReference = inlineStyleSet.p
ropertyAt(i); | 152 StylePropertySet::PropertyReference propertyReference = inlineStyleSet.p
ropertyAt(i); |
153 CSSPropertyID propertyID = propertyReference.id(); | 153 CSSPropertyID propertyID = propertyReference.id(); |
154 String name; | 154 String name; |
155 CSSStyleValueOrCSSStyleValueSequence value; | 155 CSSStyleValueOrCSSStyleValueSequence value; |
156 if (propertyID == CSSPropertyVariable) { | 156 if (propertyID == CSSPropertyVariable) { |
157 const CSSCustomPropertyDeclaration* customDeclaration = toCSSCustomP
ropertyDeclaration(propertyReference.value()); | 157 const CSSCustomPropertyDeclaration& customDeclaration = toCSSCustomP
ropertyDeclaration(propertyReference.value()); |
158 name = customDeclaration->name(); | 158 name = customDeclaration.name(); |
159 // TODO(meade): Eventually custom properties will support other type
s, so actually return them instead of always returning a CSSUnsupportedStyleValu
e. | 159 // TODO(meade): Eventually custom properties will support other type
s, so actually return them instead of always returning a CSSUnsupportedStyleValu
e. |
160 value.setCSSStyleValue(CSSUnsupportedStyleValue::create(customDeclar
ation->customCSSText())); | 160 value.setCSSStyleValue(CSSUnsupportedStyleValue::create(customDeclar
ation.customCSSText())); |
161 } else if (propertyID == CSSPropertyApplyAtRule) { | 161 } else if (propertyID == CSSPropertyApplyAtRule) { |
162 name = "@apply"; | 162 name = "@apply"; |
163 value.setCSSStyleValue(CSSUnsupportedStyleValue::create(toCSSCustomI
dentValue(propertyReference.value())->value())); | 163 value.setCSSStyleValue(CSSUnsupportedStyleValue::create(toCSSCustomI
dentValue(propertyReference.value()).value())); |
164 } else { | 164 } else { |
165 name = getPropertyNameString(propertyID); | 165 name = getPropertyNameString(propertyID); |
166 CSSStyleValueVector styleValueVector = StyleValueFactory::cssValueTo
StyleValueVector(propertyID, *propertyReference.value()); | 166 CSSStyleValueVector styleValueVector = StyleValueFactory::cssValueTo
StyleValueVector(propertyID, propertyReference.value()); |
167 if (styleValueVector.size() == 1) | 167 if (styleValueVector.size() == 1) |
168 value.setCSSStyleValue(styleValueVector[0]); | 168 value.setCSSStyleValue(styleValueVector[0]); |
169 else | 169 else |
170 value.setCSSStyleValueSequence(styleValueVector); | 170 value.setCSSStyleValueSequence(styleValueVector); |
171 } | 171 } |
172 result.append(std::make_pair(name, value)); | 172 result.append(std::make_pair(name, value)); |
173 } | 173 } |
174 return result; | 174 return result; |
175 } | 175 } |
176 | 176 |
177 } // namespace blink | 177 } // namespace blink |
178 | 178 |
OLD | NEW |