зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1660405 - Move away from mozilla::IsFinite in favor of std::isfinite. r=sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D173036
This commit is contained in:
Родитель
a5d28acdd6
Коммит
0b692b5a96
|
@ -183,7 +183,7 @@ ComputedTiming AnimationEffect::GetComputedTimingAt(
|
|||
}
|
||||
|
||||
// Factor in iteration start offset.
|
||||
if (IsFinite(overallProgress)) {
|
||||
if (std::isfinite(overallProgress)) {
|
||||
overallProgress += result.mIterationStart;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ ComputedTiming AnimationEffect::GetComputedTimingAt(
|
|||
// Convert the overall progress to a fraction of a single iteration--the
|
||||
// simply iteration progress.
|
||||
// https://drafts.csswg.org/web-animations/#simple-iteration-progress
|
||||
double progress = IsFinite(overallProgress)
|
||||
double progress = std::isfinite(overallProgress)
|
||||
? fmod(overallProgress, 1.0)
|
||||
: fmod(result.mIterationStart, 1.0);
|
||||
|
||||
|
@ -260,7 +260,7 @@ ComputedTiming AnimationEffect::GetComputedTimingAt(
|
|||
progress = fn->At(progress, result.mBeforeFlag);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(IsFinite(progress), "Progress value should be finite");
|
||||
MOZ_ASSERT(std::isfinite(progress), "Progress value should be finite");
|
||||
result.mProgress.SetValue(progress);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ void DOMMatrixReadOnly::Stringify(nsAString& aResult, ErrorResult& aRv) {
|
|||
nsAutoString matrixStr;
|
||||
auto AppendDouble = [&aRv, &cbuf, &matrixStr](double d,
|
||||
bool isLastItem = false) {
|
||||
if (!mozilla::IsFinite(d)) {
|
||||
if (!std::isfinite(d)) {
|
||||
aRv.ThrowInvalidStateError(
|
||||
"Matrix with a non-finite element cannot be stringified.");
|
||||
return false;
|
||||
|
|
|
@ -3608,28 +3608,28 @@ class TreeOrderComparator {
|
|||
* series is not finite.
|
||||
*/
|
||||
#define NS_ENSURE_FINITE(f, rv) \
|
||||
if (!mozilla::IsFinite(f)) { \
|
||||
if (!std::isfinite(f)) { \
|
||||
return (rv); \
|
||||
}
|
||||
|
||||
#define NS_ENSURE_FINITE2(f1, f2, rv) \
|
||||
if (!mozilla::IsFinite((f1) + (f2))) { \
|
||||
return (rv); \
|
||||
#define NS_ENSURE_FINITE2(f1, f2, rv) \
|
||||
if (!std::isfinite((f1) + (f2))) { \
|
||||
return (rv); \
|
||||
}
|
||||
|
||||
#define NS_ENSURE_FINITE4(f1, f2, f3, f4, rv) \
|
||||
if (!mozilla::IsFinite((f1) + (f2) + (f3) + (f4))) { \
|
||||
return (rv); \
|
||||
#define NS_ENSURE_FINITE4(f1, f2, f3, f4, rv) \
|
||||
if (!std::isfinite((f1) + (f2) + (f3) + (f4))) { \
|
||||
return (rv); \
|
||||
}
|
||||
|
||||
#define NS_ENSURE_FINITE5(f1, f2, f3, f4, f5, rv) \
|
||||
if (!mozilla::IsFinite((f1) + (f2) + (f3) + (f4) + (f5))) { \
|
||||
return (rv); \
|
||||
#define NS_ENSURE_FINITE5(f1, f2, f3, f4, f5, rv) \
|
||||
if (!std::isfinite((f1) + (f2) + (f3) + (f4) + (f5))) { \
|
||||
return (rv); \
|
||||
}
|
||||
|
||||
#define NS_ENSURE_FINITE6(f1, f2, f3, f4, f5, f6, rv) \
|
||||
if (!mozilla::IsFinite((f1) + (f2) + (f3) + (f4) + (f5) + (f6))) { \
|
||||
return (rv); \
|
||||
#define NS_ENSURE_FINITE6(f1, f2, f3, f4, f5, f6, rv) \
|
||||
if (!std::isfinite((f1) + (f2) + (f3) + (f4) + (f5) + (f6))) { \
|
||||
return (rv); \
|
||||
}
|
||||
|
||||
// Deletes a linked list iteratively to avoid blowing up the stack (bug 460444).
|
||||
|
|
|
@ -7354,7 +7354,7 @@ def getJSToNativeConversionInfo(
|
|||
template = template.rstrip()
|
||||
template += fill(
|
||||
"""
|
||||
else if (!mozilla::IsFinite(${readLoc})) {
|
||||
else if (!std::isfinite(${readLoc})) {
|
||||
$*{nonFiniteCode}
|
||||
}
|
||||
""",
|
||||
|
|
|
@ -198,7 +198,7 @@ inline bool PrimitiveConversionTraits_EnforceRange(
|
|||
static_assert(std::numeric_limits<T>::is_integer,
|
||||
"This can only be applied to integers!");
|
||||
|
||||
if (!mozilla::IsFinite(d)) {
|
||||
if (!std::isfinite(d)) {
|
||||
return cx.ThrowErrorMessage<MSG_ENFORCE_RANGE_NON_FINITE>(
|
||||
sourceDescription, TypeName<T>::value());
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ inline bool PrimitiveConversionTraits_Clamp(JSContext* cx,
|
|||
return true;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mozilla::IsFinite(d));
|
||||
MOZ_ASSERT(std::isfinite(d));
|
||||
|
||||
// Banker's rounding (round ties towards even).
|
||||
// We move away from 0 by 0.5f and then truncate. That gets us the right
|
||||
|
|
|
@ -3208,7 +3208,8 @@ static void RoundRectImpl(
|
|||
aRadii,
|
||||
ErrorResult& aError) {
|
||||
// Step 1. If any of x, y, w, or h are infinite or NaN, then return.
|
||||
if (!IsFinite(aX) || !IsFinite(aY) || !IsFinite(aW) || !IsFinite(aH)) {
|
||||
if (!std::isfinite(aX) || !std::isfinite(aY) || !std::isfinite(aW) ||
|
||||
!std::isfinite(aH)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3240,7 +3241,7 @@ static void RoundRectImpl(
|
|||
const DOMPointInit& point = radius.GetAsDOMPointInit();
|
||||
// Step 5.1.1. If radius["x"] or radius["y"] is infinite or NaN, then
|
||||
// return.
|
||||
if (!IsFinite(point.mX) || !IsFinite(point.mY)) {
|
||||
if (!std::isfinite(point.mX) || !std::isfinite(point.mY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3261,7 +3262,7 @@ static void RoundRectImpl(
|
|||
// Step 5.2. If radius is a unrestricted double:
|
||||
double r = radius.GetAsUnrestrictedDouble();
|
||||
// Step 5.2.1. If radius is infinite or NaN, then return.
|
||||
if (!IsFinite(r)) {
|
||||
if (!std::isfinite(r)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4257,7 +4258,7 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (!IsFinite(aX) || !IsFinite(aY)) {
|
||||
if (!std::isfinite(aX) || !std::isfinite(aY)) {
|
||||
aError = NS_OK;
|
||||
// This may not be correct - what should TextMetrics contain in the case of
|
||||
// infinite width or height?
|
||||
|
|
|
@ -70,7 +70,7 @@ bool CoerceDouble(const JS::Value& v, double* d);
|
|||
|
||||
/* Float validation stuff */
|
||||
#define VALIDATE(_f) \
|
||||
if (!IsFinite(_f)) return false
|
||||
if (!std::isfinite(_f)) return false
|
||||
|
||||
inline bool FloatValidate(double f1) {
|
||||
VALIDATE(f1);
|
||||
|
|
|
@ -2709,8 +2709,8 @@ static Maybe<AAStroke::VertexBuffer> GenerateStrokeVertexBuffer(
|
|||
ToAAStrokeLineCap(aStrokeOptions->mLineCap),
|
||||
ToAAStrokeLineJoin(aStrokeOptions->mLineJoin),
|
||||
aStrokeOptions->mMiterLimit};
|
||||
if (style.width <= 0.0f || !IsFinite(style.width) ||
|
||||
style.miter_limit <= 0.0f || !IsFinite(style.miter_limit)) {
|
||||
if (style.width <= 0.0f || !std::isfinite(style.width) ||
|
||||
style.miter_limit <= 0.0f || !std::isfinite(style.miter_limit)) {
|
||||
return Nothing();
|
||||
}
|
||||
AAStroke::Stroker* s = AAStroke::aa_stroke_new(
|
||||
|
|
|
@ -1859,7 +1859,7 @@ void HTMLInputElement::SetValueAsNumber(double aValueAsNumber,
|
|||
ErrorResult& aRv) {
|
||||
// TODO: return TypeError when HTMLInputElement is converted to WebIDL, see
|
||||
// bug 825197.
|
||||
if (IsInfinite(aValueAsNumber)) {
|
||||
if (std::isinf(aValueAsNumber)) {
|
||||
aRv.Throw(NS_ERROR_INVALID_ARG);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -417,7 +417,7 @@ ChannelMediaDecoder::ComputePlaybackRate(const MediaChannelStatistics& aStats,
|
|||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
int64_t length = aResource->GetLength();
|
||||
if (mozilla::IsFinite<double>(aDuration) && aDuration > 0 && length >= 0 &&
|
||||
if (std::isfinite(aDuration) && aDuration > 0 && length >= 0 &&
|
||||
length / aDuration < UINT32_MAX) {
|
||||
return {uint32_t(length / aDuration), true};
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nsTArray.h"
|
||||
#include "WindowRenderer.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
@ -246,7 +247,7 @@ double MediaDecoder::GetDuration() {
|
|||
|
||||
bool MediaDecoder::IsInfinite() const {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mozilla::IsInfinite<double>(mDuration);
|
||||
return std::isinf(mDuration);
|
||||
}
|
||||
|
||||
#define INIT_MIRROR(name, val) \
|
||||
|
|
|
@ -193,7 +193,7 @@ Maybe<MediaExtendedMIMEType> MakeMediaExtendedMIMEType(
|
|||
rv = parser.GetParameter("codecs", codecs);
|
||||
bool haveCodecs = NS_SUCCEEDED(rv);
|
||||
|
||||
if (!IsFinite(aConfig.mFramerate) || aConfig.mFramerate <= 0.0) {
|
||||
if (!std::isfinite(aConfig.mFramerate) || aConfig.mFramerate <= 0.0) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ class AudioEventTimeline {
|
|||
|
||||
const AudioTimelineEvent* GetPreviousEvent(double aTime) const;
|
||||
|
||||
static bool IsValid(double value) { return mozilla::IsFinite(value); }
|
||||
static bool IsValid(double value) { return std::isfinite(value); }
|
||||
|
||||
// This is a sorted array of the events in the timeline. Queries of this
|
||||
// data structure should probably be more frequent than modifications to it,
|
||||
|
|
|
@ -354,7 +354,7 @@ void PannerNode::SetPanningModel(PanningModelType aPanningModel) {
|
|||
static bool SetParamFromDouble(AudioParam* aParam, double aValue,
|
||||
const char (&aParamName)[2], ErrorResult& aRv) {
|
||||
float value = static_cast<float>(aValue);
|
||||
if (!mozilla::IsFinite(value)) {
|
||||
if (!std::isfinite(value)) {
|
||||
aRv.ThrowTypeError<MSG_NOT_FINITE>(aParamName);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ static float calculateNormalizationScale(const nsTArray<const float*>& response,
|
|||
power = sqrt(power / (numberOfChannels * aLength));
|
||||
|
||||
// Protect against accidental overload
|
||||
if (!IsFinite(power) || std::isnan(power) || power < MinPower)
|
||||
if (!std::isfinite(power) || std::isnan(power) || power < MinPower)
|
||||
power = MinPower;
|
||||
|
||||
float scale = 1 / power;
|
||||
|
|
|
@ -152,7 +152,7 @@ float DOMSVGLength::GetValue(ErrorResult& aRv) {
|
|||
if (nsCOMPtr<DOMSVGLengthList> lengthList = do_QueryInterface(mOwner)) {
|
||||
float value = InternalItem().GetValueInUserUnits(lengthList->Element(),
|
||||
lengthList->Axis());
|
||||
if (!IsFinite(value)) {
|
||||
if (!std::isfinite(value)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
}
|
||||
return value;
|
||||
|
@ -196,7 +196,7 @@ void DOMSVGLength::SetValue(float aUserUnitValue, ErrorResult& aRv) {
|
|||
lengthList->Axis());
|
||||
if (uuPerUnit > 0) {
|
||||
float newValue = aUserUnitValue / uuPerUnit;
|
||||
if (IsFinite(newValue)) {
|
||||
if (std::isfinite(newValue)) {
|
||||
AutoChangeLengthListNotifier notifier(this);
|
||||
internalItem.SetValueAndUnit(newValue, internalItem.GetUnit());
|
||||
return;
|
||||
|
@ -357,7 +357,7 @@ void DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit, ErrorResult& aRv) {
|
|||
} else {
|
||||
val = SVGLength(mValue, mUnit).GetValueInSpecifiedUnit(aUnit, nullptr, 0);
|
||||
}
|
||||
if (IsFinite(val)) {
|
||||
if (std::isfinite(val)) {
|
||||
if (HasOwner()) {
|
||||
AutoChangeLengthListNotifier notifier(this);
|
||||
InternalItem().SetValueAndUnit(val, aUnit);
|
||||
|
|
|
@ -214,7 +214,7 @@ void DOMSVGTransform::SetSkewX(float angle, ErrorResult& rv) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!IsFinite(tan(angle * kRadPerDegree))) {
|
||||
if (!std::isfinite(tan(angle * kRadPerDegree))) {
|
||||
rv.ThrowRangeError<MSG_INVALID_TRANSFORM_ANGLE_ERROR>();
|
||||
return;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ void DOMSVGTransform::SetSkewY(float angle, ErrorResult& rv) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!IsFinite(tan(angle * kRadPerDegree))) {
|
||||
if (!std::isfinite(tan(angle * kRadPerDegree))) {
|
||||
rv.ThrowRangeError<MSG_INVALID_TRANSFORM_ANGLE_ERROR>();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ nsresult SVGAnimatedLength::ConvertToSpecifiedUnits(uint16_t unitType,
|
|||
mBaseVal * GetPixelsPerUnit(aSVGElement, mSpecifiedUnitType);
|
||||
float valueInSpecifiedUnits = valueInUserUnits / pixelsPerUnit;
|
||||
|
||||
if (!IsFinite(valueInSpecifiedUnits)) {
|
||||
if (!std::isfinite(valueInSpecifiedUnits)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ nsresult SVGAnimatedLength::SetBaseValue(float aValue, SVGElement* aSVGElement,
|
|||
}
|
||||
|
||||
float valueInSpecifiedUnits = aValue / pixelsPerUnit;
|
||||
if (!IsFinite(valueInSpecifiedUnits)) {
|
||||
if (!std::isfinite(valueInSpecifiedUnits)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ nsresult SVGAnimatedLength::SetAnimValue(float aValue,
|
|||
float valueInSpecifiedUnits =
|
||||
aValue / GetPixelsPerUnit(aSVGElement, mSpecifiedUnitType);
|
||||
|
||||
if (IsFinite(valueInSpecifiedUnits)) {
|
||||
if (std::isfinite(valueInSpecifiedUnits)) {
|
||||
SetAnimValueInSpecifiedUnits(valueInSpecifiedUnits, aSVGElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class SVGAnimatedNumber {
|
|||
|
||||
float BaseVal() override { return mVal->GetBaseValue(); }
|
||||
void SetBaseVal(float aValue) override {
|
||||
MOZ_ASSERT(IsFinite(aValue));
|
||||
MOZ_ASSERT(std::isfinite(aValue));
|
||||
mVal->SetBaseValue(aValue, mSVGElement);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class SVGAnimatedNumberPair {
|
|||
|
||||
float BaseVal() override { return mVal->GetBaseValue(mIndex); }
|
||||
void SetBaseVal(float aValue) override {
|
||||
MOZ_ASSERT(IsFinite(aValue));
|
||||
MOZ_ASSERT(std::isfinite(aValue));
|
||||
mVal->SetBaseValue(aValue, mIndex, mSVGElement);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ static DashState GetStrokeDashData(
|
|||
if (auto* shapeElement = SVGGeometryElement::FromNode(aElement)) {
|
||||
pathScale =
|
||||
shapeElement->GetPathLengthScale(SVGGeometryElement::eForStroking);
|
||||
if (pathScale <= 0 || !IsFinite(pathScale)) {
|
||||
if (pathScale <= 0 || !std::isfinite(pathScale)) {
|
||||
return eContinuousStroke;
|
||||
}
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ bool SVGContentUtils::ParseNumber(RangedPtr<const char16_t>& aIter,
|
|||
return false;
|
||||
}
|
||||
floatType floatValue = floatType(value);
|
||||
if (!IsFinite(floatValue)) {
|
||||
if (!std::isfinite(floatValue)) {
|
||||
return false;
|
||||
}
|
||||
aValue = floatValue;
|
||||
|
|
|
@ -122,16 +122,16 @@ float SVGLength::GetValueInSpecifiedUnit(uint8_t aUnit,
|
|||
SVGLength(0.0f, aUnit).GetUserUnitsPerUnit(aElement, aAxis);
|
||||
|
||||
NS_ASSERTION(
|
||||
userUnitsPerCurrentUnit >= 0 || !IsFinite(userUnitsPerCurrentUnit),
|
||||
userUnitsPerCurrentUnit >= 0 || !std::isfinite(userUnitsPerCurrentUnit),
|
||||
"bad userUnitsPerCurrentUnit");
|
||||
NS_ASSERTION(userUnitsPerNewUnit >= 0 || !IsFinite(userUnitsPerNewUnit),
|
||||
NS_ASSERTION(userUnitsPerNewUnit >= 0 || !std::isfinite(userUnitsPerNewUnit),
|
||||
"bad userUnitsPerNewUnit");
|
||||
|
||||
float value = mValue * userUnitsPerCurrentUnit / userUnitsPerNewUnit;
|
||||
|
||||
// userUnitsPerCurrentUnit could be infinity, or userUnitsPerNewUnit could
|
||||
// be zero.
|
||||
if (IsFinite(value)) {
|
||||
if (std::isfinite(value)) {
|
||||
return value;
|
||||
}
|
||||
return std::numeric_limits<float>::quiet_NaN();
|
||||
|
|
|
@ -122,7 +122,9 @@ class SVGLength {
|
|||
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
bool IsValid() const { return IsFinite(mValue) && IsValidUnitType(mUnit); }
|
||||
bool IsValid() const {
|
||||
return std::isfinite(mValue) && IsValidUnitType(mUnit);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -208,7 +208,7 @@ nsresult SVGLengthListSMILType::ComputeDistance(const SMILValue& aFrom,
|
|||
}
|
||||
|
||||
float distance = sqrt(total);
|
||||
if (!IsFinite(distance)) {
|
||||
if (!std::isfinite(distance)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
aDistance = distance;
|
||||
|
|
|
@ -111,7 +111,7 @@ void SVGMarkerElement::SetOrientToAuto() {
|
|||
|
||||
void SVGMarkerElement::SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv) {
|
||||
float f = angle.Value();
|
||||
if (!IsFinite(f)) {
|
||||
if (!std::isfinite(f)) {
|
||||
rv.ThrowTypeError("Unknown or invalid type");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ already_AddRefed<SVGMatrix> SVGMatrix::FlipY() {
|
|||
|
||||
already_AddRefed<SVGMatrix> SVGMatrix::SkewX(float angle, ErrorResult& rv) {
|
||||
double ta = tan(angle * radPerDegree);
|
||||
if (!IsFinite(ta)) {
|
||||
if (!std::isfinite(ta)) {
|
||||
rv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ already_AddRefed<SVGMatrix> SVGMatrix::SkewX(float angle, ErrorResult& rv) {
|
|||
|
||||
already_AddRefed<SVGMatrix> SVGMatrix::SkewY(float angle, ErrorResult& rv) {
|
||||
double ta = tan(angle * radPerDegree);
|
||||
if (!IsFinite(ta)) {
|
||||
if (!std::isfinite(ta)) {
|
||||
rv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ nsresult SVGNumberListSMILType::ComputeDistance(const SMILValue& aFrom,
|
|||
total += delta * delta;
|
||||
}
|
||||
double distance = sqrt(total);
|
||||
if (!IsFinite(distance)) {
|
||||
if (!std::isfinite(distance)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
aDistance = distance;
|
||||
|
|
|
@ -44,7 +44,7 @@ class SVGPoint {
|
|||
operator Point() const { return Point(mX, mY); }
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsValid() const { return IsFinite(mX) && IsFinite(mY); }
|
||||
bool IsValid() const { return std::isfinite(mX) && std::isfinite(mY); }
|
||||
#endif
|
||||
|
||||
void SetX(float aX) { mX = aX; }
|
||||
|
|
|
@ -125,7 +125,7 @@ nsresult SVGPointListSMILType::ComputeDistance(const SMILValue& aFrom,
|
|||
total += dx * dx + dy * dy;
|
||||
}
|
||||
double distance = sqrt(total);
|
||||
if (!IsFinite(distance)) {
|
||||
if (!std::isfinite(distance)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
aDistance = distance;
|
||||
|
|
|
@ -164,15 +164,15 @@ gfx::Matrix SVGViewportElement::GetViewBoxTransform() const {
|
|||
viewportHeight = mViewportHeight;
|
||||
}
|
||||
|
||||
if (!IsFinite(viewportWidth) || viewportWidth <= 0.0f ||
|
||||
!IsFinite(viewportHeight) || viewportHeight <= 0.0f) {
|
||||
if (!std::isfinite(viewportWidth) || viewportWidth <= 0.0f ||
|
||||
!std::isfinite(viewportHeight) || viewportHeight <= 0.0f) {
|
||||
return gfx::Matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
|
||||
}
|
||||
|
||||
SVGViewBox viewBox = GetViewBoxWithSynthesis(viewportWidth, viewportHeight);
|
||||
|
||||
if (!IsFinite(viewBox.width) || viewBox.width <= 0.0f ||
|
||||
!IsFinite(viewBox.height) || viewBox.height <= 0.0f) {
|
||||
if (!std::isfinite(viewBox.width) || viewBox.width <= 0.0f ||
|
||||
!std::isfinite(viewBox.height) || viewBox.height <= 0.0f) {
|
||||
return gfx::Matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular
|
||||
}
|
||||
|
||||
|
|
|
@ -478,7 +478,7 @@ nsresult txCoreFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mozilla::IsFinite(dbl)) {
|
||||
if (std::isfinite(dbl)) {
|
||||
if (mozilla::IsNegative(dbl) && dbl >= -0.5) {
|
||||
dbl *= 0;
|
||||
} else {
|
||||
|
@ -493,8 +493,7 @@ nsresult txCoreFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mozilla::IsFinite(dbl) && !mozilla::IsNegativeZero(dbl))
|
||||
dbl = floor(dbl);
|
||||
if (std::isfinite(dbl) && !mozilla::IsNegativeZero(dbl)) dbl = floor(dbl);
|
||||
|
||||
return aContext->recycler()->getNumberResult(dbl, aResult);
|
||||
}
|
||||
|
@ -503,7 +502,7 @@ nsresult txCoreFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mozilla::IsFinite(dbl)) {
|
||||
if (std::isfinite(dbl)) {
|
||||
if (mozilla::IsNegative(dbl) && dbl > -1)
|
||||
dbl *= 0;
|
||||
else
|
||||
|
|
|
@ -99,7 +99,7 @@ struct BasePoint {
|
|||
bool IsFinite() const {
|
||||
using FloatType =
|
||||
std::conditional_t<std::is_same_v<T, float>, float, double>;
|
||||
return (mozilla::IsFinite(FloatType(x)) && mozilla::IsFinite(FloatType(y)));
|
||||
return (std::isfinite(FloatType(x)) && std::isfinite(FloatType(y)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,10 +66,9 @@ struct BaseRect {
|
|||
bool IsFinite() const {
|
||||
using FloatType =
|
||||
std::conditional_t<std::is_same_v<T, float>, float, double>;
|
||||
return (mozilla::IsFinite(FloatType(x)) &&
|
||||
mozilla::IsFinite(FloatType(y)) &&
|
||||
mozilla::IsFinite(FloatType(width)) &&
|
||||
mozilla::IsFinite(FloatType(height)));
|
||||
return (std::isfinite(FloatType(x)) && std::isfinite(FloatType(y)) &&
|
||||
std::isfinite(FloatType(width)) &&
|
||||
std::isfinite(FloatType(height)));
|
||||
}
|
||||
|
||||
// Returns true if this rectangle contains the interior of aRect. Always
|
||||
|
|
|
@ -1203,8 +1203,8 @@ void DrawTargetCairo::ClearRect(const Rect& aRect) {
|
|||
AutoPrepareForDrawing prep(this, mContext);
|
||||
|
||||
if (!mContext || aRect.Width() < 0 || aRect.Height() < 0 ||
|
||||
!IsFinite(aRect.X()) || !IsFinite(aRect.Width()) ||
|
||||
!IsFinite(aRect.Y()) || !IsFinite(aRect.Height())) {
|
||||
!std::isfinite(aRect.X()) || !std::isfinite(aRect.Width()) ||
|
||||
!std::isfinite(aRect.Y()) || !std::isfinite(aRect.Height())) {
|
||||
gfxCriticalNote << "ClearRect with invalid argument " << gfx::hexa(mContext)
|
||||
<< " with " << aRect.Width() << "x" << aRect.Height()
|
||||
<< " [" << aRect.X() << ", " << aRect.Y() << "]";
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "PathSkia.h"
|
||||
#include "Swizzle.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
# include "BorrowedContext.h"
|
||||
|
@ -523,8 +524,8 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
|
|||
GradientStopsSkia* stops =
|
||||
static_cast<GradientStopsSkia*>(pat.mStops.get());
|
||||
if (!stops || stops->mCount < 2 || !pat.mCenter1.IsFinite() ||
|
||||
!IsFinite(pat.mRadius1) || !pat.mCenter2.IsFinite() ||
|
||||
!IsFinite(pat.mRadius2) ||
|
||||
!std::isfinite(pat.mRadius1) || !pat.mCenter2.IsFinite() ||
|
||||
!std::isfinite(pat.mRadius2) ||
|
||||
(pat.mCenter1 == pat.mCenter2 && pat.mRadius1 == pat.mRadius2)) {
|
||||
aPaint.setColor(SK_ColorTRANSPARENT);
|
||||
} else {
|
||||
|
@ -558,7 +559,7 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
|
|||
GradientStopsSkia* stops =
|
||||
static_cast<GradientStopsSkia*>(pat.mStops.get());
|
||||
if (!stops || stops->mCount < 2 || !pat.mCenter.IsFinite() ||
|
||||
!IsFinite(pat.mAngle)) {
|
||||
!std::isfinite(pat.mAngle)) {
|
||||
aPaint.setColor(SK_ColorTRANSPARENT);
|
||||
} else {
|
||||
SkMatrix mat;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "skia/include/effects/SkDashPathEffect.h"
|
||||
#include "skia/include/core/SkShader.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include "nsDebug.h"
|
||||
|
||||
|
@ -119,7 +120,7 @@ static inline bool StrokeOptionsToPaint(SkPaint& aPaint,
|
|||
// Skia renders 0 width strokes with a width of 1 (and in black),
|
||||
// so we should just skip the draw call entirely.
|
||||
// Skia does not handle non-finite line widths.
|
||||
if (!aOptions.mLineWidth || !IsFinite(aOptions.mLineWidth)) {
|
||||
if (!aOptions.mLineWidth || !std::isfinite(aOptions.mLineWidth)) {
|
||||
return false;
|
||||
}
|
||||
aPaint.setStrokeWidth(SkFloatToScalar(aOptions.mLineWidth));
|
||||
|
|
|
@ -335,9 +335,8 @@ class BaseMatrix {
|
|||
|
||||
/* Verifies that the matrix contains no Infs or NaNs. */
|
||||
bool IsFinite() const {
|
||||
return mozilla::IsFinite(_11) && mozilla::IsFinite(_12) &&
|
||||
mozilla::IsFinite(_21) && mozilla::IsFinite(_22) &&
|
||||
mozilla::IsFinite(_31) && mozilla::IsFinite(_32);
|
||||
return std::isfinite(_11) && std::isfinite(_12) && std::isfinite(_21) &&
|
||||
std::isfinite(_22) && std::isfinite(_31) && std::isfinite(_32);
|
||||
}
|
||||
|
||||
/* Returns true if the matrix is a rectilinear transformation (i.e.
|
||||
|
@ -397,7 +396,7 @@ class BaseMatrix {
|
|||
*/
|
||||
bool IsSingular() const {
|
||||
T det = Determinant();
|
||||
return !mozilla::IsFinite(det) || det == 0;
|
||||
return !std::isfinite(det) || det == 0;
|
||||
}
|
||||
|
||||
GFX2D_API BaseMatrix<T>& NudgeToIntegers() {
|
||||
|
@ -1512,14 +1511,12 @@ class Matrix4x4Typed {
|
|||
|
||||
// Verifies that the matrix contains no Infs or NaNs
|
||||
bool IsFinite() const {
|
||||
return mozilla::IsFinite(_11) && mozilla::IsFinite(_12) &&
|
||||
mozilla::IsFinite(_13) && mozilla::IsFinite(_14) &&
|
||||
mozilla::IsFinite(_21) && mozilla::IsFinite(_22) &&
|
||||
mozilla::IsFinite(_23) && mozilla::IsFinite(_24) &&
|
||||
mozilla::IsFinite(_31) && mozilla::IsFinite(_32) &&
|
||||
mozilla::IsFinite(_33) && mozilla::IsFinite(_34) &&
|
||||
mozilla::IsFinite(_41) && mozilla::IsFinite(_42) &&
|
||||
mozilla::IsFinite(_43) && mozilla::IsFinite(_44);
|
||||
return std::isfinite(_11) && std::isfinite(_12) && std::isfinite(_13) &&
|
||||
std::isfinite(_14) && std::isfinite(_21) && std::isfinite(_22) &&
|
||||
std::isfinite(_23) && std::isfinite(_24) && std::isfinite(_31) &&
|
||||
std::isfinite(_32) && std::isfinite(_33) && std::isfinite(_34) &&
|
||||
std::isfinite(_41) && std::isfinite(_42) && std::isfinite(_43) &&
|
||||
std::isfinite(_44);
|
||||
}
|
||||
|
||||
void SkewXY(double aXSkew, double aYSkew) {
|
||||
|
|
|
@ -339,7 +339,7 @@ Maybe<NumberPartType> GetPartTypeForNumberField(UNumberFormatFields fieldName,
|
|||
if (std::isnan(*number)) {
|
||||
return Some(NumberPartType::Nan);
|
||||
}
|
||||
if (!IsFinite(*number)) {
|
||||
if (!std::isfinite(*number)) {
|
||||
return Some(NumberPartType::Infinity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ inline double ToInteger(double d) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!mozilla::IsFinite(d)) {
|
||||
if (!std::isfinite(d)) {
|
||||
if (std::isnan(d)) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class ClippedTime {
|
|||
inline ClippedTime TimeClip(double time) {
|
||||
// Steps 1-2.
|
||||
const double MaxTimeMagnitude = 8.64e15;
|
||||
if (!mozilla::IsFinite(time) || mozilla::Abs(time) > MaxTimeMagnitude) {
|
||||
if (!std::isfinite(time) || mozilla::Abs(time) > MaxTimeMagnitude) {
|
||||
return ClippedTime(mozilla::UnspecifiedNaN<double>());
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
using namespace js;
|
||||
|
||||
using mozilla::CheckedInt;
|
||||
using mozilla::IsFinite;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::RangedPtr;
|
||||
|
||||
|
@ -737,7 +736,7 @@ static bool Str(JSContext* cx, const Value& v, StringifyContext* scx) {
|
|||
/* Step 9. */
|
||||
if (v.isNumber()) {
|
||||
if (v.isDouble()) {
|
||||
if (!IsFinite(v.toDouble())) {
|
||||
if (!std::isfinite(v.toDouble())) {
|
||||
MOZ_ASSERT(!scx->maybeSafely,
|
||||
"input JS::ToJSONMaybeSafely must not include "
|
||||
"reachable non-finite numbers");
|
||||
|
|
|
@ -8184,7 +8184,7 @@ static bool FdLibM_Pow(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
// Because C99 and ECMA specify different behavior for pow(), we need to wrap
|
||||
// the fdlibm call to make it ECMA compliant.
|
||||
if (!mozilla::IsFinite(y) && (x == 1.0 || x == -1.0)) {
|
||||
if (!std::isfinite(y) && (x == 1.0 || x == -1.0)) {
|
||||
args.rval().setNaN();
|
||||
} else {
|
||||
args.rval().setDouble(fdlibm::pow(x, y));
|
||||
|
|
|
@ -300,7 +300,7 @@ bool js::intl_FormatRelativeTime(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
// PartitionRelativeTimePattern, step 4.
|
||||
double t = args[1].toNumber();
|
||||
if (!mozilla::IsFinite(t)) {
|
||||
if (!std::isfinite(t)) {
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_DATE_NOT_FINITE, "RelativeTimeFormat",
|
||||
formatToParts ? "formatToParts" : "format");
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
using namespace js;
|
||||
using namespace js::frontend;
|
||||
|
||||
using mozilla::IsFinite;
|
||||
|
||||
#ifdef DEBUG
|
||||
void ListNode::checkConsistency() const {
|
||||
ParseNode* const* tailNode;
|
||||
|
@ -195,7 +193,7 @@ void NumericLiteral::dumpImpl(const ParserAtomsTable* parserAtoms,
|
|||
ToCStringBuf cbuf;
|
||||
const char* cstr = NumberToCString(&cbuf, value());
|
||||
MOZ_ASSERT(cstr);
|
||||
if (!IsFinite(value())) {
|
||||
if (!std::isfinite(value())) {
|
||||
out.put("#");
|
||||
}
|
||||
out.printf("%s", cstr);
|
||||
|
|
|
@ -65,7 +65,6 @@ using mozilla::BitwiseCast;
|
|||
using mozilla::IsAsciiAlpha;
|
||||
using mozilla::IsAsciiDigit;
|
||||
using mozilla::IsAsciiLowercaseAlpha;
|
||||
using mozilla::IsFinite;
|
||||
using mozilla::NumbersAreIdentical;
|
||||
using mozilla::Relaxed;
|
||||
|
||||
|
@ -175,7 +174,7 @@ static DateTimeInfo::ShouldRFP ShouldRFP(const Realm* realm) {
|
|||
// 5.2.5 Mathematical Operations
|
||||
static inline double PositiveModulo(double dividend, double divisor) {
|
||||
MOZ_ASSERT(divisor > 0);
|
||||
MOZ_ASSERT(IsFinite(divisor));
|
||||
MOZ_ASSERT(std::isfinite(divisor));
|
||||
|
||||
double result = fmod(dividend, divisor);
|
||||
if (result < 0) {
|
||||
|
@ -195,7 +194,7 @@ static inline bool IsLeapYear(double year) {
|
|||
}
|
||||
|
||||
static inline double DaysInYear(double year) {
|
||||
if (!IsFinite(year)) {
|
||||
if (!std::isfinite(year)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
return IsLeapYear(year) ? 366 : 365;
|
||||
|
@ -211,7 +210,7 @@ static inline double TimeFromYear(double y) {
|
|||
}
|
||||
|
||||
static double YearFromTime(double t) {
|
||||
if (!IsFinite(t)) {
|
||||
if (!std::isfinite(t)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -241,12 +240,12 @@ static inline int DaysInFebruary(double year) {
|
|||
|
||||
/* ES5 15.9.1.4. */
|
||||
static inline double DayWithinYear(double t, double year) {
|
||||
MOZ_ASSERT_IF(IsFinite(t), YearFromTime(t) == year);
|
||||
MOZ_ASSERT_IF(std::isfinite(t), YearFromTime(t) == year);
|
||||
return Day(t) - DayFromYear(year);
|
||||
}
|
||||
|
||||
static double MonthFromTime(double t) {
|
||||
if (!IsFinite(t)) {
|
||||
if (!std::isfinite(t)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -292,7 +291,7 @@ static double MonthFromTime(double t) {
|
|||
|
||||
/* ES5 15.9.1.5. */
|
||||
static double DateFromTime(double t) {
|
||||
if (!IsFinite(t)) {
|
||||
if (!std::isfinite(t)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -380,7 +379,7 @@ static inline int DayFromMonth(T month, bool isLeapYear) = delete;
|
|||
/* ES5 15.9.1.12 (out of order to accommodate DaylightSavingTA). */
|
||||
static double MakeDay(double year, double month, double date) {
|
||||
/* Step 1. */
|
||||
if (!IsFinite(year) || !IsFinite(month) || !IsFinite(date)) {
|
||||
if (!std::isfinite(year) || !std::isfinite(month) || !std::isfinite(date)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -407,7 +406,7 @@ static double MakeDay(double year, double month, double date) {
|
|||
/* ES5 15.9.1.13 (out of order to accommodate DaylightSavingTA). */
|
||||
static inline double MakeDate(double day, double time) {
|
||||
/* Step 1. */
|
||||
if (!IsFinite(day) || !IsFinite(time)) {
|
||||
if (!std::isfinite(day) || !std::isfinite(time)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -463,7 +462,7 @@ JS_PUBLIC_API void JS::SetTimeResolutionUsec(uint32_t resolution, bool jitter) {
|
|||
// 20.3.1.7 LocalTZA ( t, isUTC )
|
||||
double DateTimeHelper::localTZA(DateTimeInfo::ShouldRFP shouldRFP, double t,
|
||||
DateTimeInfo::TimeZoneOffset offset) {
|
||||
MOZ_ASSERT(IsFinite(t));
|
||||
MOZ_ASSERT(std::isfinite(t));
|
||||
|
||||
int64_t milliseconds = static_cast<int64_t>(t);
|
||||
int32_t offsetMilliseconds =
|
||||
|
@ -474,7 +473,7 @@ double DateTimeHelper::localTZA(DateTimeInfo::ShouldRFP shouldRFP, double t,
|
|||
// ES2019 draft rev 0ceb728a1adbffe42b26972a6541fd7f398b1557
|
||||
// 20.3.1.8 LocalTime ( t )
|
||||
double DateTimeHelper::localTime(DateTimeInfo::ShouldRFP shouldRFP, double t) {
|
||||
if (!IsFinite(t)) {
|
||||
if (!std::isfinite(t)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -485,7 +484,7 @@ double DateTimeHelper::localTime(DateTimeInfo::ShouldRFP shouldRFP, double t) {
|
|||
// ES2019 draft rev 0ceb728a1adbffe42b26972a6541fd7f398b1557
|
||||
// 20.3.1.9 UTC ( t )
|
||||
double DateTimeHelper::UTC(DateTimeInfo::ShouldRFP shouldRFP, double t) {
|
||||
if (!IsFinite(t)) {
|
||||
if (!std::isfinite(t)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -614,7 +613,8 @@ static double msFromTime(double t) { return PositiveModulo(t, msPerSecond); }
|
|||
/* ES5 15.9.1.11. */
|
||||
static double MakeTime(double hour, double min, double sec, double ms) {
|
||||
/* Step 1. */
|
||||
if (!IsFinite(hour) || !IsFinite(min) || !IsFinite(sec) || !IsFinite(ms)) {
|
||||
if (!std::isfinite(hour) || !std::isfinite(min) || !std::isfinite(sec) ||
|
||||
!std::isfinite(ms)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -1637,7 +1637,7 @@ void DateObject::fillLocalTimeSlots() {
|
|||
|
||||
double utcTime = UTCTime().toNumber();
|
||||
|
||||
if (!IsFinite(utcTime)) {
|
||||
if (!std::isfinite(utcTime)) {
|
||||
for (size_t ind = COMPONENTS_START_SLOT; ind < RESERVED_SLOTS; ind++) {
|
||||
setReservedSlot(ind, DoubleValue(utcTime));
|
||||
}
|
||||
|
@ -1810,7 +1810,7 @@ static bool date_getUTCFullYear(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double result = unwrapped->UTCTime().toNumber();
|
||||
if (IsFinite(result)) {
|
||||
if (std::isfinite(result)) {
|
||||
result = YearFromTime(result);
|
||||
}
|
||||
|
||||
|
@ -1867,7 +1867,7 @@ static bool date_getUTCDate(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double result = unwrapped->UTCTime().toNumber();
|
||||
if (IsFinite(result)) {
|
||||
if (std::isfinite(result)) {
|
||||
result = DateFromTime(result);
|
||||
}
|
||||
|
||||
|
@ -1897,7 +1897,7 @@ static bool date_getUTCDay(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double result = unwrapped->UTCTime().toNumber();
|
||||
if (IsFinite(result)) {
|
||||
if (std::isfinite(result)) {
|
||||
result = WeekDay(result);
|
||||
}
|
||||
|
||||
|
@ -1937,7 +1937,7 @@ static bool date_getUTCHours(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double result = unwrapped->UTCTime().toNumber();
|
||||
if (IsFinite(result)) {
|
||||
if (std::isfinite(result)) {
|
||||
result = HourFromTime(result);
|
||||
}
|
||||
|
||||
|
@ -1978,7 +1978,7 @@ static bool date_getUTCMinutes(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double result = unwrapped->UTCTime().toNumber();
|
||||
if (IsFinite(result)) {
|
||||
if (std::isfinite(result)) {
|
||||
result = MinFromTime(result);
|
||||
}
|
||||
|
||||
|
@ -2018,7 +2018,7 @@ static bool date_getUTCSeconds(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double result = unwrapped->UTCTime().toNumber();
|
||||
if (IsFinite(result)) {
|
||||
if (std::isfinite(result)) {
|
||||
result = SecFromTime(result);
|
||||
}
|
||||
|
||||
|
@ -2047,7 +2047,7 @@ static bool getMilliseconds(JSContext* cx, unsigned argc, Value* vp,
|
|||
}
|
||||
|
||||
double result = unwrapped->UTCTime().toNumber();
|
||||
if (IsFinite(result)) {
|
||||
if (std::isfinite(result)) {
|
||||
result = msFromTime(result);
|
||||
}
|
||||
|
||||
|
@ -2759,7 +2759,7 @@ static bool date_toUTCString(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double utctime = unwrapped->UTCTime().toNumber();
|
||||
if (!IsFinite(utctime)) {
|
||||
if (!std::isfinite(utctime)) {
|
||||
args.rval().setString(cx->names().InvalidDate);
|
||||
return true;
|
||||
}
|
||||
|
@ -2791,7 +2791,7 @@ static bool date_toISOString(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
double utctime = unwrapped->UTCTime().toNumber();
|
||||
if (!IsFinite(utctime)) {
|
||||
if (!std::isfinite(utctime)) {
|
||||
JS_ReportErrorNumberASCII(cx, js::GetErrorMessage, nullptr,
|
||||
JSMSG_INVALID_DATE);
|
||||
return false;
|
||||
|
@ -2839,7 +2839,7 @@ static bool date_toJSON(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
/* Step 3. */
|
||||
if (tv.isDouble() && !IsFinite(tv.toDouble())) {
|
||||
if (tv.isDouble() && !std::isfinite(tv.toDouble())) {
|
||||
args.rval().setNull();
|
||||
return true;
|
||||
}
|
||||
|
@ -2977,7 +2977,7 @@ enum class FormatSpec { DateTime, Date, Time };
|
|||
static bool FormatDate(JSContext* cx, DateTimeInfo::ShouldRFP shouldRFP,
|
||||
double utcTime, FormatSpec format,
|
||||
MutableHandleValue rval) {
|
||||
if (!IsFinite(utcTime)) {
|
||||
if (!std::isfinite(utcTime)) {
|
||||
rval.setString(cx->names().InvalidDate);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ using JS::GenericNaN;
|
|||
using JS::ToNumber;
|
||||
using mozilla::ExponentComponent;
|
||||
using mozilla::FloatingPoint;
|
||||
using mozilla::IsFinite;
|
||||
using mozilla::IsInfinite;
|
||||
using mozilla::IsNegative;
|
||||
using mozilla::IsNegativeZero;
|
||||
|
@ -442,7 +441,7 @@ double js::ecmaPow(double x, double y) {
|
|||
* Because C99 and ECMA specify different behavior for pow(),
|
||||
* we need to wrap the libm call to make it ECMA compliant.
|
||||
*/
|
||||
if (!IsFinite(y) && (x == 1.0 || x == -1.0)) {
|
||||
if (!std::isfinite(y) && (x == 1.0 || x == -1.0)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -455,7 +454,7 @@ double js::ecmaPow(double x, double y) {
|
|||
* Special case for square roots. Note that pow(x, 0.5) != sqrt(x)
|
||||
* when x = -0.0, so we have to guard for this.
|
||||
*/
|
||||
if (IsFinite(x) && x != 0.0) {
|
||||
if (std::isfinite(x) && x != 0.0) {
|
||||
if (y == 0.5) {
|
||||
return std::sqrt(x);
|
||||
}
|
||||
|
@ -530,7 +529,7 @@ static bool math_random(JSContext* cx, unsigned argc, Value* vp) {
|
|||
template <typename T>
|
||||
T js::GetBiggestNumberLessThan(T x) {
|
||||
MOZ_ASSERT(!IsNegative(x));
|
||||
MOZ_ASSERT(IsFinite(x));
|
||||
MOZ_ASSERT(std::isfinite(x));
|
||||
using Bits = typename mozilla::FloatingPoint<T>::Bits;
|
||||
Bits bits = mozilla::BitwiseCast<Bits>(x);
|
||||
MOZ_ASSERT(bits > 0, "will underflow");
|
||||
|
|
|
@ -1417,7 +1417,7 @@ static const JSFunctionSpec number_methods[] = {
|
|||
JS_FS_END};
|
||||
|
||||
bool js::IsInteger(double d) {
|
||||
return mozilla::IsFinite(d) && JS::ToInteger(d) == d;
|
||||
return std::isfinite(d) && JS::ToInteger(d) == d;
|
||||
}
|
||||
|
||||
static const JSFunctionSpec number_static_methods[] = {
|
||||
|
|
|
@ -116,7 +116,6 @@ using JS::AutoStableStringChars;
|
|||
using mozilla::Abs;
|
||||
using mozilla::AssertedCast;
|
||||
using mozilla::BitwiseCast;
|
||||
using mozilla::IsFinite;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::NegativeInfinity;
|
||||
using mozilla::Nothing;
|
||||
|
@ -3280,7 +3279,7 @@ int8_t BigInt::compare(BigInt* x, double y) {
|
|||
constexpr int LessThan = -1, Equal = 0, GreaterThan = 1;
|
||||
|
||||
// ±Infinity exceeds a finite bigint value.
|
||||
if (!mozilla::IsFinite(y)) {
|
||||
if (!std::isfinite(y)) {
|
||||
return y > 0 ? LessThan : GreaterThan;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ void JSONPrinter::property(const char* name, size_t value) {
|
|||
|
||||
void JSONPrinter::floatProperty(const char* name, double value,
|
||||
size_t precision) {
|
||||
if (!mozilla::IsFinite(value)) {
|
||||
if (!std::isfinite(value)) {
|
||||
propertyName(name);
|
||||
out_.put("null");
|
||||
return;
|
||||
|
|
|
@ -750,7 +750,7 @@ static bool EnforceRange(JSContext* cx, HandleValue v, const char* kind,
|
|||
}
|
||||
|
||||
// Step 6.1.
|
||||
if (!mozilla::IsFinite(x)) {
|
||||
if (!std::isfinite(x)) {
|
||||
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_WASM_BAD_ENFORCE_RANGE, kind, noun);
|
||||
return false;
|
||||
|
|
|
@ -3062,7 +3062,7 @@ void FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize,
|
|||
weightSum += curWeight;
|
||||
flexFactorSum += curFlexFactor;
|
||||
|
||||
if (IsFinite(weightSum)) {
|
||||
if (std::isfinite(weightSum)) {
|
||||
if (curWeight == 0.0) {
|
||||
item.SetShareOfWeightSoFar(0.0);
|
||||
} else {
|
||||
|
@ -3136,7 +3136,7 @@ void FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize,
|
|||
// To avoid rounding issues, we compute the change in size for this
|
||||
// item, and then subtract it from the remaining available space.
|
||||
AuCoord64 sizeDelta = 0;
|
||||
if (IsFinite(weightSum)) {
|
||||
if (std::isfinite(weightSum)) {
|
||||
double myShareOfRemainingSpace = item.ShareOfWeightSoFar();
|
||||
|
||||
MOZ_ASSERT(myShareOfRemainingSpace >= 0.0 &&
|
||||
|
|
|
@ -4541,7 +4541,7 @@ gfxFloat SVGTextFrame::GetStartOffset(nsIFrame* aTextPathFrame) {
|
|||
&tp->mLengthAttributes[SVGTextPathElement::STARTOFFSET];
|
||||
|
||||
if (length->IsPercentage()) {
|
||||
if (!IsFinite(GetOffsetScale(aTextPathFrame))) {
|
||||
if (!std::isfinite(GetOffsetScale(aTextPathFrame))) {
|
||||
// Either pathLength="0" for this path or the path has 0 length.
|
||||
return 0.0;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace mozilla {
|
|||
|
||||
bool IsFloat32Representable(double aValue) {
|
||||
// NaNs and infinities are representable.
|
||||
if (!IsFinite(aValue)) {
|
||||
if (!std::isfinite(aValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ static MOZ_ALWAYS_INLINE bool IsPositiveZero(T aValue) {
|
|||
*/
|
||||
template <typename T>
|
||||
static MOZ_ALWAYS_INLINE T ToZeroIfNonfinite(T aValue) {
|
||||
return IsFinite(aValue) ? aValue : 0;
|
||||
return std::isfinite(aValue) ? aValue : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -370,7 +370,7 @@ inline bool NumberEqualsSignedInteger(Float aValue, SignedInteger* aInteger) {
|
|||
MOZ_MAKE_MEM_UNDEFINED(aInteger, sizeof(*aInteger));
|
||||
|
||||
// NaNs and infinities are not integers.
|
||||
if (!IsFinite(aValue)) {
|
||||
if (!std::isfinite(aValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ double mozToDouble(mozilla::Span<const char> aStr, bool *valid) {
|
|||
int length = mozilla::AssertedCast<int>(aStr.Length());
|
||||
int processed_char_count; // unused - NO_FLAGS requires the whole string to parse
|
||||
double result = converter.StringToDouble(str, length, &processed_char_count);
|
||||
*valid = mozilla::IsFinite(result);
|
||||
*valid = std::isfinite(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -108,4 +108,3 @@ private:
|
|||
} // namespace moz_decimal_utils
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ static FloatT ParseFloatingPoint(const nsTStringRepr<CharT>& aString,
|
|||
int processed;
|
||||
StringToFP(converter, aString.Data(), aString.Length(), &processed, &result);
|
||||
|
||||
*aErrorCode = mozilla::IsFinite(result) ? NS_OK : NS_ERROR_ILLEGAL_VALUE;
|
||||
*aErrorCode = std::isfinite(result) ? NS_OK : NS_ERROR_ILLEGAL_VALUE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче