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

Side by Side Diff: third_party/WebKit/Source/core/animation/Timing.h

Issue 1906463002: Web Animations: Throw TypeErrors for invalid timing parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 years, 7 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef Timing_h 31 #ifndef Timing_h
32 #define Timing_h 32 #define Timing_h
33 33
34 #include "core/style/DataEquivalency.h"
34 #include "platform/animation/TimingFunction.h" 35 #include "platform/animation/TimingFunction.h"
35 #include "wtf/Allocator.h" 36 #include "wtf/Allocator.h"
36 #include "wtf/MathExtras.h" 37 #include "wtf/MathExtras.h"
37 #include "wtf/RefPtr.h" 38 #include "wtf/RefPtr.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 struct Timing { 42 struct Timing {
42 USING_FAST_MALLOC(Timing); 43 USING_FAST_MALLOC(Timing);
43 public: 44 public:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 ASSERT(std::isfinite(iterationStart)); 87 ASSERT(std::isfinite(iterationStart));
87 ASSERT(iterationStart >= 0); 88 ASSERT(iterationStart >= 0);
88 ASSERT(iterationCount >= 0); 89 ASSERT(iterationCount >= 0);
89 ASSERT(std::isnan(iterationDuration) || iterationDuration >= 0); 90 ASSERT(std::isnan(iterationDuration) || iterationDuration >= 0);
90 ASSERT(std::isfinite(playbackRate)); 91 ASSERT(std::isfinite(playbackRate));
91 ASSERT(timingFunction); 92 ASSERT(timingFunction);
92 } 93 }
93 94
94 bool operator==(const Timing &other) const 95 bool operator==(const Timing &other) const
95 { 96 {
96 return startDelay == other.startDelay && endDelay == other.endDelay 97 return startDelay == other.startDelay
97 && fillMode == other.fillMode && iterationStart == other.iterationSt art 98 && endDelay == other.endDelay
98 && iterationCount == other.iterationCount && iterationDuration == ot her.iterationDuration 99 && fillMode == other.fillMode
99 && playbackRate == other.playbackRate && direction == other.directio n 100 && iterationStart == other.iterationStart
100 && *timingFunction == *other.timingFunction; 101 && iterationCount == other.iterationCount
102 && ((std::isnan(iterationDuration) && std::isnan(other.iterationDura tion)) || iterationDuration == other.iterationDuration)
103 && playbackRate == other.playbackRate
104 && direction == other.direction
105 && dataEquivalent(timingFunction.get(), other.timingFunction.get());
101 } 106 }
102 107
103 bool operator!=(const Timing &other) const 108 bool operator!=(const Timing &other) const
104 { 109 {
105 return !(*this == other); 110 return !(*this == other);
106 } 111 }
107 112
108 double startDelay; 113 double startDelay;
109 double endDelay; 114 double endDelay;
110 FillMode fillMode; 115 FillMode fillMode;
111 double iterationStart; 116 double iterationStart;
112 double iterationCount; 117 double iterationCount;
113 double iterationDuration; 118 double iterationDuration;
114 double playbackRate; 119 double playbackRate;
115 PlaybackDirection direction; 120 PlaybackDirection direction;
116 RefPtr<TimingFunction> timingFunction; 121 RefPtr<TimingFunction> timingFunction;
117 }; 122 };
118 123
119 } // namespace blink 124 } // namespace blink
120 125
121 #endif 126 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698