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

Side by Side Diff: Source/core/svg/animation/SMILTime.h

Issue 406263002: Make sure that begin time cannot be greater than (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « LayoutTests/svg/animations/animateMotion-crash-with-large-begin-time-expected.txt ('k') | no next file » | 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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 16 matching lines...) Expand all
27 #define SMILTime_h 27 #define SMILTime_h
28 28
29 #include "wtf/Assertions.h" 29 #include "wtf/Assertions.h"
30 #include "wtf/MathExtras.h" 30 #include "wtf/MathExtras.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 class SMILTime { 34 class SMILTime {
35 public: 35 public:
36 SMILTime() : m_time(0) { } 36 SMILTime() : m_time(0) { }
37 SMILTime(double time) : m_time(time) { ASSERT(!std::isnan(time)); } 37 SMILTime(double time, bool checkRange = true) : m_time(checkRange && (time > indefiniteValue) ? indefiniteValue : time) { ASSERT(!std::isnan(time)); }
fs 2014/07/22 16:29:37 I think I'd prefer if this was done at parse-time
reni 2014/07/23 13:42:35 Do you mean using NaN and Inf instead FLT_MAX and
38 SMILTime(const SMILTime& o) : m_time(o.m_time) { } 38 SMILTime(const SMILTime& o) : m_time(o.m_time) { }
39 39
40 static SMILTime unresolved() { return unresolvedValue; } 40 static SMILTime unresolved() { return SMILTime(unresolvedValue, false); }
41 static SMILTime indefinite() { return indefiniteValue; } 41 static SMILTime indefinite() { return SMILTime(indefiniteValue, false); }
42 42
43 SMILTime& operator=(const SMILTime& o) { m_time = o.m_time; return *this; } 43 SMILTime& operator=(const SMILTime& o) { m_time = o.m_time; return *this; }
44 double value() const { return m_time; } 44 double value() const { return m_time; }
45 45
46 bool isFinite() const { return m_time < indefiniteValue; } 46 bool isFinite() const { return m_time < indefiniteValue; }
47 bool isIndefinite() const { return m_time == indefiniteValue; } 47 bool isIndefinite() const { return m_time == indefiniteValue; }
48 bool isUnresolved() const { return m_time == unresolvedValue; } 48 bool isUnresolved() const { return m_time == unresolvedValue; }
49 49
50 private: 50 private:
51 static const double unresolvedValue; 51 static const double unresolvedValue;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 inline bool operator!=(const SMILInterval& a, const SMILInterval& b) 105 inline bool operator!=(const SMILInterval& a, const SMILInterval& b)
106 { 106 {
107 // Compare the "raw" values since the operator!= for SMILTime always return 107 // Compare the "raw" values since the operator!= for SMILTime always return
108 // true for non-finite times. 108 // true for non-finite times.
109 return a.begin.value() != b.begin.value() || a.end.value() != b.end.value(); 109 return a.begin.value() != b.begin.value() || a.end.value() != b.end.value();
110 } 110 }
111 111
112 } 112 }
113 113
114 #endif // SMILTime_h 114 #endif // SMILTime_h
OLDNEW
« no previous file with comments | « LayoutTests/svg/animations/animateMotion-crash-with-large-begin-time-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698