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

Side by Side Diff: Source/core/platform/animation/TimingFunction.h

Issue 39223002: TimingFunction test helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Using more permission regex for windows. Created 7 years, 1 month 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/platform/animation/TimingFunctionTestHelper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 17 matching lines...) Expand all
28 #include "RuntimeEnabledFeatures.h" 28 #include "RuntimeEnabledFeatures.h"
29 #include "platform/animation/AnimationUtilities.h" // For blend() 29 #include "platform/animation/AnimationUtilities.h" // For blend()
30 #include "platform/animation/UnitBezier.h" 30 #include "platform/animation/UnitBezier.h"
31 #include "wtf/OwnPtr.h" 31 #include "wtf/OwnPtr.h"
32 #include "wtf/PassOwnPtr.h" 32 #include "wtf/PassOwnPtr.h"
33 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
34 #include "wtf/RefCounted.h" 34 #include "wtf/RefCounted.h"
35 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
36 #include <algorithm> 36 #include <algorithm>
37 37
38
38 namespace WebCore { 39 namespace WebCore {
39 40
40 class TimingFunction : public RefCounted<TimingFunction> { 41 class TimingFunction : public RefCounted<TimingFunction> {
41 public: 42 public:
42 43
43 enum Type { 44 enum Type {
44 LinearFunction, CubicBezierFunction, StepsFunction, ChainedFunction 45 LinearFunction, CubicBezierFunction, StepsFunction, ChainedFunction
45 }; 46 };
46 47
47 virtual ~TimingFunction() { } 48 virtual ~TimingFunction() { }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return other.type() == LinearFunction; 85 return other.type() == LinearFunction;
85 } 86 }
86 87
87 private: 88 private:
88 LinearTimingFunction() 89 LinearTimingFunction()
89 : TimingFunction(LinearFunction) 90 : TimingFunction(LinearFunction)
90 { 91 {
91 } 92 }
92 }; 93 };
93 94
95
96 // Forward declare so we can friend it below. Don't use in production code!
97 class ChainedTimingFunctionPrinter;
98
94 class CubicBezierTimingFunction : public TimingFunction { 99 class CubicBezierTimingFunction : public TimingFunction {
95 public: 100 public:
96 enum SubType { 101 enum SubType {
97 Ease, 102 Ease,
98 EaseIn, 103 EaseIn,
99 EaseOut, 104 EaseOut,
100 EaseInOut, 105 EaseInOut,
101 Custom 106 Custom
102 }; 107 };
103 108
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return scaleFromLocal(m_timingFunction->evaluate(scaleToLocal(fracti on), accuracy)); 309 return scaleFromLocal(m_timingFunction->evaluate(scaleToLocal(fracti on), accuracy));
305 } 310 }
306 311
307 private: 312 private:
308 double scaleToLocal(double x) const { return (x - m_min) / (m_max - m_mi n); } 313 double scaleToLocal(double x) const { return (x - m_min) / (m_max - m_mi n); }
309 double scaleFromLocal(double x) const { return blend(m_min, m_max, x); } 314 double scaleFromLocal(double x) const { return blend(m_min, m_max, x); }
310 315
311 double m_min; 316 double m_min;
312 double m_max; 317 double m_max;
313 RefPtr<TimingFunction> m_timingFunction; 318 RefPtr<TimingFunction> m_timingFunction;
319
320 // Allow printing of our segments. Can be removed once
321 // ChainedTimingFunction has a public API for segments.
322 friend class ChainedTimingFunctionPrinter;
314 }; 323 };
315 324
316 ChainedTimingFunction() 325 ChainedTimingFunction()
317 : TimingFunction(ChainedFunction) 326 : TimingFunction(ChainedFunction)
318 { 327 {
319 ASSERT(RuntimeEnabledFeatures::webAnimationsEnabled()); 328 ASSERT(RuntimeEnabledFeatures::webAnimationsEnabled());
320 } 329 }
321 330
322 Vector<Segment> m_segments; 331 Vector<Segment> m_segments;
332
333 // Allow printing of our segments. Can be removed once
334 // ChainedTimingFunction has a public API for segments.
335 friend class ChainedTimingFunctionPrinter;
323 }; 336 };
324 337
325 } // namespace WebCore 338 } // namespace WebCore
326 339
327 #endif // TimingFunction_h 340 #endif // TimingFunction_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/platform/animation/TimingFunctionTestHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698