From 5ec763f216ad4fb3ad8e8a38929070bbf9af9a5c Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 5 Mar 2013 15:43:30 -0800 Subject: [PATCH] Bug 847480 - Blindly convert all existing mozilla::Abs users to mozilla::DeprecatedAbs. Individualized conversions to the reformed mozilla::Abs will continue until mozilla::DeprecatedAbs is unused, at which point it will be removed. r=Ms2ger --- content/canvas/src/CanvasRenderingContext2D.cpp | 4 ++-- content/events/src/nsEventStateManager.cpp | 16 ++++++++-------- content/html/content/src/nsHTMLMediaElement.cpp | 4 ++-- content/media/MediaDecoder.cpp | 8 ++++---- docshell/shistory/src/nsSHistory.cpp | 4 ++-- editor/libeditor/html/nsHTMLEditRules.cpp | 4 ++-- editor/libeditor/html/nsHTMLObjectResizer.cpp | 4 ++-- gfx/layers/basic/BasicTiledThebesLayer.cpp | 2 +- gfx/thebes/gfxFont.cpp | 6 +++--- js/src/ion/RangeAnalysis.cpp | 8 ++++---- js/src/ion/RangeAnalysis.h | 4 ++-- js/src/ion/arm/Assembler-arm.h | 6 +++--- js/src/ion/arm/MacroAssembler-arm.cpp | 6 +++--- js/src/jsmath.cpp | 4 ++-- js/src/methodjit/FastArithmetic.cpp | 4 ++-- js/src/methodjit/LoopState.cpp | 8 ++++---- js/src/prmjtime.cpp | 2 +- js/src/vm/DateTime.h | 2 +- layout/base/nsCSSColorUtils.h | 2 +- layout/base/nsCSSRendering.cpp | 8 ++++---- layout/generic/nsTextFrameThebes.cpp | 2 +- layout/mathml/nsMathMLChar.cpp | 6 +++--- layout/style/nsStyleAnimation.cpp | 12 ++++++------ layout/tables/nsTableFrame.cpp | 2 +- layout/xul/tree/nsTreeBodyFrame.cpp | 2 +- widget/gtk2/nsNativeKeyBindings.cpp | 4 ++-- widget/nsGUIEvent.h | 2 +- widget/windows/nsWindow.cpp | 10 +++++----- xpcom/ds/TimeStamp_windows.cpp | 2 +- xpcom/io/nsMultiplexInputStream.cpp | 8 ++++---- xpfe/appshell/src/nsXULWindow.cpp | 2 +- 31 files changed, 79 insertions(+), 79 deletions(-) diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index 044c60d6b89c03..35a9a8b479a14b 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -3716,8 +3716,8 @@ CanvasRenderingContext2D::CreateImageData(JSContext* cx, double sw, int32_t wi = JS_DoubleToInt32(sw); int32_t hi = JS_DoubleToInt32(sh); - uint32_t w = Abs(wi); - uint32_t h = Abs(hi); + uint32_t w = DeprecatedAbs(wi); + uint32_t h = DeprecatedAbs(hi); return mozilla::dom::CreateImageData(cx, this, w, h, error); } diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 031aa9a2e25f31..1ef3f0d9493904 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2052,8 +2052,8 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext, // fire drag gesture if mouse has moved enough nsIntPoint pt = aEvent->refPoint + aEvent->widget->WidgetToScreenOffset(); - if (Abs(pt.x - mGestureDownPoint.x) > pixelThresholdX || - Abs(pt.y - mGestureDownPoint.y) > pixelThresholdY) { + if (DeprecatedAbs(pt.x - mGestureDownPoint.x) > pixelThresholdX || + DeprecatedAbs(pt.y - mGestureDownPoint.y) > pixelThresholdY) { if (mClickHoldContextMenu) { // stop the click-hold before we fire off the drag gesture, in case // it takes a long time @@ -2880,14 +2880,14 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame, nsIntSize devPixelPageSize(pc->AppUnitsToDevPixels(pageSize.width), pc->AppUnitsToDevPixels(pageSize.height)); if (!WheelPrefs::GetInstance()->IsOverOnePageScrollAllowedX(aEvent) && - Abs(actualDevPixelScrollAmount.x) > devPixelPageSize.width) { + DeprecatedAbs(actualDevPixelScrollAmount.x) > devPixelPageSize.width) { actualDevPixelScrollAmount.x = (actualDevPixelScrollAmount.x >= 0) ? devPixelPageSize.width : -devPixelPageSize.width; } if (!WheelPrefs::GetInstance()->IsOverOnePageScrollAllowedY(aEvent) && - Abs(actualDevPixelScrollAmount.y) > devPixelPageSize.height) { + DeprecatedAbs(actualDevPixelScrollAmount.y) > devPixelPageSize.height) { actualDevPixelScrollAmount.y = (actualDevPixelScrollAmount.y >= 0) ? devPixelPageSize.height : -devPixelPageSize.height; @@ -5590,8 +5590,8 @@ nsEventStateManager::WheelPrefs::ComputeActionFor(widget::WheelEvent* aEvent) Init(index); bool deltaXPreferred = - (Abs(aEvent->deltaX) > Abs(aEvent->deltaY) && - Abs(aEvent->deltaX) > Abs(aEvent->deltaZ)); + (DeprecatedAbs(aEvent->deltaX) > DeprecatedAbs(aEvent->deltaY) && + DeprecatedAbs(aEvent->deltaX) > DeprecatedAbs(aEvent->deltaZ)); Action* actions = deltaXPreferred ? mOverriddenActionsX : mActions; if (actions[index] == ACTION_NONE || actions[index] == ACTION_SCROLL) { return actions[index]; @@ -5625,7 +5625,7 @@ nsEventStateManager::WheelPrefs::IsOverOnePageScrollAllowedX( { Index index = GetIndexFor(aEvent); Init(index); - return Abs(mMultiplierX[index]) >= + return DeprecatedAbs(mMultiplierX[index]) >= MIN_MULTIPLIER_VALUE_ALLOWING_OVER_ONE_PAGE_SCROLL; } @@ -5635,6 +5635,6 @@ nsEventStateManager::WheelPrefs::IsOverOnePageScrollAllowedY( { Index index = GetIndexFor(aEvent); Init(index); - return Abs(mMultiplierY[index]) >= + return DeprecatedAbs(mMultiplierY[index]) >= MIN_MULTIPLIER_VALUE_ALLOWING_OVER_ONE_PAGE_SCROLL; } diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index 604e6e27a9b2aa..98066c906a64ed 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -3382,10 +3382,10 @@ static double ClampPlaybackRate(double aPlaybackRate) if (aPlaybackRate == 0.0) { return aPlaybackRate; } - if (Abs(aPlaybackRate) < MIN_PLAYBACKRATE) { + if (DeprecatedAbs(aPlaybackRate) < MIN_PLAYBACKRATE) { return aPlaybackRate < 0 ? -MIN_PLAYBACKRATE : MIN_PLAYBACKRATE; } - if (Abs(aPlaybackRate) > MAX_PLAYBACKRATE) { + if (DeprecatedAbs(aPlaybackRate) > MAX_PLAYBACKRATE) { return aPlaybackRate < 0 ? -MAX_PLAYBACKRATE : MAX_PLAYBACKRATE; } return aPlaybackRate; diff --git a/content/media/MediaDecoder.cpp b/content/media/MediaDecoder.cpp index 72917f27d14ea0..75a3b3695e54f5 100644 --- a/content/media/MediaDecoder.cpp +++ b/content/media/MediaDecoder.cpp @@ -594,11 +594,11 @@ nsresult MediaDecoder::Seek(double aTime) NS_ENSURE_SUCCESS(res, NS_OK); res = seekable.Start(range + 1, &rightBound); NS_ENSURE_SUCCESS(res, NS_OK); - double distanceLeft = Abs(leftBound - aTime); - double distanceRight = Abs(rightBound - aTime); + double distanceLeft = DeprecatedAbs(leftBound - aTime); + double distanceRight = DeprecatedAbs(rightBound - aTime); if (distanceLeft == distanceRight) { - distanceLeft = Abs(leftBound - mCurrentTime); - distanceRight = Abs(rightBound - mCurrentTime); + distanceLeft = DeprecatedAbs(leftBound - mCurrentTime); + distanceRight = DeprecatedAbs(rightBound - mCurrentTime); } aTime = (distanceLeft < distanceRight) ? leftBound : rightBound; } else { diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index 7bcde353b3342e..6b499fee8d6372 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -1101,7 +1101,7 @@ nsSHistory::GloballyEvictContentViewers() for (uint32_t j = 0; j < shTransactions.Length(); j++) { TransactionAndDistance &container = shTransactions[j]; if (container.mViewer == contentViewer) { - container.mDistance = std::min(container.mDistance, Abs(i - shist->mIndex)); + container.mDistance = std::min(container.mDistance, DeprecatedAbs(i - shist->mIndex)); found = true; break; } @@ -1110,7 +1110,7 @@ nsSHistory::GloballyEvictContentViewers() // If we didn't find a TransactionAndDistance for this content viewer, make a new // one. if (!found) { - TransactionAndDistance container(trans, Abs(i - shist->mIndex)); + TransactionAndDistance container(trans, DeprecatedAbs(i - shist->mIndex)); shTransactions.AppendElement(container); } } diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 295d1061a4fdcd..df49ed770bec36 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -1936,7 +1936,7 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection, res = nsWSRunObject::PrepareToDeleteRange(mHTMLEditor, address_of(visNode), &so, address_of(visNode), &eo); NS_ENSURE_SUCCESS(res, res); nsCOMPtr nodeAsText(do_QueryInterface(visNode)); - res = mHTMLEditor->DeleteText(nodeAsText, std::min(so, eo), Abs(eo - so)); + res = mHTMLEditor->DeleteText(nodeAsText, std::min(so, eo), DeprecatedAbs(eo - so)); *aHandled = true; NS_ENSURE_SUCCESS(res, res); res = InsertBRIfNeeded(aSelection); @@ -4396,7 +4396,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsISelection *aSelection, if (relFontSize) { // dir indicated bigger versus smaller. 1 = bigger, -1 = smaller int32_t dir = relFontSize > 0 ? 1 : -1; - for (int32_t j = 0; j < Abs(relFontSize); j++) { + for (int32_t j = 0; j < DeprecatedAbs(relFontSize); j++) { res = mHTMLEditor->RelativeFontChangeOnTextNode(dir, nodeAsText, 0, -1); NS_ENSURE_SUCCESS(res, res); diff --git a/editor/libeditor/html/nsHTMLObjectResizer.cpp b/editor/libeditor/html/nsHTMLObjectResizer.cpp index bae5da7a2b60ba..a0e8cee98388f7 100644 --- a/editor/libeditor/html/nsHTMLObjectResizer.cpp +++ b/editor/libeditor/html/nsHTMLObjectResizer.cpp @@ -875,8 +875,8 @@ nsHTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent) int32_t yThreshold = LookAndFeel::GetInt(LookAndFeel::eIntID_DragThresholdY, 1); - if (Abs(clientX - mOriginalX) * 2 >= xThreshold || - Abs(clientY - mOriginalY) * 2 >= yThreshold) { + if (DeprecatedAbs(clientX - mOriginalX) * 2 >= xThreshold || + DeprecatedAbs(clientY - mOriginalY) * 2 >= yThreshold) { mGrabberClicked = false; StartMoving(nullptr); } diff --git a/gfx/layers/basic/BasicTiledThebesLayer.cpp b/gfx/layers/basic/BasicTiledThebesLayer.cpp index 653c370da46bbd..4ac62c1104b5c5 100644 --- a/gfx/layers/basic/BasicTiledThebesLayer.cpp +++ b/gfx/layers/basic/BasicTiledThebesLayer.cpp @@ -376,7 +376,7 @@ BasicTiledThebesLayer::ComputeProgressiveUpdateRegion(BasicTiledLayerBuffer& aTi if (!aRegionToPaint.IsEmpty()) { break; } - if (Abs(scrollDiffY) >= Abs(scrollDiffX)) { + if (DeprecatedAbs(scrollDiffY) >= DeprecatedAbs(scrollDiffX)) { tileBounds.x += incX; } else { tileBounds.y += incY; diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 1c156dfbf6107b..a64b109159dada 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -790,7 +790,7 @@ CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle) } // measure of closeness of weight to the desired value - rank += 9 - Abs(aFontEntry->Weight() / 100 - aStyle->ComputeWeight()); + rank += 9 - DeprecatedAbs(aFontEntry->Weight() / 100 - aStyle->ComputeWeight()); } else { // if no font to match, prefer non-bold, non-italic fonts if (!aFontEntry->IsItalic()) { @@ -2966,8 +2966,8 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics) uint16_t(os2->version) >= 2) { // version 2 and later includes the x-height field SET_SIGNED(xHeight, os2->sxHeight); - // Abs because of negative xHeight seen in Kokonor (Tibetan) font - aMetrics.xHeight = Abs(aMetrics.xHeight); + // DeprecatedAbs because of negative xHeight seen in Kokonor (Tibetan) font + aMetrics.xHeight = DeprecatedAbs(aMetrics.xHeight); } // this should always be present if (os2data.Length() >= offsetof(OS2Table, yStrikeoutPosition) + diff --git a/js/src/ion/RangeAnalysis.cpp b/js/src/ion/RangeAnalysis.cpp index 1817ac2de8bba9..05a6a529f7e5c6 100644 --- a/js/src/ion/RangeAnalysis.cpp +++ b/js/src/ion/RangeAnalysis.cpp @@ -22,7 +22,7 @@ using namespace js; using namespace js::ion; -using mozilla::Abs; +using mozilla::DeprecatedAbs; // This algorithm is based on the paper "Eliminating Range Checks Using // Static Single Assignment Form" by Gough and Klaren. @@ -672,7 +672,7 @@ MAbs::computeRange() Range other(getOperand(0)); Range *range = new Range(0, - Max(Abs(other.lower()), Abs(other.upper())), + Max(DeprecatedAbs(other.lower()), DeprecatedAbs(other.upper())), other.isDecimal(), other.exponent()); setRange(range); @@ -719,8 +719,8 @@ MMod::computeRange() return; Range lhs(getOperand(0)); Range rhs(getOperand(1)); - int64_t a = Abs(rhs.lower()); - int64_t b = Abs(rhs.upper()); + int64_t a = DeprecatedAbs(rhs.lower()); + int64_t b = DeprecatedAbs(rhs.upper()); if (a == 0 && b == 0) return; int64_t bound = Max(1-a, b-1); diff --git a/js/src/ion/RangeAnalysis.h b/js/src/ion/RangeAnalysis.h index 26c22ab84dbede..e5abd1f875cc60 100644 --- a/js/src/ion/RangeAnalysis.h +++ b/js/src/ion/RangeAnalysis.h @@ -344,8 +344,8 @@ class Range : public TempObject { return; } - uint32_t max = Max(mozilla::Abs(lower()), - mozilla::Abs(upper())); + uint32_t max = Max(mozilla::DeprecatedAbs(lower()), + mozilla::DeprecatedAbs(upper())); JS_ASSERT_IF(lower() == JSVAL_INT_MIN, max == (uint32_t) JSVAL_INT_MIN); JS_ASSERT(max <= (uint32_t) JSVAL_INT_MIN); // The number of bits needed to encode |max| is the power of 2 plus one. diff --git a/js/src/ion/arm/Assembler-arm.h b/js/src/ion/arm/Assembler-arm.h index 3db5f84dffb055..7fb45064e1329d 100644 --- a/js/src/ion/arm/Assembler-arm.h +++ b/js/src/ion/arm/Assembler-arm.h @@ -705,7 +705,7 @@ class DtrOffImm : public DtrOff { public: DtrOffImm(int32_t imm) - : DtrOff(datastore::Imm12Data(mozilla::Abs(imm)), imm >= 0 ? IsUp : IsDown) + : DtrOff(datastore::Imm12Data(mozilla::DeprecatedAbs(imm)), imm >= 0 ? IsUp : IsDown) { JS_ASSERT((imm < 4096) && (imm > -4096)); } @@ -790,7 +790,7 @@ class EDtrOffImm : public EDtrOff { public: EDtrOffImm(int32_t imm) - : EDtrOff(datastore::Imm8Data(mozilla::Abs(imm)), (imm >= 0) ? IsUp : IsDown) + : EDtrOff(datastore::Imm8Data(mozilla::DeprecatedAbs(imm)), (imm >= 0) ? IsUp : IsDown) { } }; @@ -838,7 +838,7 @@ class VFPOffImm : public VFPOff { public: VFPOffImm(int32_t imm) - : VFPOff(datastore::Imm8VFPOffData(mozilla::Abs(imm) >> 2), imm < 0 ? IsDown : IsUp) + : VFPOff(datastore::Imm8VFPOffData(mozilla::DeprecatedAbs(imm) >> 2), imm < 0 ? IsDown : IsUp) { } }; class VFPAddr diff --git a/js/src/ion/arm/MacroAssembler-arm.cpp b/js/src/ion/arm/MacroAssembler-arm.cpp index 9bb61087c1e9d8..954a5cf01f6263 100644 --- a/js/src/ion/arm/MacroAssembler-arm.cpp +++ b/js/src/ion/arm/MacroAssembler-arm.cpp @@ -14,7 +14,7 @@ using namespace js; using namespace ion; -using mozilla::Abs; +using mozilla::DeprecatedAbs; bool isValueDTRDCandidate(ValueOperand &val) @@ -2526,7 +2526,7 @@ MacroAssemblerARMCompat::storeValue(ValueOperand val, Operand dst) { void MacroAssemblerARMCompat::storeValue(ValueOperand val, const BaseIndex &dest) { - if (isValueDTRDCandidate(val) && Abs(dest.offset) <= 255) { + if (isValueDTRDCandidate(val) && DeprecatedAbs(dest.offset) <= 255) { Register tmpIdx; if (dest.offset == 0) { if (dest.scale == TimesOne) { @@ -2550,7 +2550,7 @@ MacroAssemblerARMCompat::storeValue(ValueOperand val, const BaseIndex &dest) void MacroAssemblerARMCompat::loadValue(const BaseIndex &addr, ValueOperand val) { - if (isValueDTRDCandidate(val) && Abs(addr.offset) <= 255) { + if (isValueDTRDCandidate(val) && DeprecatedAbs(addr.offset) <= 255) { Register tmpIdx; if (addr.offset == 0) { if (addr.scale == TimesOne) { diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index f1b568c09f183a..57a205894b58dd 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -31,7 +31,7 @@ using namespace js; -using mozilla::Abs; +using mozilla::DeprecatedAbs; #ifndef M_E #define M_E 2.7182818284590452354 @@ -105,7 +105,7 @@ js_math_abs(JSContext *cx, unsigned argc, Value *vp) } if (!ToNumber(cx, vp[2], &x)) return JS_FALSE; - z = Abs(x); + z = DeprecatedAbs(x); vp->setNumber(z); return JS_TRUE; } diff --git a/js/src/methodjit/FastArithmetic.cpp b/js/src/methodjit/FastArithmetic.cpp index f2f6d19a1ea2d0..42f1ab425ead94 100644 --- a/js/src/methodjit/FastArithmetic.cpp +++ b/js/src/methodjit/FastArithmetic.cpp @@ -21,7 +21,7 @@ using namespace js::mjit; using namespace js::analyze; using namespace JSC; -using mozilla::Abs; +using mozilla::DeprecatedAbs; typedef JSC::MacroAssembler::FPRegisterID FPRegisterID; @@ -333,7 +333,7 @@ mjit::Compiler::jsop_binary_double(FrameEntry *lhs, FrameEntry *rhs, JSOp op, (type == JSVAL_TYPE_INT32 || (type == JSVAL_TYPE_UNKNOWN && !(lhs->isConstant() && lhs->isType(JSVAL_TYPE_INT32) && - Abs(lhs->getValue().toInt32()) == 1)))) + DeprecatedAbs(lhs->getValue().toInt32()) == 1)))) { RegisterID reg = frame.allocReg(); FPRegisterID fpReg = frame.allocFPReg(); diff --git a/js/src/methodjit/LoopState.cpp b/js/src/methodjit/LoopState.cpp index 123ea901a6378b..8c8e57282ab629 100644 --- a/js/src/methodjit/LoopState.cpp +++ b/js/src/methodjit/LoopState.cpp @@ -19,7 +19,7 @@ using namespace js::mjit; using namespace js::analyze; using namespace js::types; -using mozilla::Abs; +using mozilla::DeprecatedAbs; LoopState::LoopState(JSContext *cx, analyze::CrossScriptSSA *ssa, mjit::Compiler *cc, FrameState *frame) @@ -2029,7 +2029,7 @@ LoopState::computeInterval(const CrossSSAValue &cv, int32_t *pmin, int32_t *pmax if (!computeInterval(rhsv, &rhsmin, &rhsmax) || rhsmin != rhsmax) return false; - int32_t rhs = Abs(rhsmax); + int32_t rhs = DeprecatedAbs(rhsmax); *pmin = -(rhs - 1); *pmax = rhs - 1; return true; @@ -2063,8 +2063,8 @@ LoopState::computeInterval(const CrossSSAValue &cv, int32_t *pmin, int32_t *pmax if (lhsmin == INT32_MIN || rhsmin == INT32_MIN) return false; - int32_t nlhs = Max(Abs(lhsmin), Abs(lhsmax)); - int32_t nrhs = Max(Abs(rhsmin), Abs(rhsmax)); + int32_t nlhs = Max(DeprecatedAbs(lhsmin), DeprecatedAbs(lhsmax)); + int32_t nrhs = Max(DeprecatedAbs(rhsmin), DeprecatedAbs(rhsmax)); if (!SafeMul(nlhs, nrhs, pmax)) return false; diff --git a/js/src/prmjtime.cpp b/js/src/prmjtime.cpp index a5bb6478220b0a..42ae858e5216c8 100644 --- a/js/src/prmjtime.cpp +++ b/js/src/prmjtime.cpp @@ -358,7 +358,7 @@ PRMJ_Now(void) itself, but I have only seen it triggered by another program doing some kind of file I/O. The symptoms are a negative diff followed by an equally large positive diff. */ - if (mozilla::Abs(diff) > 2 * skewThreshold) { + if (mozilla::DeprecatedAbs(diff) > 2 * skewThreshold) { /*fprintf(stderr,"Clock skew detected (diff = %f)!\n", diff);*/ if (calibrated) { diff --git a/js/src/vm/DateTime.h b/js/src/vm/DateTime.h index 1c19ab62d521f8..3eb7fe2fa85b56 100644 --- a/js/src/vm/DateTime.h +++ b/js/src/vm/DateTime.h @@ -42,7 +42,7 @@ inline double TimeClip(double time) { /* Steps 1-2. */ - if (!MOZ_DOUBLE_IS_FINITE(time) || mozilla::Abs(time) > 8.64e15) + if (!MOZ_DOUBLE_IS_FINITE(time) || mozilla::DeprecatedAbs(time) > 8.64e15) return js_NaN; /* Step 3. */ diff --git a/layout/base/nsCSSColorUtils.h b/layout/base/nsCSSColorUtils.h index 767d0ea10e671f..b9963c3c82ce62 100644 --- a/layout/base/nsCSSColorUtils.h +++ b/layout/base/nsCSSColorUtils.h @@ -17,7 +17,7 @@ // See http://www.w3.org/TR/AERT#color-contrast #define NS_SUFFICIENT_LUMINOSITY_DIFFERENCE 125000 #define NS_LUMINOSITY_DIFFERENCE(a, b) \ - mozilla::Abs(NS_GetLuminosity(a) - NS_GetLuminosity(b)) + mozilla::DeprecatedAbs(NS_GetLuminosity(a) - NS_GetLuminosity(b)) // To determine colors based on the background brightness and border color void NS_GetSpecial3DColors(nscolor aResult[2], diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index feb22054eb7ddb..a252ac4c8f3a90 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -1984,10 +1984,10 @@ ComputeRadialGradientLine(nsPresContext* aPresContext, // Compute gradient shape: the x and y radii of an ellipse. double radiusX, radiusY; - double leftDistance = Abs(aLineStart->x); - double rightDistance = Abs(aBoxSize.width - aLineStart->x); - double topDistance = Abs(aLineStart->y); - double bottomDistance = Abs(aBoxSize.height - aLineStart->y); + double leftDistance = DeprecatedAbs(aLineStart->x); + double rightDistance = DeprecatedAbs(aBoxSize.width - aLineStart->x); + double topDistance = DeprecatedAbs(aLineStart->y); + double bottomDistance = DeprecatedAbs(aBoxSize.height - aLineStart->y); switch (aGradient->mSize) { case NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE: radiusX = std::min(leftDistance, rightDistance); diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 5301830149dfb8..5e8527ec35a06b 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -5646,7 +5646,7 @@ nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx, if (type == aSelectionType) { pt.x = (aFramePt.x + xOffset - (mTextRun->IsRightToLeft() ? advance : 0)) / app; - gfxFloat width = Abs(advance) / app; + gfxFloat width = DeprecatedAbs(advance) / app; gfxFloat xInFrame = pt.x - (aFramePt.x / app); DrawSelectionDecorations(aCtx, dirtyRect, aSelectionType, this, aTextPaintStyle, selectedStyle, pt, xInFrame, diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index 9897fd57bac602..da2b7600833991 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -747,7 +747,7 @@ IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, uint32_t aHint) // or in sloppy markups without protective bool isNormal = (aHint & NS_STRETCH_NORMAL) - && bool(float(Abs(a - b)) + && bool(float(DeprecatedAbs(a - b)) < (1.0f - NS_MATHML_DELIMITER_FACTOR) * float(b)); // Nearer: True if 'a' is around max{ +/-10% of 'b' , 'b' - 5pt }, // as documented in The TeXbook, Ch.17, p.152. @@ -757,7 +757,7 @@ IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, uint32_t aHint) float c = std::max(float(b) * NS_MATHML_DELIMITER_FACTOR, float(b) - nsPresContext:: CSSPointsToAppUnits(NS_MATHML_DELIMITER_SHORTFALL_POINTS)); - isNearer = bool(float(Abs(b - a)) <= (float(b) - c)); + isNearer = bool(float(DeprecatedAbs(b - a)) <= (float(b) - c)); } // Smaller: Mainly for transitory use, to compare two candidate // choices @@ -784,7 +784,7 @@ IsSizeBetter(nscoord a, nscoord olda, nscoord b, uint32_t aHint) return (a <= olda) ? (olda > b) : (a <= b); // XXXkt prob want log scale here i.e. 1.5 is closer to 1 than 0.5 - return Abs(a - b) < Abs(olda - b); + return DeprecatedAbs(a - b) < DeprecatedAbs(olda - b); } // We want to place the glyphs even when they don't fit at their diff --git a/layout/style/nsStyleAnimation.cpp b/layout/style/nsStyleAnimation.cpp index 27c80d5de5e94e..f23fc0eda22e2f 100644 --- a/layout/style/nsStyleAnimation.cpp +++ b/layout/style/nsStyleAnimation.cpp @@ -381,7 +381,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty, // just like eUnit_Integer. int32_t startInt = aStartValue.GetIntValue(); int32_t endInt = aEndValue.GetIntValue(); - aDistance = Abs(endInt - startInt); + aDistance = DeprecatedAbs(endInt - startInt); return true; } default: @@ -404,19 +404,19 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty, case eUnit_Integer: { int32_t startInt = aStartValue.GetIntValue(); int32_t endInt = aEndValue.GetIntValue(); - aDistance = Abs(endInt - startInt); + aDistance = DeprecatedAbs(endInt - startInt); return true; } case eUnit_Coord: { nscoord startCoord = aStartValue.GetCoordValue(); nscoord endCoord = aEndValue.GetCoordValue(); - aDistance = Abs(endCoord - startCoord); + aDistance = DeprecatedAbs(endCoord - startCoord); return true; } case eUnit_Percent: { float startPct = aStartValue.GetPercentValue(); float endPct = aEndValue.GetPercentValue(); - aDistance = Abs(endPct - startPct); + aDistance = DeprecatedAbs(endPct - startPct); return true; } case eUnit_Float: { @@ -434,7 +434,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty, float startFloat = aStartValue.GetFloatValue(); float endFloat = aEndValue.GetFloatValue(); - aDistance = Abs(endFloat - startFloat); + aDistance = DeprecatedAbs(endFloat - startFloat); return true; } case eUnit_Color: { @@ -1297,7 +1297,7 @@ Decompose2DMatrix(const gfxMatrix &aMatrix, gfxPoint3D &aScale, XYshear /= scaleY; // A*D - B*C should now be 1 or -1 - NS_ASSERTION(0.99 < Abs(A*D - B*C) && Abs(A*D - B*C) < 1.01, + NS_ASSERTION(0.99 < DeprecatedAbs(A*D - B*C) && DeprecatedAbs(A*D - B*C) < 1.01, "determinant should now be 1 or -1"); if (A * D < B * C) { A = -A; diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index fa0dc0506608d4..099d68517bb9f9 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -6246,7 +6246,7 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect) if (!haveIntersect) return false; mDamageArea = nsIntRect(startColIndex, startRowIndex, - 1 + Abs(endColIndex - startColIndex), + 1 + DeprecatedAbs(endColIndex - startColIndex), 1 + endRowIndex - startRowIndex); Reset(); diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 8561e0ef313b2f..bc367e04ef363d 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -1833,7 +1833,7 @@ nsTreeBodyFrame::RowCountChanged(int32_t aIndex, int32_t aCount) NS_ASSERTION(rowCount == mRowCount, "row count did not change by the amount suggested, check caller"); #endif - int32_t count = Abs(aCount); + int32_t count = DeprecatedAbs(aCount); int32_t last = GetLastVisibleRow(); if (aIndex >= mTopRowIndex && aIndex <= last) InvalidateRange(aIndex, last); diff --git a/widget/gtk2/nsNativeKeyBindings.cpp b/widget/gtk2/nsNativeKeyBindings.cpp index 98ecb51c8295e5..3461c78060ba28 100644 --- a/widget/gtk2/nsNativeKeyBindings.cpp +++ b/widget/gtk2/nsNativeKeyBindings.cpp @@ -99,7 +99,7 @@ delete_from_cursor_cb(GtkWidget *w, GtkDeleteType del_type, if (!cmd) return; // unsupported command - count = Abs(count); + count = DeprecatedAbs(count); for (int i = 0; i < count; ++i) { gCurrentCallback(cmd, gCurrentCallbackData); } @@ -169,7 +169,7 @@ move_cursor_cb(GtkWidget *w, GtkMovementStep step, gint count, return; // unsupported command - count = Abs(count); + count = DeprecatedAbs(count); for (int i = 0; i < count; ++i) { gCurrentCallback(cmd, gCurrentCallbackData); } diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index 8963f47de727ae..37d22656a20787 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -1344,7 +1344,7 @@ class WheelEvent : public nsMouseEvent_base (lineOrPageDeltaX > 0 && lineOrPageDeltaY < 0)) { return 0; // We cannot guess the answer in this case. } - return (Abs(lineOrPageDeltaX) > Abs(lineOrPageDeltaY)) ? + return (DeprecatedAbs(lineOrPageDeltaX) > DeprecatedAbs(lineOrPageDeltaY)) ? lineOrPageDeltaX : lineOrPageDeltaY; } diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index e12488f3a9daf1..b8440830cc9883 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -3434,7 +3434,7 @@ nsWindow::OverrideSystemMouseScrollSpeed(int32_t aOriginalDelta, // on the document of SystemParametersInfo in MSDN. const uint32_t kSystemDefaultScrollingSpeed = 3; - int32_t absOriginDelta = Abs(aOriginalDelta); + int32_t absOriginDelta = DeprecatedAbs(aOriginalDelta); // Compute the simple overridden speed. int32_t absComputedOverriddenDelta; @@ -3862,8 +3862,8 @@ bool nsWindow::DispatchMouseEvent(uint32_t aEventType, WPARAM wParam, sLastMouseMovePoint.y = mpScreen.y; } - bool insideMovementThreshold = (Abs(sLastMousePoint.x - eventPoint.x) < (short)::GetSystemMetrics(SM_CXDOUBLECLK)) && - (Abs(sLastMousePoint.y - eventPoint.y) < (short)::GetSystemMetrics(SM_CYDOUBLECLK)); + bool insideMovementThreshold = (DeprecatedAbs(sLastMousePoint.x - eventPoint.x) < (short)::GetSystemMetrics(SM_CXDOUBLECLK)) && + (DeprecatedAbs(sLastMousePoint.y - eventPoint.y) < (short)::GetSystemMetrics(SM_CYDOUBLECLK)); BYTE eventButton; switch (aButton) { @@ -6393,10 +6393,10 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam) if (mDisplayPanFeedback) { mGesture.UpdatePanFeedbackX(mWnd, - Abs(RoundDown(wheelEvent.overflowDeltaX)), + DeprecatedAbs(RoundDown(wheelEvent.overflowDeltaX)), endFeedback); mGesture.UpdatePanFeedbackY(mWnd, - Abs(RoundDown(wheelEvent.overflowDeltaY)), + DeprecatedAbs(RoundDown(wheelEvent.overflowDeltaY)), endFeedback); mGesture.PanFeedbackFinalize(mWnd, endFeedback); } diff --git a/xpcom/ds/TimeStamp_windows.cpp b/xpcom/ds/TimeStamp_windows.cpp index 958d13d5d1fbe6..edcdc871f23c99 100644 --- a/xpcom/ds/TimeStamp_windows.cpp +++ b/xpcom/ds/TimeStamp_windows.cpp @@ -356,7 +356,7 @@ TimeStampValue::CheckQPC(int64_t aDuration, const TimeStampValue &aOther) const return false; // Treat absolutely for calibration purposes - aDuration = Abs(aDuration); + aDuration = DeprecatedAbs(aDuration); // Check QPC is sane before using it. diff --git a/xpcom/io/nsMultiplexInputStream.cpp b/xpcom/io/nsMultiplexInputStream.cpp index 9a11860ddbb439..553e56e20cdf79 100644 --- a/xpcom/io/nsMultiplexInputStream.cpp +++ b/xpcom/io/nsMultiplexInputStream.cpp @@ -24,7 +24,7 @@ using namespace mozilla::ipc; -using mozilla::Abs; +using mozilla::DeprecatedAbs; class nsMultiplexInputStream MOZ_FINAL : public nsIMultiplexInputStream, public nsISeekableStream, @@ -515,7 +515,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) } // See if we have enough data in the current stream. - if (Abs(remaining) < streamPos) { + if (DeprecatedAbs(remaining) < streamPos) { rv = stream->Seek(NS_SEEK_END, remaining); NS_ENSURE_SUCCESS(rv, rv); @@ -523,7 +523,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) mStartedReadingCurrent = true; remaining = 0; - } else if (Abs(remaining) > streamPos) { + } else if (DeprecatedAbs(remaining) > streamPos) { if (i > oldCurrentStream || (i == oldCurrentStream && !oldStartedReadingCurrent)) { // We're already at start so no need to seek this stream @@ -533,7 +533,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) rv = stream->Tell(&avail); NS_ENSURE_SUCCESS(rv, rv); - int64_t newPos = streamPos + XPCOM_MIN(avail, Abs(remaining)); + int64_t newPos = streamPos + XPCOM_MIN(avail, DeprecatedAbs(remaining)); rv = stream->Seek(NS_SEEK_END, -newPos); NS_ENSURE_SUCCESS(rv, rv); diff --git a/xpfe/appshell/src/nsXULWindow.cpp b/xpfe/appshell/src/nsXULWindow.cpp index 50e990166a577f..e0a8ddbc30bf8a 100644 --- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -1349,7 +1349,7 @@ void nsXULWindow::StaggerPosition(int32_t &aRequestedX, int32_t &aRequestedY, listY = NSToIntRound(listY / scale); } - if (Abs(listX - aRequestedX) <= kSlop && Abs(listY - aRequestedY) <= kSlop) { + if (DeprecatedAbs(listX - aRequestedX) <= kSlop && DeprecatedAbs(listY - aRequestedY) <= kSlop) { // collision! offset and start over if (bouncedX & 0x1) aRequestedX -= kOffset;