| 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/ComputedStylePropertyMap.h" | 5 #include "core/css/cssom/ComputedStylePropertyMap.h" |
| 6 | 6 |
| 7 #include "core/css/CSSComputedStyleDeclaration.h" | 7 #include "core/css/CSSComputedStyleDeclaration.h" |
| 8 #include "core/css/cssom/StyleValueFactory.h" | 8 #include "core/css/cssom/StyleValueFactory.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 namespace cssom { |
| 11 | 12 |
| 12 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(CSSPropertyID prope
rtyID) | 13 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(CSSPropertyID prope
rtyID) |
| 13 { | 14 { |
| 14 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(propertyID); | 15 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(propertyID); |
| 15 if (!cssValue) | 16 if (!cssValue) |
| 16 return CSSStyleValueVector(); | 17 return CSSStyleValueVector(); |
| 17 return StyleValueFactory::cssValueToStyleValueVector(propertyID, *cssValue); | 18 return StyleValueFactory::cssValueToStyleValueVector(propertyID, *cssValue); |
| 18 } | 19 } |
| 19 | 20 |
| 20 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(AtomicString custom
PropertyName) | 21 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(AtomicString custom
PropertyName) |
| 21 { | 22 { |
| 22 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(customPropertyName); | 23 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(customPropertyName); |
| 23 if (!cssValue) | 24 if (!cssValue) |
| 24 return CSSStyleValueVector(); | 25 return CSSStyleValueVector(); |
| 25 return StyleValueFactory::cssValueToStyleValueVector(CSSPropertyInvalid, *cs
sValue); | 26 return StyleValueFactory::cssValueToStyleValueVector(CSSPropertyInvalid, *cs
sValue); |
| 26 } | 27 } |
| 27 | 28 |
| 28 Vector<String> ComputedStylePropertyMap::getProperties() | 29 Vector<String> ComputedStylePropertyMap::getProperties() |
| 29 { | 30 { |
| 30 Vector<String> result; | 31 Vector<String> result; |
| 31 for (unsigned i = 0; i < m_computedStyleDeclaration->length(); i++) { | 32 for (unsigned i = 0; i < m_computedStyleDeclaration->length(); i++) { |
| 32 result.append(m_computedStyleDeclaration->item(i)); | 33 result.append(m_computedStyleDeclaration->item(i)); |
| 33 } | 34 } |
| 34 return result; | 35 return result; |
| 35 } | 36 } |
| 36 | 37 |
| 38 } // namespace cssom |
| 37 } // namespace blink | 39 } // namespace blink |
| 40 |
| OLD | NEW |