Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "core/svg/animation/SMILTime.h" | 28 #include "core/svg/animation/SMILTime.h" |
| 29 | 29 |
| 30 #include <float.h> | 30 #include <float.h> |
| 31 | 31 |
| 32 using namespace blink; | 32 using namespace blink; |
| 33 | 33 |
| 34 const double SMILTime::unresolvedValue = DBL_MAX; | |
| 35 // Just a big value smaller than DBL_MAX. Our times are relative to 0, we don't really need the full range. | |
| 36 const double SMILTime::indefiniteValue = FLT_MAX; | |
| 37 | |
| 38 SMILTime blink::operator+(const SMILTime& a, const SMILTime& b) | 34 SMILTime blink::operator+(const SMILTime& a, const SMILTime& b) |
| 39 { | 35 { |
| 40 if (a.isUnresolved() || b.isUnresolved()) | 36 if (a.isUnresolved() || b.isUnresolved()) |
|
fs
2014/08/19 21:49:43
Note: With this new representation, this should no
| |
| 41 return SMILTime::unresolved(); | 37 return SMILTime::unresolved(); |
| 42 if (a.isIndefinite() || b.isIndefinite()) | 38 if (a.isIndefinite() || b.isIndefinite()) |
| 43 return SMILTime::indefinite(); | 39 return SMILTime::indefinite(); |
| 44 return a.value() + b.value(); | 40 return a.value() + b.value(); |
| 45 } | 41 } |
| 46 | 42 |
| 47 SMILTime blink::operator-(const SMILTime& a, const SMILTime& b) | 43 SMILTime blink::operator-(const SMILTime& a, const SMILTime& b) |
| 48 { | 44 { |
| 49 if (a.isUnresolved() || b.isUnresolved()) | 45 if (a.isUnresolved() || b.isUnresolved()) |
| 50 return SMILTime::unresolved(); | 46 return SMILTime::unresolved(); |
| 51 if (a.isIndefinite() || b.isIndefinite()) | 47 if (a.isIndefinite() || b.isIndefinite()) |
| 52 return SMILTime::indefinite(); | 48 return SMILTime::indefinite(); |
| 53 return a.value() - b.value(); | 49 return a.value() - b.value(); |
| 54 } | 50 } |
| 55 | 51 |
| 56 SMILTime blink::operator*(const SMILTime& a, const SMILTime& b) | 52 SMILTime blink::operator*(const SMILTime& a, const SMILTime& b) |
| 57 { | 53 { |
| 58 if (a.isUnresolved() || b.isUnresolved()) | 54 if (a.isUnresolved() || b.isUnresolved()) |
| 59 return SMILTime::unresolved(); | 55 return SMILTime::unresolved(); |
| 60 if (!a.value() || !b.value()) | 56 if (!a.value() || !b.value()) |
| 61 return SMILTime(0); | 57 return SMILTime(0); |
| 62 if (a.isIndefinite() || b.isIndefinite()) | 58 if (a.isIndefinite() || b.isIndefinite()) |
| 63 return SMILTime::indefinite(); | 59 return SMILTime::indefinite(); |
| 64 return a.value() * b.value(); | 60 return a.value() * b.value(); |
| 65 } | 61 } |
| OLD | NEW |