| 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 | 11 |
| 12 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(CSSPropertyID prope
rtyID) | 12 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(CSSPropertyID prope
rtyID) |
| 13 { | 13 { |
| 14 switch (propertyID) { |
| 15 case CSSPropertyLeft: |
| 16 case CSSPropertyRight: |
| 17 case CSSPropertyTop: |
| 18 case CSSPropertyBottom: |
| 19 case CSSPropertyHeight: |
| 20 case CSSPropertyWidth: { |
| 21 const ComputedStyle* style = m_node->layoutObject()->style(); |
| 22 return StyleValueFactory::computedStyleToStyleValueVector(propertyID, st
yle); |
| 23 } |
| 24 default: |
| 25 break; |
| 26 } |
| 14 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(propertyID); | 27 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(propertyID); |
| 15 if (!cssValue) | 28 if (!cssValue) |
| 16 return CSSStyleValueVector(); | 29 return CSSStyleValueVector(); |
| 17 return StyleValueFactory::cssValueToStyleValueVector(propertyID, *cssValue); | 30 return StyleValueFactory::cssValueToStyleValueVector(propertyID, *cssValue); |
| 18 } | 31 } |
| 19 | 32 |
| 20 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(AtomicString custom
PropertyName) | 33 CSSStyleValueVector ComputedStylePropertyMap::getAllInternal(AtomicString custom
PropertyName) |
| 21 { | 34 { |
| 22 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(customPropertyName); | 35 const CSSValue* cssValue = m_computedStyleDeclaration->getPropertyCSSValueIn
ternal(customPropertyName); |
| 23 if (!cssValue) | 36 if (!cssValue) |
| 24 return CSSStyleValueVector(); | 37 return CSSStyleValueVector(); |
| 25 return StyleValueFactory::cssValueToStyleValueVector(CSSPropertyInvalid, *cs
sValue); | 38 return StyleValueFactory::cssValueToStyleValueVector(CSSPropertyInvalid, *cs
sValue); |
| 26 } | 39 } |
| 27 | 40 |
| 28 Vector<String> ComputedStylePropertyMap::getProperties() | 41 Vector<String> ComputedStylePropertyMap::getProperties() |
| 29 { | 42 { |
| 30 Vector<String> result; | 43 Vector<String> result; |
| 31 for (unsigned i = 0; i < m_computedStyleDeclaration->length(); i++) { | 44 for (unsigned i = 0; i < m_computedStyleDeclaration->length(); i++) { |
| 32 result.append(m_computedStyleDeclaration->item(i)); | 45 result.append(m_computedStyleDeclaration->item(i)); |
| 33 } | 46 } |
| 34 return result; | 47 return result; |
| 35 } | 48 } |
| 36 | 49 |
| 37 } // namespace blink | 50 } // namespace blink |
| OLD | NEW |