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
|
|
|
|
2019-01-22 10:28:40 +03:00
|
|
|
#include "SMILTimeValue.h"
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2019-01-22 10:28:40 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
2019-01-25 06:24:01 +03:00
|
|
|
const SMILTime SMILTimeValue::kUnresolvedMillis =
|
|
|
|
std::numeric_limits<SMILTime>::max();
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2019-01-22 10:28:40 +03:00
|
|
|
// SMILTimeValue methods:
|
2009-01-15 07:38:07 +03:00
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-01-22 10:28:40 +03:00
|
|
|
int8_t SMILTimeValue::CompareTo(const SMILTimeValue& 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;
|
|
|
|
}
|
2019-01-22 10:28:40 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|