OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 6 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
7 | 7 |
8 #include "core/animation/LegacyStyleInterpolation.h" | 8 #include "core/animation/LegacyStyleInterpolation.h" |
9 #include "core/css/CSSImageValue.h" | 9 #include "core/css/CSSImageValue.h" |
10 #include "core/css/CSSPrimitiveValue.h" | 10 #include "core/css/CSSPrimitiveValue.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 RefPtrWillBeRawPtr<LegacyStyleInterpolation> innerInterpolation = LegacyStyl
eInterpolation::create( | 23 RefPtrWillBeRawPtr<LegacyStyleInterpolation> innerInterpolation = LegacyStyl
eInterpolation::create( |
24 StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_startCSSVal
ue), | 24 StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_startCSSVal
ue), |
25 StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_endCSSValue
), | 25 StyleResolver::createAnimatableValueSnapshot(state, m_id, *m_endCSSValue
), |
26 m_id); | 26 m_id); |
27 innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); | 27 innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); |
28 innerInterpolation->apply(state); | 28 innerInterpolation->apply(state); |
29 } | 29 } |
30 | 30 |
31 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSValue& value) | 31 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSValue& value) |
32 { | 32 { |
33 switch (value.cssValueType()) { | 33 // FIXME: should not require resolving styles for initial. |
34 case CSSValue::CSS_INHERIT: | 34 if (value.isInitialValue() || value.isInheritedValue()) |
35 return true; | 35 return true; |
36 case CSSValue::CSS_PRIMITIVE_VALUE: | 36 if (value.isPrimitiveValue()) |
37 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); | 37 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); |
38 case CSSValue::CSS_VALUE_LIST: | 38 if (value.isValueList()) |
39 return interpolationRequiresStyleResolve(toCSSValueList(value)); | 39 return interpolationRequiresStyleResolve(toCSSValueList(value)); |
40 case CSSValue::CSS_CUSTOM: | 40 if (value.isImageValue()) |
41 if (value.isImageValue()) | 41 return interpolationRequiresStyleResolve(toCSSImageValue(value)); |
42 return interpolationRequiresStyleResolve(toCSSImageValue(value)); | 42 if (value.isShadowValue()) |
43 if (value.isShadowValue()) | 43 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); |
44 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); | 44 if (value.isSVGDocumentValue()) |
45 if (value.isSVGDocumentValue()) | 45 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value)); |
46 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value
)); | 46 // FIXME: consider other custom types. |
47 // FIXME: consider other custom types. | 47 return true; |
48 return true; | |
49 case CSSValue::CSS_INITIAL: | |
50 // FIXME: should not require resolving styles for initial. | |
51 return true; | |
52 default: | |
53 ASSERT_NOT_REACHED(); | |
54 return true; | |
55 } | |
56 } | 48 } |
57 | 49 |
58 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSPrimitiveValue& primitiveValue) | 50 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSPrimitiveValue& primitiveValue) |
59 { | 51 { |
60 // FIXME: consider other types. | 52 // FIXME: consider other types. |
61 if (primitiveValue.isNumber() || primitiveValue.isPercentage() || primitiveV
alue.isAngle() || primitiveValue.isRGBColor() || primitiveValue.isURI()) | 53 if (primitiveValue.isNumber() || primitiveValue.isPercentage() || primitiveV
alue.isAngle() || primitiveValue.isRGBColor() || primitiveValue.isURI()) |
62 return false; | 54 return false; |
63 | 55 |
64 if (primitiveValue.isLength()) | 56 if (primitiveValue.isLength()) |
65 return primitiveValue.isFontRelativeLength() || primitiveValue.isViewpor
tPercentageLength(); | 57 return primitiveValue.isFontRelativeLength() || primitiveValue.isViewpor
tPercentageLength(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 135 } |
144 | 136 |
145 void DeferredLegacyStyleInterpolation::trace(Visitor* visitor) | 137 void DeferredLegacyStyleInterpolation::trace(Visitor* visitor) |
146 { | 138 { |
147 visitor->trace(m_startCSSValue); | 139 visitor->trace(m_startCSSValue); |
148 visitor->trace(m_endCSSValue); | 140 visitor->trace(m_endCSSValue); |
149 StyleInterpolation::trace(visitor); | 141 StyleInterpolation::trace(visitor); |
150 } | 142 } |
151 | 143 |
152 } | 144 } |
OLD | NEW |