| 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/CSSOMTypes.h" | 5 #include "core/css/cssom/CSSOMTypes.h" |
| 6 | 6 |
| 7 #include "core/css/CSSPropertyMetadata.h" | 7 #include "core/css/CSSPropertyMetadata.h" |
| 8 #include "core/css/cssom/CSSOMKeywords.h" | 8 #include "core/css/cssom/CSSOMKeywords.h" |
| 9 #include "core/css/cssom/CSSKeywordValue.h" | 9 #include "core/css/cssom/CSSKeywordValue.h" |
| 10 #include "core/css/cssom/CSSLengthValue.h" | 10 #include "core/css/cssom/CSSLengthValue.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 namespace cssom { |
| 13 | 14 |
| 14 bool CSSOMTypes::propertyCanTake(CSSPropertyID id, const CSSStyleValue& styleVal
ue) | 15 bool CSSOMTypes::propertyCanTake(CSSPropertyID id, const CSSStyleValue& styleVal
ue) |
| 15 { | 16 { |
| 16 // Shortcut special case. | 17 // Shortcut special case. |
| 17 if (styleValue.type() == CSSStyleValue::SimpleLengthType || styleValue.type(
) == CSSStyleValue::CalcLengthType) { | 18 if (styleValue.type() == CSSStyleValue::SimpleLengthType || styleValue.type(
) == CSSStyleValue::CalcLengthType) { |
| 18 if (toCSSLengthValue(styleValue).containsPercent() && !CSSPropertyMetada
ta::propertySupportsPercentage(id)) { | 19 if (toCSSLengthValue(styleValue).containsPercent() && !CSSPropertyMetada
ta::propertySupportsPercentage(id)) { |
| 19 return false; | 20 return false; |
| 20 } | 21 } |
| 21 } else if (styleValue.type() == CSSStyleValue::KeywordType) { | 22 } else if (styleValue.type() == CSSStyleValue::KeywordType) { |
| 22 // Keywords are also handled differently. | 23 // Keywords are also handled differently. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 {% for type in property.typedom_types %} | 34 {% for type in property.typedom_types %} |
| 34 {{ "|| " if not loop.first }}styleValue.type() == CSSStyleValue::{{type}
}Type | 35 {{ "|| " if not loop.first }}styleValue.type() == CSSStyleValue::{{type}
}Type |
| 35 {% endfor %} | 36 {% endfor %} |
| 36 ); | 37 ); |
| 37 {% endfor %} | 38 {% endfor %} |
| 38 default: | 39 default: |
| 39 return false; | 40 return false; |
| 40 } | 41 } |
| 41 } | 42 } |
| 42 | 43 |
| 43 } // namespace blink | 44 } // namespace cssom |
| 45 } // namespace blink |
| OLD | NEW |