1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/smil/nsSMILTimeValue.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,40 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsSMILTimeValue.h" 1.10 + 1.11 +nsSMILTime nsSMILTimeValue::kUnresolvedMillis = INT64_MAX; 1.12 + 1.13 +//---------------------------------------------------------------------- 1.14 +// nsSMILTimeValue methods: 1.15 + 1.16 +static inline int8_t 1.17 +Cmp(int64_t aA, int64_t aB) 1.18 +{ 1.19 + return aA == aB ? 0 : (aA > aB ? 1 : -1); 1.20 +} 1.21 + 1.22 +int8_t 1.23 +nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const 1.24 +{ 1.25 + int8_t result; 1.26 + 1.27 + if (mState == STATE_DEFINITE) { 1.28 + result = (aOther.mState == STATE_DEFINITE) 1.29 + ? Cmp(mMilliseconds, aOther.mMilliseconds) 1.30 + : -1; 1.31 + } else if (mState == STATE_INDEFINITE) { 1.32 + if (aOther.mState == STATE_DEFINITE) 1.33 + result = 1; 1.34 + else if (aOther.mState == STATE_INDEFINITE) 1.35 + result = 0; 1.36 + else 1.37 + result = -1; 1.38 + } else { 1.39 + result = (aOther.mState != STATE_UNRESOLVED) ? 1 : 0; 1.40 + } 1.41 + 1.42 + return result; 1.43 +}