Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: Source/core/platform/graphics/chromium/AnimationTranslationUtil.cpp

Issue 14391005: Rename Animation -> PrimitiveAnimation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 canBlend = lastOperations->canBlendWith(*operations); 186 canBlend = lastOperations->canBlendWith(*operations);
187 } 187 }
188 if (canBlend) { 188 if (canBlend) {
189 curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), x1, y1, x2, y2); 189 curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), x1, y1, x2, y2);
190 return true; 190 return true;
191 } 191 }
192 return false; 192 return false;
193 } 193 }
194 194
195 template <class Value, class Keyframe, class Curve> 195 template <class Value, class Keyframe, class Curve>
196 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val ueList, const Animation* animation, int animationId, double timeOffset, Curve* c urve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatSize& boxS ize) 196 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val ueList, const PrimitiveAnimation* animation, int animationId, double timeOffset, Curve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatS ize& boxSize)
197 { 197 {
198 bool alternate = false; 198 bool alternate = false;
199 bool reverse = false; 199 bool reverse = false;
200 if (animation && animation->isDirectionSet()) { 200 if (animation && animation->isDirectionSet()) {
201 Animation::AnimationDirection direction = animation->direction(); 201 PrimitiveAnimation::AnimationDirection direction = animation->direction( );
202 if (direction == Animation::AnimationDirectionAlternate || direction == Animation::AnimationDirectionAlternateReverse) 202 if (direction == PrimitiveAnimation::AnimationDirectionAlternate || dire ction == PrimitiveAnimation::AnimationDirectionAlternateReverse)
203 alternate = true; 203 alternate = true;
204 if (direction == Animation::AnimationDirectionReverse || direction == An imation::AnimationDirectionAlternateReverse) 204 if (direction == PrimitiveAnimation::AnimationDirectionReverse || direct ion == PrimitiveAnimation::AnimationDirectionAlternateReverse)
205 reverse = true; 205 reverse = true;
206 } 206 }
207 207
208 for (size_t i = 0; i < valueList.size(); i++) { 208 for (size_t i = 0; i < valueList.size(); i++) {
209 size_t index = reverse ? valueList.size() - i - 1 : i; 209 size_t index = reverse ? valueList.size() - i - 1 : i;
210 const Value* originalValue = static_cast<const Value*>(valueList.at(inde x)); 210 const Value* originalValue = static_cast<const Value*>(valueList.at(inde x));
211 const Value* lastOriginalValue = 0; 211 const Value* lastOriginalValue = 0;
212 if (valueList.size() > 1 && ((reverse && index + 1 < valueList.size()) | | (!reverse && index > 0))) 212 if (valueList.size() > 1 && ((reverse && index + 1 < valueList.size()) | | (!reverse && index > 0)))
213 lastOriginalValue = static_cast<const Value*>(valueList.at(reverse ? index + 1 : index - 1)); 213 lastOriginalValue = static_cast<const Value*>(valueList.at(reverse ? index + 1 : index - 1));
214 214
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 int iterations = (animation && animation->isIterationCountSet()) ? animation ->iterationCount() : 1; 267 int iterations = (animation && animation->isIterationCountSet()) ? animation ->iterationCount() : 1;
268 webAnimation->setIterations(iterations); 268 webAnimation->setIterations(iterations);
269 webAnimation->setAlternatesDirection(alternate); 269 webAnimation->setAlternatesDirection(alternate);
270 270
271 // If timeOffset > 0, then the animation has started in the past. 271 // If timeOffset > 0, then the animation has started in the past.
272 webAnimation->setTimeOffset(timeOffset); 272 webAnimation->setTimeOffset(timeOffset);
273 273
274 return webAnimation.release(); 274 return webAnimation.release();
275 } 275 }
276 276
277 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val ues, const Animation* animation, int animationId, double timeOffset, const Float Size& boxSize) 277 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val ues, const PrimitiveAnimation* animation, int animationId, double timeOffset, co nst FloatSize& boxSize)
278 { 278 {
279 279
280 280
281 if (values.property() == AnimatedPropertyWebkitTransform) { 281 if (values.property() == AnimatedPropertyWebkitTransform) {
282 OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()- >compositorSupport()->createTransformAnimationCurve()); 282 OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()- >compositorSupport()->createTransformAnimationCurve());
283 return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.g et(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize)); 283 return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.g et(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize));
284 } 284 }
285 285
286 if (values.property() == AnimatedPropertyOpacity) { 286 if (values.property() == AnimatedPropertyOpacity) {
287 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->com positorSupport()->createFloatAnimationCurve()); 287 OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->com positorSupport()->createFloatAnimationCurve());
288 return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloa tAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit ::WebAnimation::TargetPropertyOpacity, FloatSize()); 288 return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloa tAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit ::WebAnimation::TargetPropertyOpacity, FloatSize());
289 } 289 }
290 290
291 return nullptr; 291 return nullptr;
292 } 292 }
293 293
294 } // namespace WebCore 294 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698