Bug 939843: Required changes in the rest of the tree; r=froydnj

--HG--
extra : rebase_source : 5757eb2b73755c8da08112b91b025a8fa860d7e8
This commit is contained in:
Benjamin Bouvier 2014-02-27 16:23:16 +01:00
Родитель 438e225871
Коммит 460c4df9b5
18 изменённых файлов: 54 добавлений и 50 удалений

Просмотреть файл

@ -1680,7 +1680,7 @@ Accessible::MinValue() const
double
Accessible::Step() const
{
return UnspecifiedNaN(); // no mimimum increment (step) in ARIA.
return UnspecifiedNaN<double>(); // no mimimum increment (step) in ARIA.
}
double
@ -3084,15 +3084,15 @@ double
Accessible::AttrNumericValue(nsIAtom* aAttr) const
{
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
return UnspecifiedNaN();
return UnspecifiedNaN<double>();
nsAutoString attrValue;
if (!mContent->GetAttr(kNameSpaceID_None, aAttr, attrValue))
return UnspecifiedNaN();
return UnspecifiedNaN<double>();
nsresult error = NS_OK;
double value = attrValue.ToDouble(&error);
return NS_FAILED(error) ? UnspecifiedNaN() : value;
return NS_FAILED(error) ? UnspecifiedNaN<double>() : value;
}
uint32_t

Просмотреть файл

@ -144,11 +144,11 @@ ProgressMeterAccessible<Max>::CurValue() const
nsAutoString attrValue;
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue))
return UnspecifiedNaN();
return UnspecifiedNaN<double>();
nsresult error = NS_OK;
value = attrValue.ToDouble(&error);
return NS_FAILED(error) ? UnspecifiedNaN() : value;
return NS_FAILED(error) ? UnspecifiedNaN<double>() : value;
}
template<int Max>

Просмотреть файл

@ -78,7 +78,7 @@ XULSliderAccessible::GetActionName(uint8_t aIndex, nsAString& aName)
NS_ENSURE_ARG(aIndex == 0);
aName.AssignLiteral("activate");
aName.AssignLiteral("activate");
return NS_OK;
}
@ -187,11 +187,11 @@ XULSliderAccessible::GetSliderAttr(nsIAtom* aName) const
nsAutoString attrValue;
nsresult rv = GetSliderAttr(aName, attrValue);
if (NS_FAILED(rv))
return UnspecifiedNaN();
return UnspecifiedNaN<double>();
nsresult error = NS_OK;
double value = attrValue.ToDouble(&error);
return NS_FAILED(error) ? UnspecifiedNaN() : value;
return NS_FAILED(error) ? UnspecifiedNaN<double>() : value;
}
bool

Просмотреть файл

@ -611,7 +611,7 @@ public:
double ValueAsNumber() const
{
return DoesValueAsNumberApply() ? GetValueAsDecimal().toDouble()
: UnspecifiedNaN();
: UnspecifiedNaN<double>();
}
void SetValueAsNumber(double aValue, ErrorResult& aRv);

Просмотреть файл

@ -80,7 +80,7 @@ double
MediaSource::Duration()
{
if (mReadyState == MediaSourceReadyState::Closed) {
return UnspecifiedNaN();
return UnspecifiedNaN<double>();
}
return mDuration;
}
@ -197,7 +197,7 @@ MediaSource::Detach()
MOZ_ASSERT(mDecoder);
mDecoder->DetachMediaSource();
mDecoder = nullptr;
mDuration = UnspecifiedNaN();
mDuration = UnspecifiedNaN<double>();
mActiveSourceBuffers->Clear();
mSourceBuffers->Clear();
SetReadyState(MediaSourceReadyState::Closed);
@ -205,7 +205,7 @@ MediaSource::Detach()
MediaSource::MediaSource(nsPIDOMWindow* aWindow)
: nsDOMEventTargetHelper(aWindow)
, mDuration(UnspecifiedNaN())
, mDuration(UnspecifiedNaN<double>())
, mDecoder(nullptr)
, mReadyState(MediaSourceReadyState::Closed)
{

Просмотреть файл

@ -200,7 +200,7 @@ SourceBuffer::Abort(ErrorResult& aRv)
}
// TODO: Run reset parser algorithm.
mAppendWindowStart = 0;
mAppendWindowEnd = PositiveInfinity();
mAppendWindowEnd = PositiveInfinity<double>();
}
void
@ -239,7 +239,7 @@ SourceBuffer::SourceBuffer(MediaSource* aMediaSource, const nsACString& aType)
: nsDOMEventTargetHelper(aMediaSource->GetParentObject())
, mMediaSource(aMediaSource)
, mAppendWindowStart(0)
, mAppendWindowEnd(PositiveInfinity())
, mAppendWindowEnd(PositiveInfinity<double>())
, mTimestampOffset(0)
, mAppendMode(SourceBufferAppendMode::Segments)
, mUpdating(false)

