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"
|
|
|
|
|
2010-01-12 12:00:49 -08:00
|
|
|
nsSMILTime nsSMILTimeValue::kUnresolvedMillis = LL_MAXINT;
|
2009-01-14 20:38:07 -08:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSMILTimeValue methods:
|
|
|
|
|
2010-01-12 12:00:49 -08:00
|
|
|
static inline PRInt8
|
|
|
|
Cmp(PRInt64 aA, PRInt64 aB)
|
2009-01-14 20:38:07 -08:00
|
|
|
{
|
|
|
|
return aA == aB ? 0 : (aA > aB ? 1 : -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt8
|
|
|
|
nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const
|
|
|
|
{
|
|
|
|
PRInt8 result;
|
|
|
|
|
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;
|
|
|
|
}
|