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 SMILTime blink::operator+(const SMILTime& a, const SMILTime& b) | |
35 { | |
36 if (a.isUnresolved() || b.isUnresolved()) | |
37 return SMILTime::unresolved(); | |
38 if (a.isIndefinite() || b.isIndefinite()) | |
39 return SMILTime::indefinite(); | |
40 return a.value() + b.value(); | |
41 } | |
42 | |
43 SMILTime blink::operator-(const SMILTime& a, const SMILTime& b) | |
44 { | |
45 if (a.isUnresolved() || b.isUnresolved()) | |
46 return SMILTime::unresolved(); | |
47 if (a.isIndefinite() || b.isIndefinite()) | |
48 return SMILTime::indefinite(); | |
49 return a.value() - b.value(); | |
50 } | |
51 | |
52 SMILTime blink::operator*(const SMILTime& a, const SMILTime& b) | 34 SMILTime blink::operator*(const SMILTime& a, const SMILTime& b) |
53 { | 35 { |
54 if (a.isUnresolved() || b.isUnresolved()) | 36 // Equal operators have to be used instead of negation here to make NaN work
as well. |
55 return SMILTime::unresolved(); | 37 if (a.value() == 0 || b.value() == 0) |
56 if (!a.value() || !b.value()) | |
57 return SMILTime(0); | 38 return SMILTime(0); |
58 if (a.isIndefinite() || b.isIndefinite()) | |
59 return SMILTime::indefinite(); | |
60 return a.value() * b.value(); | 39 return a.value() * b.value(); |
61 } | 40 } |
OLD | NEW |