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

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: Moving test helper code into cpp file to fix linking issue. 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
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 16 matching lines...) Expand all
27 27
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 #include <iosfwd>
38
37 39
38 namespace WebCore { 40 namespace WebCore {
39 41
40 class TimingFunction : public RefCounted<TimingFunction> { 42 class TimingFunction : public RefCounted<TimingFunction> {
41 public: 43 public:
42 44
43 enum Type { 45 enum Type {
44 LinearFunction, CubicBezierFunction, StepsFunction, ChainedFunction 46 LinearFunction, CubicBezierFunction, StepsFunction, ChainedFunction
45 }; 47 };
46 48
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return scaleFromLocal(m_timingFunction->evaluate(scaleToLocal(fracti on), accuracy)); 306 return scaleFromLocal(m_timingFunction->evaluate(scaleToLocal(fracti on), accuracy));
305 } 307 }
306 308
307 private: 309 private:
308 double scaleToLocal(double x) const { return (x - m_min) / (m_max - m_mi n); } 310 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); } 311 double scaleFromLocal(double x) const { return blend(m_min, m_max, x); }
310 312
311 double m_min; 313 double m_min;
312 double m_max; 314 double m_max;
313 RefPtr<TimingFunction> m_timingFunction; 315 RefPtr<TimingFunction> m_timingFunction;
316
317 // Allow printing of our segments. Can be removed once
318 // ChainedTimingFunction has a public API for segments.
319 friend void PrintTo(const ChainedTimingFunction&, ::std::ostream*, bool) ;
shans 2013/10/31 20:22:54 I think it would be cleaner to put these methods o
mithro-old 2013/11/03 09:58:24 The way PrintTo methods are defined is not control
314 }; 320 };
315 321
316 ChainedTimingFunction() 322 ChainedTimingFunction()
317 : TimingFunction(ChainedFunction) 323 : TimingFunction(ChainedFunction)
318 { 324 {
319 ASSERT(RuntimeEnabledFeatures::webAnimationsEnabled()); 325 ASSERT(RuntimeEnabledFeatures::webAnimationsEnabled());
320 } 326 }
321 327
322 Vector<Segment> m_segments; 328 Vector<Segment> m_segments;
329
330 // Allow printing of our segments. Can be removed once
331 // ChainedTimingFunction has a public API for segments.
332 friend void PrintTo(const ChainedTimingFunction&, ::std::ostream*, bool);
323 }; 333 };
324 334
325 } // namespace WebCore 335 } // namespace WebCore
326 336
327 #endif // TimingFunction_h 337 #endif // TimingFunction_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698