https://bugs.webkit.org/show_bug.cgi?id=77249
Reviewed by Dan Bernstein.
Changed fetchTransformOperationList to validateTransformOperations and got rid of separately generated list
of transform operations. These are not needed, they are already available in the keyframe lists and they
make it more difficult to add support for hardware animated filters. No behavior changes.
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::validateTransformOperations):
* platform/graphics/GraphicsLayer.h:
(GraphicsLayer):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
(WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
* platform/graphics/ca/GraphicsLayerCA.h:
():
* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::addAnimation):
* platform/graphics/texmap/TextureMapperAnimation.cpp:
(WebCore::applyTransformAnimation):
(WebCore::TextureMapperAnimation::TextureMapperAnimation):
(WebCore::TextureMapperAnimation::applyInternal):
* platform/graphics/texmap/TextureMapperAnimation.h:
(TextureMapperAnimation):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106190
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-27 Chris Marrin <cmarrin@apple.com>
+
+ Get rid of TransformOperationList
+ https://bugs.webkit.org/show_bug.cgi?id=77249
+
+ Reviewed by Dan Bernstein.
+
+ Changed fetchTransformOperationList to validateTransformOperations and got rid of separately generated list
+ of transform operations. These are not needed, they are already available in the keyframe lists and they
+ make it more difficult to add support for hardware animated filters. No behavior changes.
+
+
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::validateTransformOperations):
+ * platform/graphics/GraphicsLayer.h:
+ (GraphicsLayer):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
+ (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ ():
+ * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+ (WebCore::GraphicsLayerTextureMapper::addAnimation):
+ * platform/graphics/texmap/TextureMapperAnimation.cpp:
+ (WebCore::applyTransformAnimation):
+ (WebCore::TextureMapperAnimation::TextureMapperAnimation):
+ (WebCore::TextureMapperAnimation::applyInternal):
+ * platform/graphics/texmap/TextureMapperAnimation.h:
+ (TextureMapperAnimation):
+
2012-01-27 Raymond Toy <rtoy@google.com>
AudioPannerNode::setPanningModel() does not update m_panningModel properly
return static_cast<const TransformAnimationValue*>(valueList.at(index))->value();
}
-void GraphicsLayer::fetchTransformOperationList(const KeyframeValueList& valueList, TransformOperationList& list, bool& isValid, bool& hasBigRotation)
+int GraphicsLayer::validateTransformOperations(const KeyframeValueList& valueList, bool& hasBigRotation)
{
ASSERT(valueList.property() == AnimatedPropertyWebkitTransform);
- list.clear();
- isValid = false;
hasBigRotation = false;
if (valueList.size() < 2)
- return;
+ return -1;
// Empty transforms match anything, so find the first non-empty entry as the reference.
size_t firstIndex = 0;
}
if (firstIndex >= valueList.size())
- return;
+ return -1;
const TransformOperations* firstVal = operationsAt(valueList, firstIndex);
continue;
if (!firstVal->operationsMatch(*val))
- return;
+ return -1;
}
- // Keyframes are valid, fill in the list.
- isValid = true;
-
+ // Keyframes are valid, check for big rotations.
double lastRotAngle = 0.0;
double maxRotAngle = -1.0;
- list.resize(firstVal->operations().size());
for (size_t j = 0; j < firstVal->operations().size(); ++j) {
TransformOperation::OperationType type = firstVal->operations().at(j)->getOperationType();
- list[j] = type;
// if this is a rotation entry, we need to see if any angle differences are >= 180 deg
if (type == TransformOperation::ROTATE_X ||
}
hasBigRotation = maxRotAngle >= 180.0;
+
+ return firstIndex;
}
void clearFilters() { m_filters.clear(); }
#endif
- typedef Vector<TransformOperation::OperationType> TransformOperationList;
- // Given a list of TransformAnimationValues, return an array of transform operations.
- // On return, if hasBigRotation is true, functions contain rotations of >= 180 degrees
- static void fetchTransformOperationList(const KeyframeValueList&, TransformOperationList&, bool& isValid, bool& hasBigRotation);
+ // Given a list of TransformAnimationValues, see if all the operations for each keyframe match. If so
+ // return the index of the KeyframeValueList entry that has that list of operations (it may not be
+ // the first entry because some keyframes might have an empty transform and those match any list).
+ // If the lists don't match return -1. On return, if hasBigRotation is true, functions contain
+ // rotations of >= 180 degrees
+ static int validateTransformOperations(const KeyframeValueList&, bool& hasBigRotation);
virtual void setOpacityInternal(float) { }
return true;
}
-bool GraphicsLayerCA::appendToUncommittedAnimations(const KeyframeValueList& valueList, const TransformOperationList& functionList, const Animation* animation, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation)
+bool GraphicsLayerCA::appendToUncommittedAnimations(const KeyframeValueList& valueList, const TransformOperations* operations, const Animation* animation, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation)
{
- TransformOperation::OperationType transformOp = isMatrixAnimation ? TransformOperation::MATRIX_3D : functionList[animationIndex];
+ TransformOperation::OperationType transformOp = isMatrixAnimation ? TransformOperation::MATRIX_3D : operations->operations().at(animationIndex)->getOperationType();
bool additive = animationIndex > 0;
bool isKeyframe = valueList.size() > 2;
{
ASSERT(valueList.property() == AnimatedPropertyWebkitTransform);
- TransformOperationList functionList;
- bool listsMatch, hasBigRotation;
- fetchTransformOperationList(valueList, functionList, listsMatch, hasBigRotation);
+ bool hasBigRotation;
+ int listIndex = validateTransformOperations(valueList, hasBigRotation);
+ const TransformOperations* operations = (listIndex >= 0) ? static_cast<const TransformAnimationValue*>(valueList.at(listIndex))->value() : 0;
// We need to fall back to software animation if we don't have setValueFunction:, and
// we would need to animate each incoming transform function separately. This is the
// case if we have a rotation >= 180 or we have more than one transform function.
- if ((hasBigRotation || functionList.size() > 1) && !PlatformCAAnimation::supportsValueFunction())
+ if ((hasBigRotation || (operations && operations->size() > 1)) && !PlatformCAAnimation::supportsValueFunction())
return false;
bool validMatrices = true;
- // If functionLists don't match we do a matrix animation, otherwise we do a component hardware animation.
+ // If function lists don't match we do a matrix animation, otherwise we do a component hardware animation.
// Also, we can't do component animation unless we have valueFunction, so we need to do matrix animation
// if that's not true as well.
- bool isMatrixAnimation = !listsMatch || !PlatformCAAnimation::supportsValueFunction();
- int numAnimations = isMatrixAnimation ? 1 : functionList.size();
+ bool isMatrixAnimation = listIndex < 0 || !PlatformCAAnimation::supportsValueFunction();
+ int numAnimations = isMatrixAnimation ? 1 : operations->size();
bool reverseAnimationList = true;
#if !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(WIN)
#endif
if (reverseAnimationList) {
for (int animationIndex = numAnimations - 1; animationIndex >= 0; --animationIndex) {
- if (!appendToUncommittedAnimations(valueList, functionList, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
+ if (!appendToUncommittedAnimations(valueList, operations, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
validMatrices = false;
break;
}
}
} else {
for (int animationIndex = 0; animationIndex < numAnimations; ++animationIndex) {
- if (!appendToUncommittedAnimations(valueList, functionList, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
+ if (!appendToUncommittedAnimations(valueList, operations, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
validMatrices = false;
break;
}
static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer);
void moveOrCopyAnimationsForProperty(MoveOrCopy, AnimatedPropertyID, PlatformCALayer * fromLayer, PlatformCALayer * toLayer);
- bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperationList&, const Animation*, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation);
+ bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation);
enum LayerChange {
NoChange = 0,
if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity))
return false;
- bool listsMatch;
+ bool listsMatch = false;
bool hasBigRotation;
- Vector<TransformOperation::OperationType> functionList;
if (valueList.property() == AnimatedPropertyWebkitTransform)
- fetchTransformOperationList(valueList, functionList, listsMatch, hasBigRotation);
+ listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0;
- m_animations.add(keyframesName, TextureMapperAnimation(valueList, boxSize, anim, timeOffset, functionList, listsMatch));
+ m_animations.add(keyframesName, TextureMapperAnimation(valueList, boxSize, anim, timeOffset, listsMatch));
notifyChange(TextureMapperNode::AnimationChange);
m_animationStartedTimer.startOneShot(0);
return true;
return progress;
}
-static TransformationMatrix applyTransformAnimation(const TransformOperations* from, const TransformOperations* to, double progress, const IntSize& boxSize, const Vector<TransformOperation::OperationType> functionList, bool listsMatch)
+static TransformationMatrix applyTransformAnimation(const TransformOperations* from, const TransformOperations* to, double progress, const IntSize& boxSize, bool listsMatch)
{
TransformationMatrix matrix;
}
-TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, const Vector<TransformOperation::OperationType>& functionList, bool listsMatch)
+TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch)
: m_keyframes(keyframes)
, m_boxSize(boxSize)
, m_animation(Animation::create(animation))
- , m_functionList(functionList)
, m_listsMatch(listsMatch)
, m_startTime(WTF::currentTime() - timeOffset)
, m_pauseTime(0)
client->setOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress));
return;
case AnimatedPropertyWebkitTransform:
- client->setTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_functionList, m_listsMatch));
+ client->setTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch));
return;
default:
ASSERT_NOT_REACHED();
TextureMapperAnimation()
: m_keyframes(AnimatedPropertyInvalid)
{ }
- TextureMapperAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, const Vector<TransformOperation::OperationType>&, bool);
+ TextureMapperAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
void apply(TextureMapperAnimationClient*);
void pause(double);
AnimationState state() const { return m_state; }
IntSize m_boxSize;
RefPtr<Animation> m_animation;
String m_name;
- Vector<TransformOperation::OperationType> m_functionList;
bool m_listsMatch;
bool m_hasBigRotation;
double m_startTime;