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

Side by Side Diff: Source/core/animation/CompositorAnimations.cpp

Issue 787353003: Animation: Allow cubic-bezier timing inputs outside the range [0, 1] in CC (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@0
Patch Set: Rebase Created 5 years, 11 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 default: 166 default:
167 return false; 167 return false;
168 } 168 }
169 } 169 }
170 } 170 }
171 171
172 CompositorAnimationsImpl::CompositorTiming out; 172 CompositorAnimationsImpl::CompositorTiming out;
173 if (!CompositorAnimationsImpl::convertTimingForCompositor(timing, 0, out, pl ayerPlaybackRate)) 173 if (!CompositorAnimationsImpl::convertTimingForCompositor(timing, 0, out, pl ayerPlaybackRate))
174 return false; 174 return false;
175 175
176 if (timing.timingFunction->type() == TimingFunction::CubicBezierFunction) {
177 // FIXME: Fix compositor timing functions to accept inputs outside of
178 // [0,1].
179 const CubicBezierTimingFunction& cubic = toCubicBezierTimingFunction(*ti ming.timingFunction);
180 const KeyframeVector& keyframes = keyframeEffect.getFrames();
181 double startRange = 0;
182 double endRange = 1;
183 cubic.range(&startRange, &endRange);
184
185 ASSERT(keyframes.size() >= 2);
186 if ((startRange < 0 || endRange > 1) && (keyframes.first()->easing().typ e() != TimingFunction::LinearFunction || keyframes[keyframes.size() - 2]->easing ().type() != TimingFunction::LinearFunction))
187 return false;
188 }
189
190 return true; 176 return true;
191 } 177 }
192 178
193 bool CompositorAnimations::canStartAnimationOnCompositor(const Element& element) 179 bool CompositorAnimations::canStartAnimationOnCompositor(const Element& element)
194 { 180 {
195 return element.renderer() && element.renderer()->compositingState() == Paint sIntoOwnBacking; 181 return element.renderer() && element.renderer()->compositingState() == Paint sIntoOwnBacking;
196 } 182 }
197 183
198 bool CompositorAnimations::startAnimationOnCompositor(const Element& element, in t group, double startTime, double timeOffset, const Timing& timing, const Animat ionEffect& effect, Vector<int>& startedAnimationIds, double playerPlaybackRate) 184 bool CompositorAnimations::startAnimationOnCompositor(const Element& element, in t group, double startTime, double timeOffset, const Timing& timing, const Animat ionEffect& effect, Vector<int>& startedAnimationIds, double playerPlaybackRate)
199 { 185 {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 break; 540 break;
555 default: 541 default:
556 ASSERT_NOT_REACHED(); 542 ASSERT_NOT_REACHED();
557 } 543 }
558 animations.append(animation.release()); 544 animations.append(animation.release());
559 } 545 }
560 ASSERT(!animations.isEmpty()); 546 ASSERT(!animations.isEmpty());
561 } 547 }
562 548
563 } // namespace blink 549 } // namespace blink
OLDNEW
« no previous file with comments | « ManualTests/animation/compositor-animation-steps.html ('k') | Source/core/animation/CompositorAnimationsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698