Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 3 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 static inline Color blendFunc(const AnimationBase*, const Color& from, const Col or& to, double progress) | 64 static inline Color blendFunc(const AnimationBase*, const Color& from, const Col or& to, double progress) |
| 65 { | 65 { |
| 66 return blend(from, to, progress); | 66 return blend(from, to, progress); |
| 67 } | 67 } |
| 68 | 68 |
| 69 static inline Length blendFunc(const AnimationBase*, const Length& from, const L ength& to, double progress) | 69 static inline Length blendFunc(const AnimationBase*, const Length& from, const L ength& to, double progress) |
| 70 { | 70 { |
| 71 return to.blend(from, progress, ValueRangeAll); | 71 return to.blend(from, progress, ValueRangeAll); |
| 72 } | 72 } |
| 73 | 73 |
| 74 static inline LengthOrNumber blendFunc(const AnimationBase* anim, const LengthOr Number& from, const LengthOrNumber& to, double progress) | |
| 75 { | |
| 76 if (from.isNumber() && to.isNumber()) | |
| 77 return LengthOrNumber(blendFunc(anim, from.number(), to.number(), progre ss)); | |
| 78 | |
| 79 if (from.isLength() && to.isLength()) | |
| 80 return LengthOrNumber(blendFunc(anim, from.length(), to.length(), progre ss)); | |
| 81 | |
| 82 return to; | |
|
Julien - ping for review
2013/11/02 00:00:03
I don't think this is totally correct. In this cas
shans
2013/11/03 23:59:42
If we're interpolating from a length to a number,
davve
2013/11/04 15:02:28
But no worse than the current code though? (see Le
Julien - ping for review
2013/11/04 18:15:54
Fine point. Agreed to punt this to a separate issu
| |
| 83 } | |
| 84 | |
| 85 static inline LengthOrNumberBox blendFunc(const AnimationBase* anim, const Lengt hOrNumberBox& from, const LengthOrNumberBox& to, double progress) | |
| 86 { | |
| 87 return LengthOrNumberBox(blendFunc(anim, from.top(), to.top(), progress), | |
| 88 blendFunc(anim, from.right(), to.right(), progress), | |
| 89 blendFunc(anim, from.bottom(), to.bottom(), progress), | |
| 90 blendFunc(anim, from.left(), to.left(), progress)); | |
| 91 } | |
| 92 | |
| 74 static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress) | 93 static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress) |
| 75 { | 94 { |
| 76 return LengthSize(blendFunc(anim, from.width(), to.width(), progress), | 95 return LengthSize(blendFunc(anim, from.width(), to.width(), progress), |
| 77 blendFunc(anim, from.height(), to.height(), progress)); | 96 blendFunc(anim, from.height(), to.height(), progress)); |
| 78 } | 97 } |
| 79 | 98 |
| 80 static inline LengthPoint blendFunc(const AnimationBase* anim, const LengthPoint & from, const LengthPoint& to, double progress) | 99 static inline LengthPoint blendFunc(const AnimationBase* anim, const LengthPoint & from, const LengthPoint& to, double progress) |
| 81 { | 100 { |
| 82 return LengthPoint(blendFunc(anim, from.x(), to.x(), progress), blendFunc(an im, from.y(), to.y(), progress)); | 101 return LengthPoint(blendFunc(anim, from.x(), to.x(), progress), blendFunc(an im, from.y(), to.y(), progress)); |
| 83 } | 102 } |
| 84 | 103 |
| 85 static inline IntSize blendFunc(const AnimationBase* anim, const IntSize& from, const IntSize& to, double progress) | 104 static inline IntSize blendFunc(const AnimationBase* anim, const IntSize& from, const IntSize& to, double progress) |
| 86 { | 105 { |
| 87 return IntSize(blendFunc(anim, from.width(), to.width(), progress), | 106 return IntSize(blendFunc(anim, from.width(), to.width(), progress), |
| 88 blendFunc(anim, from.height(), to.height(), progress)); | 107 blendFunc(anim, from.height(), to.height(), progress)); |
| 89 } | 108 } |
| 90 | 109 |
| 91 static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra nsformOperations& from, const TransformOperations& to, double progress) | 110 static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra nsformOperations& from, const TransformOperations& to, double progress) |
| 92 { | 111 { |
| 93 if (anim->isTransformFunctionListValid()) | 112 if (anim->isTransformFunctionListValid()) |
| 94 return to.blendByMatchingOperations(from, progress); | 113 return to.blendByMatchingOperations(from, progress); |
| 95 return to.blendByUsingMatrixInterpolation(from, progress); | 114 return to.blendByUsingMatrixInterpolation(from, progress); |
| 96 } | 115 } |
| 97 | 116 |
| 98 static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, Clip PathOperation* from, ClipPathOperation* to, double progress) | 117 static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, Clip PathOperation* from, ClipPathOperation* to, double progress) |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkCo lor, &RenderStyle::setVisitedLinkColor)); | 976 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkCo lor, &RenderStyle::setVisitedLinkColor)); |
| 958 | 977 |
| 959 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColo r, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgro undColor)); | 978 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColo r, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgro undColor)); |
| 960 | 979 |
| 961 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); | 980 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); |
| 962 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyle Image, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage)); | 981 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyle Image, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage)); |
| 963 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage)); | 982 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage)); |
| 964 | 983 |
| 965 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderIma geSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource)); | 984 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderIma geSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource)); |
| 966 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices)); | 985 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices)); |
| 967 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWidth)); | 986 gPropertyWrappers->append(new PropertyWrapper<LengthOrNumberBox>(CSSProperty BorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWi dth)); |
| 968 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImageOutset)) ; | 987 gPropertyWrappers->append(new PropertyWrapper<LengthOrNumberBox>(CSSProperty BorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImage Outset)); |
| 969 | 988 |
| 970 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImage Source)); | 989 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImage Source)); |
| 971 gPropertyWrappers->append(new PropertyWrapper<const NinePieceImage&>(CSSProp ertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImag e)); | 990 gPropertyWrappers->append(new PropertyWrapper<const NinePieceImage&>(CSSProp ertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImag e)); |
| 972 | 991 |
| 973 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); | 992 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); |
| 974 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); | 993 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); |
| 975 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); | 994 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); |
| 976 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBac kgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayer s)); | 995 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBac kgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayer s)); |
| 977 | 996 |
| 978 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); | 997 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 } | 1154 } |
| 1136 | 1155 |
| 1137 int CSSPropertyAnimation::getNumProperties() | 1156 int CSSPropertyAnimation::getNumProperties() |
| 1138 { | 1157 { |
| 1139 ensurePropertyMap(); | 1158 ensurePropertyMap(); |
| 1140 | 1159 |
| 1141 return gPropertyWrappers->size(); | 1160 return gPropertyWrappers->size(); |
| 1142 } | 1161 } |
| 1143 | 1162 |
| 1144 } | 1163 } |
| OLD | NEW |