Changeset 40843 in webkit
- Timestamp:
- Feb 10, 2009 5:44:14 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r40842 r40843 209 209 (WebCore::SVGInlineTextBoxQueryWalker::chunkPortionCallback): 210 210 (WebCore::findInlineTextBoxInTextChunks): 211 212 2009-02-10 Simon Fraser <simon.fraser@apple.com> 213 214 Reviewed by Dave Hyatt 215 216 Clean up "fallbackAnimating" logic in AnimationBase. This flag indicates 217 that animation of an accelerated property must run in software for some reason. 218 219 Also remove use of private headers in GraphicsLayerCA related to a case 220 where we may have to fall back on software animation of transform. 221 222 * page/animation/AnimationBase.cpp: 223 (WebCore::AnimationBase::blendProperties): 224 * page/animation/AnimationBase.h: 225 * page/animation/ImplicitAnimation.cpp: 226 (WebCore::ImplicitAnimation::animate): 227 * page/animation/KeyframeAnimation.cpp: 228 (WebCore::KeyframeAnimation::animate): 229 * platform/graphics/mac/GraphicsLayerCA.h: 230 * platform/graphics/mac/GraphicsLayerCA.mm: 231 (WebCore::getValueFunctionNameForTransformOperation): 232 (WebCore::caValueFunctionSupported): 233 (WebCore::GraphicsLayerCA::setBackgroundColor): 234 (WebCore::GraphicsLayerCA::setOpacity): 235 (WebCore::GraphicsLayerCA::animateTransform): 236 (WebCore::GraphicsLayerCA::animateFloat): 237 (WebCore::GraphicsLayerCA::setBasicAnimation): 238 (WebCore::GraphicsLayerCA::setKeyframeAnimation): 211 239 212 240 2009-02-10 Simon Fraser <simon.fraser@apple.com> -
trunk/WebCore/page/animation/AnimationBase.cpp
r40671 r40843 627 627 wrapper->blend(anim, dst, a, b, progress); 628 628 #if USE(ACCELERATED_COMPOSITING) 629 return !wrapper->animationIsAccelerated() ;629 return !wrapper->animationIsAccelerated() || anim->isFallbackAnimating(); 630 630 #else 631 631 return true; -
trunk/WebCore/page/animation/AnimationBase.h
r40700 r40843 215 215 RefPtr<Animation> m_animation; 216 216 CompositeAnimation* m_compAnim; 217 bool m_fallbackAnimating; // true if any animation returned false from startAnimation()217 bool m_fallbackAnimating; // true when animating an accelerated property but have to fall back to software 218 218 bool m_transformFunctionListValid; 219 219 double m_totalDuration, m_nextIterationDuration; -
trunk/WebCore/page/animation/ImplicitAnimation.cpp
r40701 r40843 80 80 81 81 bool needsAnim = blendProperties(this, m_animatingProperty, animatedStyle.get(), m_fromStyle.get(), m_toStyle.get(), progress(1, 0, 0)); 82 if (needsAnim || m_fallbackAnimating)82 if (needsAnim) 83 83 setAnimating(); 84 84 -
trunk/WebCore/page/animation/KeyframeAnimation.cpp
r40685 r40843 146 146 for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) { 147 147 bool needsAnim = blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress); 148 if (needsAnim || m_fallbackAnimating)148 if (needsAnim) 149 149 setAnimating(); 150 150 } -
trunk/WebCore/platform/graphics/mac/GraphicsLayerCA.h
r40433 r40843 110 110 } 111 111 112 void setBasicAnimation(AnimatedPropertyID, const String& component, short index, void* fromVal, void* toVal, bool isTransition, const Animation*, double time);113 void setKeyframeAnimation(AnimatedPropertyID, const String& component, short index, void* keys, void* values, void* timingFunctions, bool isTransition, const Animation*, double time);112 void setBasicAnimation(AnimatedPropertyID, TransformOperation::OperationType, short index, void* fromVal, void* toVal, bool isTransition, const Animation*, double time); 113 void setKeyframeAnimation(AnimatedPropertyID, TransformOperation::OperationType, short index, void* keys, void* values, void* timingFunctions, bool isTransition, const Animation*, double time); 114 114 115 115 virtual void removeAnimation(int index, bool reset); -
trunk/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
r40703 r40843 30 30 #import "GraphicsLayerCA.h" 31 31 32 // Temporary33 #import <QuartzCore/CAAnimationPrivate.h>34 #import <QuartzCore/CAValueFunction.h>35 36 32 #import "Animation.h" 37 33 #import "BlockExceptions.h" … … 161 157 } 162 158 163 static String getAnimationValueFunction(TransformOperation::OperationType transformType) 164 { 159 static NSString* getValueFunctionNameForTransformOperation(TransformOperation::OperationType transformType) 160 { 161 // Use literal strings to avoid link-time dependency on those symbols. 165 162 switch (transformType) { 166 163 case TransformOperation::ROTATE: 167 return "rotateZ";164 return @"rotateZ"; // kCAValueFunctionRotateZ; 168 165 case TransformOperation::SCALE_X: 169 return "scaleX";166 return @"scaleX"; // kCAValueFunctionScaleX; 170 167 case TransformOperation::SCALE_Y: 171 return "scaleY";168 return @"scaleY"; // kCAValueFunctionScaleY; 172 169 case TransformOperation::TRANSLATE_X: 173 return "translateX";170 return @"translateX"; // kCAValueFunctionTranslateX; 174 171 case TransformOperation::TRANSLATE_Y: 175 return "translateY";172 return @"translateY"; // kCAValueFunctionTranslateY; 176 173 default: 177 return String();174 return nil; 178 175 } 179 176 } … … 224 221 225 222 return presLayer; 223 } 224 225 static bool caValueFunctionSupported() 226 { 227 static bool sHaveValueFunction = [[CALayer class] instancesRespondToSelector:@selector(setValueFunction:)]; 228 return sHaveValueFunction; 226 229 } 227 230 … … 720 723 721 724 CGColorRef bgColor = cgColor(color); 722 setBasicAnimation(AnimatedPropertyBackgroundColor, "", 0, fromBackgroundColor, bgColor, true, transition, beginTime);725 setBasicAnimation(AnimatedPropertyBackgroundColor, TransformOperation::NONE, 0, fromBackgroundColor, bgColor, true, transition, beginTime); 723 726 CGColorRelease(bgColor); 724 727 } else { … … 820 823 float fromOpacity = [presLayer opacity]; 821 824 fromOpacityValue = [NSNumber numberWithFloat:fromOpacity]; 822 setBasicAnimation(AnimatedPropertyOpacity, "", 0, fromOpacityValue, toOpacityValue, true, transition, beginTime);825 setBasicAnimation(AnimatedPropertyOpacity, TransformOperation::NONE, 0, fromOpacityValue, toOpacityValue, true, transition, beginTime); 823 826 didAnimate = true; 824 827 } … … 859 862 valueList.makeFunctionList(functionList, isValid, hasBigRotation); 860 863 864 // We need to fall back to software animation if we don't have setValueFunction:, and 865 // we have a > 180deg rotation mixed with another transform. 866 if (hasBigRotation && functionList.size() > 1 && !caValueFunctionSupported()) 867 return false; 868 861 869 BEGIN_BLOCK_OBJC_EXCEPTIONS 862 870 … … 926 934 [tfArray removeLastObject]; 927 935 928 setKeyframeAnimation(AnimatedPropertyWebkitTransform, getAnimationValueFunction(opType), functionIndex, timesArray, valArray, tfArray, isTransition, anim, beginTime);936 setKeyframeAnimation(AnimatedPropertyWebkitTransform, opType, functionIndex, timesArray, valArray, tfArray, isTransition, anim, beginTime); 929 937 930 938 [timesArray release]; … … 950 958 } 951 959 952 setBasicAnimation(AnimatedPropertyWebkitTransform, getAnimationValueFunction(opType), functionIndex, fromValue, toValue, isTransition, anim, beginTime);960 setBasicAnimation(AnimatedPropertyWebkitTransform, opType, functionIndex, fromValue, toValue, isTransition, anim, beginTime); 953 961 } 954 962 … … 981 989 // initialize the property to 0 982 990 [animatedLayer(property) setValue:0 forKeyPath:propertyIdToString(property)]; 983 setBasicAnimation(property, "", 0, isnan(fromVal) ? nil : [NSNumber numberWithFloat:fromVal], isnan(toVal) ? nil : [NSNumber numberWithFloat:toVal], false, animation, beginTime);991 setBasicAnimation(property, TransformOperation::NONE, 0, isnan(fromVal) ? nil : [NSNumber numberWithFloat:fromVal], isnan(toVal) ? nil : [NSNumber numberWithFloat:toVal], false, animation, beginTime); 984 992 return true; 985 993 } … … 1012 1020 [animatedLayer(property) setValue:0 forKeyPath:propertyIdToString(property)]; 1013 1021 // Then set the animation. 1014 setKeyframeAnimation(property, "", 0, timesArray, valArray, tfArray, false, animation, beginTime);1022 setKeyframeAnimation(property, TransformOperation::NONE, 0, timesArray, valArray, tfArray, false, animation, beginTime); 1015 1023 1016 1024 [timesArray release]; … … 1091 1099 } 1092 1100 1093 void GraphicsLayerCA::setBasicAnimation(AnimatedPropertyID property, const String& valueFunction, short index, void* fromVal, void* toVal, bool isTransition, const Animation* transition, double beginTime)1101 void GraphicsLayerCA::setBasicAnimation(AnimatedPropertyID property, TransformOperation::OperationType operationType, short index, void* fromVal, void* toVal, bool isTransition, const Animation* transition, double beginTime) 1094 1102 { 1095 1103 ASSERT(fromVal || toVal); … … 1126 1134 [basicAnim setAdditive:property == AnimatedPropertyWebkitTransform]; 1127 1135 [basicAnim setFillMode:@"extended"]; 1128 [basicAnim setValueFunction:[CAValueFunction functionWithName:valueFunction]]; 1136 if (caValueFunctionSupported()) { 1137 if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(operationType)) 1138 [basicAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]]; 1139 } 1129 1140 1130 1141 // Set the delegate (and property value). … … 1155 1166 } 1156 1167 1157 void GraphicsLayerCA::setKeyframeAnimation(AnimatedPropertyID property, const String& valueFunction, short index, void* keys, void* values, void* timingFunctions,1168 void GraphicsLayerCA::setKeyframeAnimation(AnimatedPropertyID property, TransformOperation::OperationType operationType, short index, void* keys, void* values, void* timingFunctions, 1158 1169 bool isTransition, const Animation* anim, double beginTime) 1159 1170 { … … 1190 1201 [keyframeAnim setAdditive:(property == AnimatedPropertyWebkitTransform) ? YES : NO]; 1191 1202 [keyframeAnim setFillMode:@"extended"]; 1192 [keyframeAnim setValueFunction:[CAValueFunction functionWithName:valueFunction]]; 1193 1203 if (caValueFunctionSupported()) { 1204 if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(operationType)) 1205 [keyframeAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]]; 1206 } 1207 1194 1208 [keyframeAnim setKeyTimes:reinterpret_cast<id>(keys)]; 1195 1209 [keyframeAnim setValues:reinterpret_cast<id>(values)];
Note: See TracChangeset
for help on using the changeset viewer.