| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef SMILTime_h | 26 #ifndef SMILTime_h |
| 27 #define SMILTime_h | 27 #define SMILTime_h |
| 28 | 28 |
| 29 #if ENABLE(SVG) | 29 #if ENABLE(SVG) |
| 30 | 30 |
| 31 #include <algorithm> | 31 #include <algorithm> |
| 32 #include <wtf/MathExtras.h> |
| 32 | 33 |
| 33 namespace WebCore { | 34 namespace WebCore { |
| 34 | 35 |
| 35 class SMILTime { | 36 class SMILTime { |
| 36 public: | 37 public: |
| 37 SMILTime() : m_time(0) { } | 38 SMILTime() : m_time(0) { } |
| 38 SMILTime(double time) : m_time(time) { } | 39 SMILTime(double time) : m_time(time) { ASSERT(!isnan(time)); } |
| 39 SMILTime(const SMILTime& o) : m_time(o.m_time) { } | 40 SMILTime(const SMILTime& o) : m_time(o.m_time) { } |
| 40 | 41 |
| 41 static SMILTime unresolved() { return unresolvedValue; } | 42 static SMILTime unresolved() { return unresolvedValue; } |
| 42 static SMILTime indefinite() { return indefiniteValue; } | 43 static SMILTime indefinite() { return indefiniteValue; } |
| 43 | 44 |
| 44 SMILTime& operator=(const SMILTime& o) { m_time = o.m_time; return *this; } | 45 SMILTime& operator=(const SMILTime& o) { m_time = o.m_time; return *this; } |
| 45 double value() const { return m_time; } | 46 double value() const { return m_time; } |
| 46 | 47 |
| 47 bool isFinite() const { return m_time < indefiniteValue; } | 48 bool isFinite() const { return m_time < indefiniteValue; } |
| 48 bool isIndefinite() const { return m_time == indefiniteValue; } | 49 bool isIndefinite() const { return m_time == indefiniteValue; } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 93 |
| 93 SMILTime operator+(const SMILTime&, const SMILTime&); | 94 SMILTime operator+(const SMILTime&, const SMILTime&); |
| 94 SMILTime operator-(const SMILTime&, const SMILTime&); | 95 SMILTime operator-(const SMILTime&, const SMILTime&); |
| 95 // So multiplying times does not make too much sense but SMIL defines it for dur
ation * repeatCount | 96 // So multiplying times does not make too much sense but SMIL defines it for dur
ation * repeatCount |
| 96 SMILTime operator*(const SMILTime&, const SMILTime&); | 97 SMILTime operator*(const SMILTime&, const SMILTime&); |
| 97 | 98 |
| 98 } | 99 } |
| 99 | 100 |
| 100 #endif // ENABLE(SVG) | 101 #endif // ENABLE(SVG) |
| 101 #endif // SMILTime_h | 102 #endif // SMILTime_h |
| OLD | NEW |