2009-01-14 20:38:07 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-01-14 20:38:07 -08:00
|
|
|
|
|
|
|
#include "nsSMILTimeValue.h"
|
|
|
|
|
2012-09-28 12:55:23 -07:00
|
|
|
nsSMILTime nsSMILTimeValue::kUnresolvedMillis = INT64_MAX;
|
2009-01-14 20:38:07 -08:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSMILTimeValue methods:
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static inline int8_t
|
|
|
|
Cmp(int64_t aA, int64_t aB)
|
2009-01-14 20:38:07 -08:00
|
|
|
{
|
|
|
|
return aA == aB ? 0 : (aA > aB ? 1 : -1);
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int8_t
|
2009-01-14 20:38:07 -08:00
|
|
|
nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const
|
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
int8_t result;
|
2009-01-14 20:38:07 -08:00
|
|
|
|
2011-09-06 17:20:40 -07:00
|
|
|
if (mState == STATE_DEFINITE) {
|
|
|
|
result = (aOther.mState == STATE_DEFINITE)
|
2009-01-14 20:38:07 -08:00
|
|
|
? Cmp(mMilliseconds, aOther.mMilliseconds)
|
|
|
|
: -1;
|
|
|
|
} else if (mState == STATE_INDEFINITE) {
|
2011-09-06 17:20:40 -07:00
|
|
|
if (aOther.mState == STATE_DEFINITE)
|
2009-01-14 20:38:07 -08:00
|
|
|
result = 1;
|
|
|
|
else if (aOther.mState == STATE_INDEFINITE)
|
|
|
|
result = 0;
|
|
|
|
else
|
|
|
|
result = -1;
|
|
|
|
} else {
|
|
|
|
result = (aOther.mState != STATE_UNRESOLVED) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|