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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 || from.left().type() != to.left().type()) | 190 || from.left().type() != to.left().type()) |
191 return to; | 191 return to; |
192 | 192 |
193 LengthBox result(blendFunc(anim, from.top(), to.top(), progress), | 193 LengthBox result(blendFunc(anim, from.top(), to.top(), progress), |
194 blendFunc(anim, from.right(), to.right(), progress), | 194 blendFunc(anim, from.right(), to.right(), progress), |
195 blendFunc(anim, from.bottom(), to.bottom(), progress), | 195 blendFunc(anim, from.bottom(), to.bottom(), progress), |
196 blendFunc(anim, from.left(), to.left(), progress)); | 196 blendFunc(anim, from.left(), to.left(), progress)); |
197 return result; | 197 return result; |
198 } | 198 } |
199 | 199 |
200 static inline SVGLength blendFunc(const AnimationBase*, const SVGLength& from, c
onst SVGLength& to, double progress) | 200 static inline PassRefPtr<SVGLength> blendFunc(const AnimationBase*, SVGLength* f
rom, SVGLength* to, double progress) |
201 { | 201 { |
202 return to.blend(from, narrowPrecisionToFloat(progress)); | 202 return to->blend(from, narrowPrecisionToFloat(progress)); |
203 } | 203 } |
204 | 204 |
205 static inline Vector<SVGLength> blendFunc(const AnimationBase*, const Vector<SVG
Length>& from, const Vector<SVGLength>& to, double progress) | 205 static inline PassRefPtr<SVGLengthList> blendFunc(const AnimationBase*, SVGLengt
hList* from, SVGLengthList* to, double progress) |
206 { | 206 { |
207 size_t fromLength = from.size(); | 207 size_t fromLength = from->numberOfItems(); |
208 size_t toLength = to.size(); | 208 size_t toLength = to->numberOfItems(); |
209 if (!fromLength) | 209 if (!fromLength) |
210 return !progress ? from : to; | 210 return !progress ? from->clone() : to->clone(); |
211 if (!toLength) | 211 if (!toLength) |
212 return progress == 1 ? from : to; | 212 return progress == 1 ? from->clone() : to->clone(); |
213 | 213 |
214 size_t resultLength = fromLength; | 214 size_t resultLength = fromLength; |
215 if (fromLength != toLength) { | 215 if (fromLength != toLength) { |
216 if (!(fromLength % toLength)) | 216 if (!(fromLength % toLength)) |
217 resultLength = fromLength; | 217 resultLength = fromLength; |
218 else if (!(toLength % fromLength)) | 218 else if (!(toLength % fromLength)) |
219 resultLength = toLength; | 219 resultLength = toLength; |
220 else | 220 else |
221 resultLength = fromLength * toLength; | 221 resultLength = fromLength * toLength; |
222 } | 222 } |
223 Vector<SVGLength> result(resultLength); | 223 RefPtr<SVGLengthList> result; |
224 for (size_t i = 0; i < resultLength; ++i) | 224 for (size_t i = 0; i < resultLength; ++i) |
225 result[i] = to[i % toLength].blend(from[i % fromLength], narrowPrecision
ToFloat(progress)); | 225 result->append(to->at(i % toLength)->blend(from->at(i % fromLength), nar
rowPrecisionToFloat(progress))); |
226 return result; | 226 return result; |
227 } | 227 } |
228 | 228 |
229 static inline PassRefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleF
etchedImage* fromStyleImage, StyleFetchedImage* toStyleImage, double progress) | 229 static inline PassRefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleF
etchedImage* fromStyleImage, StyleFetchedImage* toStyleImage, double progress) |
230 { | 230 { |
231 // If progress is at one of the extremes, we want getComputedStyle to show t
he image, | 231 // If progress is at one of the extremes, we want getComputedStyle to show t
he image, |
232 // not a completed cross-fade, so we hand back one of the existing images. | 232 // not a completed cross-fade, so we hand back one of the existing images. |
233 if (!progress) | 233 if (!progress) |
234 return fromStyleImage; | 234 return fromStyleImage; |
235 if (progress == 1) | 235 if (progress == 1) |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 | 1057 |
1058 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &R
enderStyle::boxShadow, &RenderStyle::setBoxShadow)); | 1058 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &R
enderStyle::boxShadow, &RenderStyle::setBoxShadow)); |
1059 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShad
ow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow)); | 1059 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShad
ow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow)); |
1060 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, &
RenderStyle::textShadow, &RenderStyle::setTextShadow)); | 1060 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, &
RenderStyle::textShadow, &RenderStyle::setTextShadow)); |
1061 | 1061 |
1062 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &Rend
erStyle::fillPaintType, &RenderStyle::fillPaintColor, &RenderStyle::setFillPaint
Color)); | 1062 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &Rend
erStyle::fillPaintType, &RenderStyle::fillPaintColor, &RenderStyle::setFillPaint
Color)); |
1063 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity,
&RenderStyle::fillOpacity, &RenderStyle::setFillOpacity)); | 1063 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity,
&RenderStyle::fillOpacity, &RenderStyle::setFillOpacity)); |
1064 | 1064 |
1065 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &Re
nderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStr
okePaintColor)); | 1065 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &Re
nderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStr
okePaintColor)); |
1066 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacit
y, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity)); | 1066 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacit
y, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity)); |
1067 gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeWi
dth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth)); | 1067 gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSProper
tyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth)); |
1068 gPropertyWrappers->append(new PropertyWrapper< Vector<SVGLength> >(CSSProper
tyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArr
ay)); | 1068 gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLengthList>(CSSPr
opertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDas
hArray)); |
1069 gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeDa
shoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset)); | 1069 gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSProper
tyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashO
ffset)); |
1070 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterl
imit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit)); | 1070 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterl
imit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit)); |
1071 | 1071 |
1072 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity
, &RenderStyle::floodOpacity, &RenderStyle::setFloodOpacity)); | 1072 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity
, &RenderStyle::floodOpacity, &RenderStyle::setFloodOpacity)); |
1073 gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyFl
oodColor, &RenderStyle::floodColor, &RenderStyle::setFloodColor)); | 1073 gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyFl
oodColor, &RenderStyle::floodColor, &RenderStyle::setFloodColor)); |
1074 | 1074 |
1075 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity,
&RenderStyle::stopOpacity, &RenderStyle::setStopOpacity)); | 1075 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity,
&RenderStyle::stopOpacity, &RenderStyle::setStopOpacity)); |
1076 gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertySt
opColor, &RenderStyle::stopColor, &RenderStyle::setStopColor)); | 1076 gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertySt
opColor, &RenderStyle::stopColor, &RenderStyle::setStopColor)); |
1077 | 1077 |
1078 gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyLi
ghtingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor)); | 1078 gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyLi
ghtingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor)); |
1079 | 1079 |
1080 gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyBaseline
Shift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShiftValue)); | 1080 gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSProper
tyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShif
tValue)); |
1081 gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyKerning,
&RenderStyle::kerning, &RenderStyle::setKerning)); | 1081 gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSProper
tyKerning, &RenderStyle::kerning, &RenderStyle::setKerning)); |
1082 | 1082 |
1083 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { | 1083 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { |
1084 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexGrow
, &RenderStyle::flexGrow, &RenderStyle::setFlexGrow)); | 1084 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexGrow
, &RenderStyle::flexGrow, &RenderStyle::setFlexGrow)); |
1085 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexShri
nk, &RenderStyle::flexShrink, &RenderStyle::setFlexShrink)); | 1085 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexShri
nk, &RenderStyle::flexShrink, &RenderStyle::setFlexShrink)); |
1086 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyFlexBas
is, &RenderStyle::flexBasis, &RenderStyle::setFlexBasis)); | 1086 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyFlexBas
is, &RenderStyle::flexBasis, &RenderStyle::setFlexBasis)); |
1087 } | 1087 } |
1088 | 1088 |
1089 // TODO: | 1089 // TODO: |
1090 // | 1090 // |
1091 // CSSPropertyVerticalAlign | 1091 // CSSPropertyVerticalAlign |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 } | 1159 } |
1160 | 1160 |
1161 int CSSPropertyAnimation::getNumProperties() | 1161 int CSSPropertyAnimation::getNumProperties() |
1162 { | 1162 { |
1163 ensurePropertyMap(); | 1163 ensurePropertyMap(); |
1164 | 1164 |
1165 return gPropertyWrappers->size(); | 1165 return gPropertyWrappers->size(); |
1166 } | 1166 } |
1167 | 1167 |
1168 } | 1168 } |
OLD | NEW |