/src/mozilla-central/dom/smil/nsSMILTimeValue.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "nsSMILTimeValue.h" |
8 | | |
9 | | const nsSMILTime nsSMILTimeValue::kUnresolvedMillis = |
10 | | std::numeric_limits<nsSMILTime>::max(); |
11 | | |
12 | | //---------------------------------------------------------------------- |
13 | | // nsSMILTimeValue methods: |
14 | | |
15 | | static inline int8_t |
16 | | Cmp(int64_t aA, int64_t aB) |
17 | 0 | { |
18 | 0 | return aA == aB ? 0 : (aA > aB ? 1 : -1); |
19 | 0 | } |
20 | | |
21 | | int8_t |
22 | | nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const |
23 | 0 | { |
24 | 0 | int8_t result; |
25 | 0 |
|
26 | 0 | if (mState == STATE_DEFINITE) { |
27 | 0 | result = (aOther.mState == STATE_DEFINITE) |
28 | 0 | ? Cmp(mMilliseconds, aOther.mMilliseconds) |
29 | 0 | : -1; |
30 | 0 | } else if (mState == STATE_INDEFINITE) { |
31 | 0 | if (aOther.mState == STATE_DEFINITE) |
32 | 0 | result = 1; |
33 | 0 | else if (aOther.mState == STATE_INDEFINITE) |
34 | 0 | result = 0; |
35 | 0 | else |
36 | 0 | result = -1; |
37 | 0 | } else { |
38 | 0 | result = (aOther.mState != STATE_UNRESOLVED) ? 1 : 0; |
39 | 0 | } |
40 | 0 |
|
41 | 0 | return result; |
42 | 0 | } |