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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 size_t n = gPropertyWrappers->size(); | 1201 size_t n = gPropertyWrappers->size(); |
1202 for (unsigned int i = 0; i < n; ++i) { | 1202 for (unsigned int i = 0; i < n; ++i) { |
1203 ASSERT((*gPropertyWrappers)[i]->property() - firstCSSProperty < numCSSPr
operties); | 1203 ASSERT((*gPropertyWrappers)[i]->property() - firstCSSProperty < numCSSPr
operties); |
1204 gPropertyWrapperMap[(*gPropertyWrappers)[i]->property() - firstCSSProper
ty] = i; | 1204 gPropertyWrapperMap[(*gPropertyWrappers)[i]->property() - firstCSSProper
ty] = i; |
1205 } | 1205 } |
1206 | 1206 |
1207 // Now add the shorthand wrappers. | 1207 // Now add the shorthand wrappers. |
1208 addShorthandProperties(); | 1208 addShorthandProperties(); |
1209 } | 1209 } |
1210 | 1210 |
1211 static bool gatherEnclosingShorthandProperties(CSSPropertyID property, Animation
PropertyWrapperBase* wrapper, HashSet<CSSPropertyID>& propertySet) | |
1212 { | |
1213 if (!wrapper->isShorthandWrapper()) | |
1214 return false; | |
1215 | |
1216 ShorthandPropertyWrapper* shorthandWrapper = static_cast<ShorthandPropertyWr
apper*>(wrapper); | |
1217 | |
1218 bool contained = false; | |
1219 for (size_t i = 0; i < shorthandWrapper->propertyWrappers().size(); ++i) { | |
1220 AnimationPropertyWrapperBase* currWrapper = shorthandWrapper->propertyWr
appers()[i]; | |
1221 | |
1222 if (gatherEnclosingShorthandProperties(property, currWrapper, propertySe
t) || currWrapper->property() == property) | |
1223 contained = true; | |
1224 } | |
1225 | |
1226 if (contained) | |
1227 propertySet.add(wrapper->property()); | |
1228 | |
1229 return contained; | |
1230 } | |
1231 | |
1232 // Returns true if we need to start animation timers | 1211 // Returns true if we need to start animation timers |
1233 bool CSSPropertyAnimation::blendProperties(const AnimationBase* anim, CSSPropert
yID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double p
rogress) | 1212 bool CSSPropertyAnimation::blendProperties(const AnimationBase* anim, CSSPropert
yID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double p
rogress) |
1234 { | 1213 { |
1235 ASSERT(prop != CSSPropertyInvalid); | 1214 ASSERT(prop != CSSPropertyInvalid); |
1236 | 1215 |
1237 ensurePropertyMap(); | 1216 ensurePropertyMap(); |
1238 | 1217 |
1239 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop); | 1218 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop); |
1240 if (wrapper) { | 1219 if (wrapper) { |
1241 wrapper->blend(anim, dst, a, b, progress); | 1220 wrapper->blend(anim, dst, a, b, progress); |
1242 return !wrapper->animationIsAccelerated() || !anim->isAccelerated(); | 1221 return !wrapper->animationIsAccelerated() || !anim->isAccelerated(); |
1243 } | 1222 } |
1244 | 1223 |
1245 return false; | 1224 return false; |
1246 } | 1225 } |
1247 | 1226 |
1248 bool CSSPropertyAnimation::animationOfPropertyIsAccelerated(CSSPropertyID prop) | 1227 bool CSSPropertyAnimation::animationOfPropertyIsAccelerated(CSSPropertyID prop) |
1249 { | 1228 { |
1250 ensurePropertyMap(); | 1229 ensurePropertyMap(); |
1251 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop); | 1230 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop); |
1252 return wrapper ? wrapper->animationIsAccelerated() : false; | 1231 return wrapper ? wrapper->animationIsAccelerated() : false; |
1253 } | 1232 } |
1254 | 1233 |
1255 // Note: this is inefficient. It's only called from pauseTransitionAtTime(). | |
1256 HashSet<CSSPropertyID> CSSPropertyAnimation::animatableShorthandsAffectingProper
ty(CSSPropertyID property) | |
1257 { | |
1258 ensurePropertyMap(); | |
1259 | |
1260 HashSet<CSSPropertyID> foundProperties; | |
1261 for (int i = 0; i < getNumProperties(); ++i) | |
1262 gatherEnclosingShorthandProperties(property, (*gPropertyWrappers)[i], fo
undProperties); | |
1263 | |
1264 return foundProperties; | |
1265 } | |
1266 | |
1267 bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle
* a, const RenderStyle* b) | 1234 bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle
* a, const RenderStyle* b) |
1268 { | 1235 { |
1269 ensurePropertyMap(); | 1236 ensurePropertyMap(); |
1270 | 1237 |
1271 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop); | 1238 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop); |
1272 if (wrapper) | 1239 if (wrapper) |
1273 return wrapper->equals(a, b); | 1240 return wrapper->equals(a, b); |
1274 return true; | 1241 return true; |
1275 } | 1242 } |
1276 | 1243 |
(...skipping 10 matching lines...) Expand all Loading... |
1287 } | 1254 } |
1288 | 1255 |
1289 int CSSPropertyAnimation::getNumProperties() | 1256 int CSSPropertyAnimation::getNumProperties() |
1290 { | 1257 { |
1291 ensurePropertyMap(); | 1258 ensurePropertyMap(); |
1292 | 1259 |
1293 return gPropertyWrappers->size(); | 1260 return gPropertyWrappers->size(); |
1294 } | 1261 } |
1295 | 1262 |
1296 } | 1263 } |
OLD | NEW |