Просмотреть файл

@ -2630,12 +2630,13 @@ numericSuffixes = {
def numericValue(t, v):
if (t == IDLType.Tags.unrestricted_double or
t == IDLType.Tags.unrestricted_float):
typeName = builtinNames[t]
if v == float("inf"):
return "mozilla::PositiveInfinity()"
return "mozilla::PositiveInfinity<%s>()" % typeName
if v == float("-inf"):
return "mozilla::NegativeInfinity()"
return "mozilla::NegativeInfinity<%s>()" % typeName
if math.isnan(v):
return "mozilla::UnspecifiedNaN()"
return "mozilla::UnspecifiedNaN<%s>()" % typeName
return "%s%s" % (v, numericSuffixes[t])
class CastableObjectUnwrapper():

Просмотреть файл

@ -17,7 +17,7 @@ namespace mozilla {
namespace dom {
Date::Date()
: mMsecSinceEpoch(UnspecifiedNaN())
: mMsecSinceEpoch(UnspecifiedNaN<double>())
{
}

Просмотреть файл

@ -105,7 +105,7 @@ public:
{
if (mState == eIllegal || mBuffer.IsEmpty() ||
(mBuffer.Length() == 1 && mBuffer[0] == '.')) {
return mozilla::UnspecifiedNaN();
return mozilla::UnspecifiedNaN<double>();
}
return mSign*PR_strtod(mBuffer.get(), 0);
}

Просмотреть файл

@ -40,15 +40,15 @@ txNumberExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
#if defined(XP_WIN)
/* XXX MSVC miscompiles such that (NaN == 0) */
if (mozilla::IsNaN(rightDbl))
result = mozilla::UnspecifiedNaN();
result = mozilla::UnspecifiedNaN<double>();
else
#endif
if (leftDbl == 0 || mozilla::IsNaN(leftDbl))
result = mozilla::UnspecifiedNaN();
result = mozilla::UnspecifiedNaN<double>();
else if (mozilla::IsNegative(leftDbl) != mozilla::IsNegative(rightDbl))
result = mozilla::NegativeInfinity();
result = mozilla::NegativeInfinity<double>();
else
result = mozilla::PositiveInfinity();
result = mozilla::PositiveInfinity<double>();
}
else
result = leftDbl / rightDbl;
@ -56,7 +56,7 @@ txNumberExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
case MODULUS:
if (rightDbl == 0) {
result = mozilla::UnspecifiedNaN();
result = mozilla::UnspecifiedNaN<double>();
}
else {
#if defined(XP_WIN)

Просмотреть файл

@ -28,7 +28,7 @@ double
txUnionNodeTest::getDefaultPriority()
{
NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
return mozilla::UnspecifiedNaN();
return mozilla::UnspecifiedNaN<double>();
}
bool

Просмотреть файл

@ -567,20 +567,20 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
if (nodes->isEmpty()) {
return aContext->recycler()->
getNumberResult(UnspecifiedNaN(), aResult);
getNumberResult(UnspecifiedNaN<double>(), aResult);
}
bool findMax = mType == MAX;
double res = findMax ? mozilla::NegativeInfinity() :
mozilla::PositiveInfinity();
double res = findMax ? mozilla::NegativeInfinity<double>() :
mozilla::PositiveInfinity<double>();
int32_t i, len = nodes->size();
for (i = 0; i < len; ++i) {
nsAutoString str;
txXPathNodeUtils::appendNodeValue(nodes->get(i), str);
double val = txDouble::toDouble(str);
if (mozilla::IsNaN(val)) {
res = UnspecifiedNaN();
res = UnspecifiedNaN<double>();
break;
}
@ -610,8 +610,8 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
NS_ENSURE_SUCCESS(rv, rv);
bool findMax = mType == HIGHEST;
double res = findMax ? mozilla::NegativeInfinity() :
mozilla::PositiveInfinity();
double res = findMax ? mozilla::NegativeInfinity<double>() :
mozilla::PositiveInfinity<double>();
int32_t i, len = nodes->size();
for (i = 0; i < len; ++i) {
nsAutoString str;

Просмотреть файл

@ -85,18 +85,18 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
return aContext->recycler()->getStringResult(format->mNaN, aResult);
}
if (value == mozilla::PositiveInfinity()) {
if (value == mozilla::PositiveInfinity<double>()) {
return aContext->recycler()->getStringResult(format->mInfinity,
aResult);
}
if (value == mozilla::NegativeInfinity()) {
if (value == mozilla::NegativeInfinity<double>()) {
nsAutoString res;
res.Append(format->mMinusSign);
res.Append(format->mInfinity);
return aContext->recycler()->getStringResult(res, aResult);
}
// Value is a normal finite number
nsAutoString prefix;
nsAutoString suffix;
@ -362,7 +362,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
}
res.Insert((char16_t)(1 + format->mZeroDigit), resPos + 1);
}
if (!hasFraction && !intDigits && !carry) {
// If we havn't added any characters we add a '0'
// This can only happen for formats like '##.##'

Просмотреть файл

@ -271,7 +271,7 @@ getNumberAttr(txStylesheetAttr* aAttributes,
txStylesheetCompilerState& aState,
double& aNumber)
{
aNumber = UnspecifiedNaN();
aNumber = UnspecifiedNaN<double>();
txStylesheetAttr* attr = nullptr;
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
aName, aRequired, &attr);
@ -520,7 +520,7 @@ txFnStartLREStylesheet(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
txExpandedName nullExpr;
double prio = UnspecifiedNaN();
double prio = UnspecifiedNaN<double>();
nsAutoPtr<txPattern> match(new txRootPattern());
NS_ENSURE_TRUE(match, NS_ERROR_OUT_OF_MEMORY);
@ -1113,7 +1113,7 @@ txFnStartTemplate(int32_t aNamespaceID,
aState, mode);
NS_ENSURE_SUCCESS(rv, rv);
double prio = UnspecifiedNaN();
double prio = UnspecifiedNaN<double>();
rv = getNumberAttr(aAttributes, aAttrCount, nsGkAtoms::priority,
false, aState, prio);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -23,7 +23,7 @@
double txUnionPattern::getDefaultPriority()
{
NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
return mozilla::UnspecifiedNaN();
return mozilla::UnspecifiedNaN<double>();
}
/*

Просмотреть файл

@ -6,10 +6,12 @@
#ifndef MOZILLA_GFX_BASERECT_H_
#define MOZILLA_GFX_BASERECT_H_
#include <cmath>
#include <mozilla/Assertions.h>
#include <mozilla/FloatingPoint.h>
#include <algorithm>
#include <cmath>
#include "mozilla/Assertions.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/TypeTraits.h"
namespace mozilla {
namespace gfx {
@ -60,10 +62,11 @@ struct BaseRect {
// "Finite" means not inf and not NaN
bool IsFinite() const
{
return (mozilla::IsFinite(x) &&
mozilla::IsFinite(y) &&
mozilla::IsFinite(width) &&
mozilla::IsFinite(height));
typedef typename mozilla::Conditional<mozilla::IsSame<T, float>::value, float, double>::Type FloatType;
return (mozilla::IsFinite(FloatType(x)) &&
mozilla::IsFinite(FloatType(y)) &&
mozilla::IsFinite(FloatType(width)) &&
mozilla::IsFinite(FloatType(height)));
}
// Returns true if this rectangle contains the interior of aRect. Always

Просмотреть файл

@ -1976,7 +1976,7 @@ void AsyncPanZoomController::TimeoutContentResponse() {
void AsyncPanZoomController::UpdateZoomConstraints(const ZoomConstraints& aConstraints) {
APZC_LOG("%p updating zoom constraints to %d %d %f %f\n", this, aConstraints.mAllowZoom,
aConstraints.mAllowDoubleTapZoom, aConstraints.mMinZoom.scale, aConstraints.mMaxZoom.scale);
if (IsFloatNaN(aConstraints.mMinZoom.scale) || IsFloatNaN(aConstraints.mMaxZoom.scale)) {
if (IsNaN(aConstraints.mMinZoom.scale) || IsNaN(aConstraints.mMaxZoom.scale)) {
NS_WARNING("APZC received zoom constraints with NaN values; dropping...\n");
return;
}

Просмотреть файл

@ -234,9 +234,9 @@ def init_value(attribute):
return "0"
else:
if realtype.count("double") and attribute.defvalue == "Infinity":
return "mozilla::PositiveInfinity()"
return "mozilla::PositiveInfinity<double>()"
if realtype.count("double") and attribute.defvalue == "-Infinity":
return "mozilla::NegativeInfinity()"
return "mozilla::NegativeInfinity<double>()"
if realtype.count("nsAString"):
return "NS_LITERAL_STRING(\"%s\")" % attribute.defvalue
if realtype.count("nsACString"):