| 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/ElementAnimations.h" | 8 #include "core/animation/ElementAnimations.h" |
| 9 #include "core/animation/css/CSSAnimatableValueFactory.h" | 9 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 10 #include "core/css/CSSBasicShapes.h" | 10 #include "core/css/CSSBasicShapes.h" |
| 11 #include "core/css/CSSImageValue.h" | 11 #include "core/css/CSSImageValue.h" |
| 12 #include "core/css/CSSPrimitiveValue.h" | 12 #include "core/css/CSSPrimitiveValue.h" |
| 13 #include "core/css/CSSQuadValue.h" |
| 13 #include "core/css/CSSSVGDocumentValue.h" | 14 #include "core/css/CSSSVGDocumentValue.h" |
| 14 #include "core/css/CSSShadowValue.h" | 15 #include "core/css/CSSShadowValue.h" |
| 15 #include "core/css/CSSValueList.h" | 16 #include "core/css/CSSValueList.h" |
| 16 #include "core/css/Pair.h" | 17 #include "core/css/Pair.h" |
| 17 #include "core/css/Rect.h" | |
| 18 #include "core/css/resolver/StyleResolver.h" | 18 #include "core/css/resolver/StyleResolver.h" |
| 19 #include "core/css/resolver/StyleResolverState.h" | 19 #include "core/css/resolver/StyleResolverState.h" |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 | 22 |
| 23 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const | 23 void DeferredLegacyStyleInterpolation::apply(StyleResolverState& state) const |
| 24 { | 24 { |
| 25 if (m_outdated || !state.element()->elementAnimations() || !state.element()-
>elementAnimations()->isAnimationStyleChange()) { | 25 if (m_outdated || !state.element()->elementAnimations() || !state.element()-
>elementAnimations()->isAnimationStyleChange()) { |
| 26 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue; | 26 RefPtrWillBeRawPtr<AnimatableValue> startAnimatableValue; |
| 27 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue; | 27 RefPtrWillBeRawPtr<AnimatableValue> endAnimatableValue; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 43 m_innerInterpolation->apply(state); | 43 m_innerInterpolation->apply(state); |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSValue& value) | 46 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSValue& value) |
| 47 { | 47 { |
| 48 // FIXME: should not require resolving styles for inherit/initial/unset. | 48 // FIXME: should not require resolving styles for inherit/initial/unset. |
| 49 if (value.isCSSWideKeyword()) | 49 if (value.isCSSWideKeyword()) |
| 50 return true; | 50 return true; |
| 51 if (value.isPrimitiveValue()) | 51 if (value.isPrimitiveValue()) |
| 52 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); | 52 return interpolationRequiresStyleResolve(toCSSPrimitiveValue(value)); |
| 53 if (value.isQuadValue()) |
| 54 return interpolationRequiresStyleResolve(toCSSQuadValue(value)); |
| 53 if (value.isValueList()) | 55 if (value.isValueList()) |
| 54 return interpolationRequiresStyleResolve(toCSSValueList(value)); | 56 return interpolationRequiresStyleResolve(toCSSValueList(value)); |
| 55 if (value.isImageValue()) | 57 if (value.isImageValue()) |
| 56 return interpolationRequiresStyleResolve(toCSSImageValue(value)); | 58 return interpolationRequiresStyleResolve(toCSSImageValue(value)); |
| 57 if (value.isShadowValue()) | 59 if (value.isShadowValue()) |
| 58 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); | 60 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); |
| 59 if (value.isSVGDocumentValue()) | 61 if (value.isSVGDocumentValue()) |
| 60 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value)); | 62 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value)); |
| 61 // FIXME: consider other custom types. | 63 // FIXME: consider other custom types. |
| 62 return true; | 64 return true; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 82 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 | 84 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 |
| 83 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0 | 85 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0 |
| 84 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0; | 86 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0; |
| 85 } | 87 } |
| 86 | 88 |
| 87 if (Pair* pair = primitiveValue.getPairValue()) { | 89 if (Pair* pair = primitiveValue.getPairValue()) { |
| 88 return interpolationRequiresStyleResolve(*pair->first()) | 90 return interpolationRequiresStyleResolve(*pair->first()) |
| 89 || interpolationRequiresStyleResolve(*pair->second()); | 91 || interpolationRequiresStyleResolve(*pair->second()); |
| 90 } | 92 } |
| 91 | 93 |
| 92 if (primitiveValue.isRect()) { | |
| 93 Rect* rect = primitiveValue.getRectValue(); | |
| 94 return interpolationRequiresStyleResolve(*rect->top()) | |
| 95 || interpolationRequiresStyleResolve(*rect->right()) | |
| 96 || interpolationRequiresStyleResolve(*rect->bottom()) | |
| 97 || interpolationRequiresStyleResolve(*rect->left()); | |
| 98 } | |
| 99 | |
| 100 if (primitiveValue.isQuad()) { | |
| 101 Quad* quad = primitiveValue.getQuadValue(); | |
| 102 return interpolationRequiresStyleResolve(*quad->top()) | |
| 103 || interpolationRequiresStyleResolve(*quad->right()) | |
| 104 || interpolationRequiresStyleResolve(*quad->bottom()) | |
| 105 || interpolationRequiresStyleResolve(*quad->left()); | |
| 106 } | |
| 107 | |
| 108 if (primitiveValue.isShape()) | 94 if (primitiveValue.isShape()) |
| 109 return interpolationRequiresStyleResolve(*primitiveValue.getShapeValue()
); | 95 return interpolationRequiresStyleResolve(*primitiveValue.getShapeValue()
); |
| 110 | 96 |
| 111 CSSValueID id = primitiveValue.getValueID(); | 97 CSSValueID id = primitiveValue.getValueID(); |
| 112 bool isColor = ((id >= CSSValueAqua && id <= CSSValueTransparent) | 98 bool isColor = ((id >= CSSValueAqua && id <= CSSValueTransparent) |
| 113 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) | 99 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) |
| 114 || id == CSSValueGrey); | 100 || id == CSSValueGrey); |
| 115 return (id != CSSValueNone) && !isColor; | 101 return (id != CSSValueNone) && !isColor; |
| 116 } | 102 } |
| 117 | 103 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 144 } | 130 } |
| 145 return false; | 131 return false; |
| 146 } | 132 } |
| 147 | 133 |
| 148 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSBasicShape& shape) | 134 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSBasicShape& shape) |
| 149 { | 135 { |
| 150 // FIXME: Should determine the specific shape, and inspect the members. | 136 // FIXME: Should determine the specific shape, and inspect the members. |
| 151 return false; | 137 return false; |
| 152 } | 138 } |
| 153 | 139 |
| 140 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSQuadValue& quad) |
| 141 { |
| 142 return interpolationRequiresStyleResolve(*quad.top()) |
| 143 || interpolationRequiresStyleResolve(*quad.right()) |
| 144 || interpolationRequiresStyleResolve(*quad.bottom()) |
| 145 || interpolationRequiresStyleResolve(*quad.left()); |
| 146 } |
| 147 |
| 148 |
| 154 DEFINE_TRACE(DeferredLegacyStyleInterpolation) | 149 DEFINE_TRACE(DeferredLegacyStyleInterpolation) |
| 155 { | 150 { |
| 156 visitor->trace(m_startCSSValue); | 151 visitor->trace(m_startCSSValue); |
| 157 visitor->trace(m_endCSSValue); | 152 visitor->trace(m_endCSSValue); |
| 158 visitor->trace(m_innerInterpolation); | 153 visitor->trace(m_innerInterpolation); |
| 159 StyleInterpolation::trace(visitor); | 154 StyleInterpolation::trace(visitor); |
| 160 } | 155 } |
| 161 | 156 |
| 162 } | 157 } |
| OLD | NEW |