2009-01-15 07:38:07 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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-15 07:38:07 +03:00
|
|
|
|
|
|
|
#include "nsSMILTimeValue.h"
|
|
|
|
|
2010-01-12 23:00:49 +03:00
|
|
|
nsSMILTime nsSMILTimeValue::kUnresolvedMillis = LL_MAXINT;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSMILTimeValue methods:
|
|
|
|
|
2010-01-12 23:00:49 +03:00
|
|
|
static inline PRInt8
|
|
|
|
Cmp(PRInt64 aA, PRInt64 aB)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
|
|
|
return aA == aB ? 0 : (aA > aB ? 1 : -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt8
|
|
|
|
nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const
|
|
|
|
{
|
|
|
|
PRInt8 result;
|
|
|
|
|
2011-09-07 04:20:40 +04:00
|
|
|
if (mState == STATE_DEFINITE) {
|
|
|
|
result = (aOther.mState == STATE_DEFINITE)
|
2009-01-15 07:38:07 +03:00
|
|
|
? Cmp(mMilliseconds, aOther.mMilliseconds)
|
|
|
|
: -1;
|
|
|
|
} else if (mState == STATE_INDEFINITE) {
|
2011-09-07 04:20:40 +04:00
|
|
|
if (aOther.mState == STATE_DEFINITE)
|
2009-01-15 07:38:07 +03:00
|
|
|
result = 1;
|
|
|
|
else if (aOther.mState == STATE_INDEFINITE)
|
|
|
|
result = 0;
|
|
|
|
else
|
|
|
|
result = -1;
|
|
|
|
} else {
|
|
|
|
result = (aOther.mState != STATE_UNRESOLVED) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|