| 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 "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
| 9 #include "core/css/CSSPropertyMetadata.h" | 9 #include "core/css/CSSPropertyMetadata.h" |
| 10 #include "core/css/CSSValueList.h" | 10 #include "core/css/CSSValueList.h" |
| 11 #include "core/css/StylePropertySet.h" | 11 #include "core/css/StylePropertySet.h" |
| 12 #include "core/css/cssom/CSSOMTypes.h" | 12 #include "core/css/cssom/CSSOMTypes.h" |
| 13 #include "core/css/cssom/CSSSimpleLength.h" | 13 #include "core/css/cssom/CSSSimpleLength.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 StylePropertyMap::StyleValueVector InlineStylePropertyMap::getAll(CSSPropertyID
propertyID) | 17 StylePropertyMap::StyleValueVector InlineStylePropertyMap::getAll(CSSPropertyID
propertyID) |
| 18 { | 18 { |
| 19 CSSValue* cssValue = m_ownerElement->ensureMutableInlineStyle().getPropertyC
SSValue(propertyID); | 19 CSSValue* cssValue = m_ownerElement->ensureMutableInlineStyle().getPropertyC
SSValue(propertyID); |
| 20 if (!cssValue) | 20 if (!cssValue) |
| 21 return StyleValueVector(); | 21 return StyleValueVector(); |
| 22 | 22 |
| 23 return cssValueToStyleValueVector(propertyID, *cssValue); | 23 return cssValueToStyleValueVector(propertyID, *cssValue); |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool InlineStylePropertyMap::has(CSSPropertyID propertyID) | |
| 27 { | |
| 28 return !getAll(propertyID).isEmpty(); | |
| 29 } | |
| 30 | |
| 31 Vector<String> InlineStylePropertyMap::getProperties() | 26 Vector<String> InlineStylePropertyMap::getProperties() |
| 32 { | 27 { |
| 33 Vector<String> result; | 28 Vector<String> result; |
| 34 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle(
); | 29 StylePropertySet& inlineStyleSet = m_ownerElement->ensureMutableInlineStyle(
); |
| 35 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { | 30 for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) { |
| 36 CSSPropertyID propertyID = inlineStyleSet.propertyAt(i).id(); | 31 CSSPropertyID propertyID = inlineStyleSet.propertyAt(i).id(); |
| 37 result.append(getPropertyNameString(propertyID)); | 32 result.append(getPropertyNameString(propertyID)); |
| 38 } | 33 } |
| 39 return result; | 34 return result; |
| 40 } | 35 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 m_ownerElement->setInlineStyleProperty(propertyID, cssValueList); | 112 m_ownerElement->setInlineStyleProperty(propertyID, cssValueList); |
| 118 } | 113 } |
| 119 | 114 |
| 120 void InlineStylePropertyMap::remove(CSSPropertyID propertyID, ExceptionState& ex
ceptionState) | 115 void InlineStylePropertyMap::remove(CSSPropertyID propertyID, ExceptionState& ex
ceptionState) |
| 121 { | 116 { |
| 122 m_ownerElement->removeInlineStyleProperty(propertyID); | 117 m_ownerElement->removeInlineStyleProperty(propertyID); |
| 123 } | 118 } |
| 124 | 119 |
| 125 } // namespace blink | 120 } // namespace blink |
| 126 | 121 |
| OLD | NEW |