2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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"
|
|
|
|
|
2012-09-28 23:55:23 +04:00
|
|
|
nsSMILTime nsSMILTimeValue::kUnresolvedMillis = INT64_MAX;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSMILTimeValue methods:
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static inline int8_t
|
|
|
|
Cmp(int64_t aA, int64_t aB)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
|
|
|
return aA == aB ? 0 : (aA > aB ? 1 : -1);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int8_t
|
2009-01-15 07:38:07 +03:00
|
|
|
nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
int8_t result;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
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;
|
|
|
|
}
|