Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp

Issue 1874623002: Implement iterable<DOMString, (StyleValue or sequence<StyleValue>)> for InlineStylePropertyMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@computed-stylepropertymap-2
Patch Set: Address review comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/CSSPropertyNames.h" 8 #include "core/CSSPropertyNames.h"
8 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSPropertyMetadata.h" 10 #include "core/css/CSSPropertyMetadata.h"
10 #include "core/css/CSSValueList.h" 11 #include "core/css/CSSValueList.h"
11 #include "core/css/StylePropertySet.h" 12 #include "core/css/StylePropertySet.h"
12 #include "core/css/cssom/CSSOMTypes.h" 13 #include "core/css/cssom/CSSOMTypes.h"
13 #include "core/css/cssom/SimpleLength.h" 14 #include "core/css/cssom/SimpleLength.h"
14 #include "core/css/cssom/StyleValueFactory.h" 15 #include "core/css/cssom/StyleValueFactory.h"
15 16
16 namespace blink { 17 namespace blink {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 121 }
121 122
122 m_ownerElement->setInlineStyleProperty(propertyID, cssValueList); 123 m_ownerElement->setInlineStyleProperty(propertyID, cssValueList);
123 } 124 }
124 125
125 void InlineStylePropertyMap::remove(CSSPropertyID propertyID, ExceptionState& ex ceptionState) 126 void InlineStylePropertyMap::remove(CSSPropertyID propertyID, ExceptionState& ex ceptionState)
126 { 127 {
127 m_ownerElement->removeInlineStyleProperty(propertyID); 128 m_ownerElement->removeInlineStyleProperty(propertyID);
128 } 129 }
129 130
131 HeapVector<StylePropertyMap::StylePropertyMapEntry> InlineStylePropertyMap::getI terationEntries()
132 {
133 HeapVector<StylePropertyMap::StylePropertyMapEntry> result;
134 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle( );
135 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) {
136 StylePropertySet::PropertyReference propertyReference = inlineStyleSet.p ropertyAt(i);
137 CSSPropertyID propertyID = propertyReference.id();
138 StyleValueVector styleValueVector = cssValueToStyleValueVector(propertyI D, *propertyReference.value());
139 StyleValueOrStyleValueSequence value;
140 if (styleValueVector.size() == 1)
141 value.setStyleValue(styleValueVector[0]);
142 else
143 value.setStyleValueSequence(styleValueVector);
144 result.append(std::make_pair(getPropertyNameString(propertyID), value));
145 }
146 return result;
147 }
148
130 } // namespace blink 149 } // namespace blink
131 150
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698