| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 m_innerInterpolation = LegacyStyleInterpolation::create(startAnimatableV
alue, endAnimatableValue, m_id); | 38 m_innerInterpolation = LegacyStyleInterpolation::create(startAnimatableV
alue, endAnimatableValue, m_id); |
| 39 m_outdated = false; | 39 m_outdated = false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); | 42 m_innerInterpolation->interpolate(m_cachedIteration, m_cachedFraction); |
| 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.isValueList()) | 53 if (value.isValueList()) |
| 54 return interpolationRequiresStyleResolve(toCSSValueList(value)); | 54 return interpolationRequiresStyleResolve(toCSSValueList(value)); |
| 55 if (value.isImageValue()) | 55 if (value.isImageValue()) |
| 56 return interpolationRequiresStyleResolve(toCSSImageValue(value)); | 56 return interpolationRequiresStyleResolve(toCSSImageValue(value)); |
| 57 if (value.isShadowValue()) | 57 if (value.isShadowValue()) |
| 58 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); | 58 return interpolationRequiresStyleResolve(toCSSShadowValue(value)); |
| 59 if (value.isSVGDocumentValue()) | 59 if (value.isSVGDocumentValue()) |
| 60 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value)); | 60 return interpolationRequiresStyleResolve(toCSSSVGDocumentValue(value)); |
| 61 // FIXME: consider other custom types. | 61 // FIXME: consider other custom types. |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSPrimitiveValue primitiveValue) | 65 bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C
SSPrimitiveValue& primitiveValue) |
| 66 { | 66 { |
| 67 // FIXME: consider other types. | 67 // FIXME: consider other types. |
| 68 if (primitiveValue.isNumber() || primitiveValue.isPercentage() || primitiveV
alue.isAngle() || primitiveValue.isRGBColor() || primitiveValue.isURI()) | 68 if (primitiveValue.isNumber() || primitiveValue.isPercentage() || primitiveV
alue.isAngle() || primitiveValue.isRGBColor() || primitiveValue.isURI()) |
| 69 return false; | 69 return false; |
| 70 | 70 |
| 71 if (primitiveValue.isLength()) | 71 if (primitiveValue.isLength()) |
| 72 return primitiveValue.isFontRelativeLength() || primitiveValue.isViewpor
tPercentageLength(); | 72 return primitiveValue.isFontRelativeLength() || primitiveValue.isViewpor
tPercentageLength(); |
| 73 | 73 |
| 74 if (primitiveValue.isCalculated()) { | 74 if (primitiveValue.isCalculated()) { |
| 75 CSSLengthArray lengthArray(CSSPrimitiveValue::LengthUnitTypeCount); | 75 CSSLengthArray lengthArray(CSSPrimitiveValue::LengthUnitTypeCount); |
| 76 primitiveValue.accumulateLengthArray(lengthArray); | 76 primitiveValue.accumulateLengthArray(lengthArray); |
| 77 return lengthArray[CSSPrimitiveValue::UnitTypeFontSize] != 0 | 77 return lengthArray[CSSPrimitiveValue::UnitTypeFontSize] != 0 |
| 78 || lengthArray[CSSPrimitiveValue::UnitTypeFontXSize] != 0 | 78 || lengthArray[CSSPrimitiveValue::UnitTypeFontXSize] != 0 |
| 79 || lengthArray[CSSPrimitiveValue::UnitTypeRootFontSize] != 0 | 79 || lengthArray[CSSPrimitiveValue::UnitTypeRootFontSize] != 0 |
| 80 || lengthArray[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0 | 80 || lengthArray[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0 |
| 81 || lengthArray[CSSPrimitiveValue::UnitTypeViewportWidth] != 0 | 81 || lengthArray[CSSPrimitiveValue::UnitTypeViewportWidth] != 0 |
| 82 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 | 82 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 |
| 83 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0 | 83 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0 |
| 84 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0; | 84 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0; |
| 85 } | 85 } |
| 86 | 86 |
| 87 if (Pair* pair = primitiveValue.getPairValue()) { | 87 if (Pair* pair = primitiveValue.getPairValue()) { |
| 88 return interpolationRequiresStyleResolve(*pair->first()) | 88 return interpolationRequiresStyleResolve(pair->first()) |
| 89 || interpolationRequiresStyleResolve(*pair->second()); | 89 || interpolationRequiresStyleResolve(pair->second()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (Rect* rect = primitiveValue.getRectValue()) { | 92 if (Rect* rect = primitiveValue.getRectValue()) { |
| 93 return interpolationRequiresStyleResolve(rect->top()) | 93 return interpolationRequiresStyleResolve(rect->top()) |
| 94 || interpolationRequiresStyleResolve(rect->right()) | 94 || interpolationRequiresStyleResolve(rect->right()) |
| 95 || interpolationRequiresStyleResolve(rect->bottom()) | 95 || interpolationRequiresStyleResolve(rect->bottom()) |
| 96 || interpolationRequiresStyleResolve(rect->left()); | 96 || interpolationRequiresStyleResolve(rect->left()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 if (Quad* quad = primitiveValue.getQuadValue()) { | 99 if (Quad* quad = primitiveValue.getQuadValue()) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 DEFINE_TRACE(DeferredLegacyStyleInterpolation) | 152 DEFINE_TRACE(DeferredLegacyStyleInterpolation) |
| 153 { | 153 { |
| 154 visitor->trace(m_startCSSValue); | 154 visitor->trace(m_startCSSValue); |
| 155 visitor->trace(m_endCSSValue); | 155 visitor->trace(m_endCSSValue); |
| 156 visitor->trace(m_innerInterpolation); | 156 visitor->trace(m_innerInterpolation); |
| 157 StyleInterpolation::trace(visitor); | 157 StyleInterpolation::trace(visitor); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } | 160 } |
| OLD | NEW |