diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index 824152d3e478..9123b3f93772 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1533,8 +1533,8 @@ bool HyperTextAccessible::SelectionBoundsAt(int32_t aSelectionNum, // Make sure start is before end, by swapping DOM points. This occurs when // the user selects backwards in the text. - int32_t rangeCompare = - nsContentUtils::ComparePoints(endNode, endOffset, startNode, startOffset); + int32_t rangeCompare = nsContentUtils::ComparePoints_Deprecated( + endNode, endOffset, startNode, startOffset); if (rangeCompare < 0) { nsINode* tempNode = startNode; startNode = endNode; @@ -2025,8 +2025,8 @@ void HyperTextAccessible::GetSpellTextAttr( // case there is another range after this one. nsINode* endNode = range->GetEndContainer(); int32_t endNodeOffset = range->EndOffset(); - if (nsContentUtils::ComparePoints(aNode, aNodeOffset, endNode, - endNodeOffset) >= 0) + if (nsContentUtils::ComparePoints_Deprecated(aNode, aNodeOffset, endNode, + endNodeOffset) >= 0) continue; // At this point our point is either in this range or before it but after @@ -2035,8 +2035,8 @@ void HyperTextAccessible::GetSpellTextAttr( // must be before the range and after the previous one if any. nsINode* startNode = range->GetStartContainer(); int32_t startNodeOffset = range->StartOffset(); - if (nsContentUtils::ComparePoints(startNode, startNodeOffset, aNode, - aNodeOffset) <= 0) { + if (nsContentUtils::ComparePoints_Deprecated(startNode, startNodeOffset, + aNode, aNodeOffset) <= 0) { startOffset = DOMPointToOffset(startNode, startNodeOffset); endOffset = DOMPointToOffset(endNode, endNodeOffset); diff --git a/dom/base/AbstractRange.cpp b/dom/base/AbstractRange.cpp index e362ad1fb73e..e63e9bd48acb 100644 --- a/dom/base/AbstractRange.cpp +++ b/dom/base/AbstractRange.cpp @@ -134,7 +134,8 @@ nsresult AbstractRange::SetStartAndEndInternal( // If the end point is before the start point, this should be collapsed at // the end point. - if (nsContentUtils::ComparePoints(aStartBoundary, aEndBoundary) == 1) { + if (nsContentUtils::ComparePoints_Deprecated(aStartBoundary, aEndBoundary) == + 1) { aRange->DoSetRange(aEndBoundary, aEndBoundary, newEndRoot); return NS_OK; } diff --git a/dom/base/ContentIterator.cpp b/dom/base/ContentIterator.cpp index 185e29c9f512..b6d6b46a5902 100644 --- a/dom/base/ContentIterator.cpp +++ b/dom/base/ContentIterator.cpp @@ -59,14 +59,14 @@ static bool NodeIsInTraversalRange(nsINode* aNode, bool aIsPreMode, NS_WARN_IF(!aNode->IsContent()) ? nullptr : aNode->AsContent(); // Post mode: start < node <= end. RawRangeBoundary afterNode(parent, content); - return nsContentUtils::ComparePoints(aStart, afterNode) < 0 && - nsContentUtils::ComparePoints(aEnd, afterNode) >= 0; + return nsContentUtils::ComparePoints_Deprecated(aStart, afterNode) < 0 && + nsContentUtils::ComparePoints_Deprecated(aEnd, afterNode) >= 0; } // Pre mode: start <= node < end. RawRangeBoundary beforeNode(parent, aNode->GetPreviousSibling()); - return nsContentUtils::ComparePoints(aStart, beforeNode) <= 0 && - nsContentUtils::ComparePoints(aEnd, beforeNode) > 0; + return nsContentUtils::ComparePoints_Deprecated(aStart, beforeNode) <= 0 && + nsContentUtils::ComparePoints_Deprecated(aEnd, beforeNode) > 0; } ContentIteratorBase::ContentIteratorBase(bool aPre) diff --git a/dom/base/RangeUtils.cpp b/dom/base/RangeUtils.cpp index 5905ef343a5b..dca4327592ce 100644 --- a/dom/base/RangeUtils.cpp +++ b/dom/base/RangeUtils.cpp @@ -84,8 +84,8 @@ bool RangeUtils::IsValidPoints( } bool disconnected = false; - int32_t order = nsContentUtils::ComparePoints(aStartBoundary, aEndBoundary, - &disconnected); + int32_t order = nsContentUtils::ComparePoints_Deprecated( + aStartBoundary, aEndBoundary, &disconnected); if (NS_WARN_IF(disconnected)) { return false; } @@ -154,7 +154,7 @@ nsresult RangeUtils::CompareNodeToRange(nsINode* aNode, // is RANGE(start) <= NODE(start) ? bool disconnected = false; *aNodeIsBeforeRange = - nsContentUtils::ComparePoints( + nsContentUtils::ComparePoints_Deprecated( aAbstractRange->StartRef().Container(), *aAbstractRange->StartRef().Offset( RangeBoundary::OffsetFilter::kValidOrInvalidOffsets), @@ -165,7 +165,7 @@ nsresult RangeUtils::CompareNodeToRange(nsINode* aNode, // is RANGE(end) >= NODE(end) ? *aNodeIsAfterRange = - nsContentUtils::ComparePoints( + nsContentUtils::ComparePoints_Deprecated( aAbstractRange->EndRef().Container(), *aAbstractRange->EndRef().Offset( RangeBoundary::OffsetFilter::kValidOrInvalidOffsets), diff --git a/dom/base/Selection.cpp b/dom/base/Selection.cpp index 7809b1d5b153..2b5af7dc9211 100644 --- a/dom/base/Selection.cpp +++ b/dom/base/Selection.cpp @@ -686,8 +686,8 @@ static nsresult CompareToRangeStart(const nsINode* aCompareNode, aCompareNode->SubtreeRoot() != start->SubtreeRoot()) { *aCmp = 1; } else { - *aCmp = nsContentUtils::ComparePoints(aCompareNode, aCompareOffset, start, - aRange->StartOffset()); + *aCmp = nsContentUtils::ComparePoints_Deprecated( + aCompareNode, aCompareOffset, start, aRange->StartOffset()); } return NS_OK; } @@ -704,8 +704,8 @@ static nsresult CompareToRangeEnd(const nsINode* aCompareNode, aCompareNode->SubtreeRoot() != end->SubtreeRoot()) { *aCmp = 1; } else { - *aCmp = nsContentUtils::ComparePoints(aCompareNode, aCompareOffset, end, - aRange->EndOffset()); + *aCmp = nsContentUtils::ComparePoints_Deprecated( + aCompareNode, aCompareOffset, end, aRange->EndOffset()); } return NS_OK; } @@ -2437,15 +2437,15 @@ void Selection::Extend(nsINode& aContainer, uint32_t aOffset, // selected will be cleared. bool disconnected = false; bool shouldClearRange = false; - int32_t result1 = nsContentUtils::ComparePoints( + int32_t result1 = nsContentUtils::ComparePoints_Deprecated( anchorNode, anchorOffset, focusNode, focusOffset, &disconnected); // compare old cursor to new cursor shouldClearRange |= disconnected; - int32_t result2 = nsContentUtils::ComparePoints( + int32_t result2 = nsContentUtils::ComparePoints_Deprecated( focusNode, focusOffset, &aContainer, aOffset, &disconnected); // compare anchor to new cursor shouldClearRange |= disconnected; - int32_t result3 = nsContentUtils::ComparePoints( + int32_t result3 = nsContentUtils::ComparePoints_Deprecated( anchorNode, anchorOffset, &aContainer, aOffset, &disconnected); // If the points are disconnected, the range will be collapsed below, @@ -3334,7 +3334,7 @@ void Selection::SetBaseAndExtentInternal(InLimiter aInLimiter, // XXX If they are disconnected, shouldn't we return error before allocating // new nsRange instance? SelectionBatcher batch(this); - if (nsContentUtils::ComparePoints(aAnchorRef, aFocusRef) <= 0) { + if (nsContentUtils::ComparePoints_Deprecated(aAnchorRef, aFocusRef) <= 0) { SetStartAndEndInternal(aInLimiter, aAnchorRef, aFocusRef, eDirNext, aRv); return; } diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index a0b93af16462..f36a00818813 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -332,16 +332,16 @@ mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump"); int32_t nsContentUtils::sInnerOrOuterWindowCount = 0; uint32_t nsContentUtils::sInnerOrOuterWindowSerialCounter = 0; -template int32_t nsContentUtils::ComparePoints( +template int32_t nsContentUtils::ComparePoints_Deprecated( const RangeBoundary& aFirstBoundary, const RangeBoundary& aSecondBoundary, bool* aDisconnected); -template int32_t nsContentUtils::ComparePoints( +template int32_t nsContentUtils::ComparePoints_Deprecated( const RangeBoundary& aFirstBoundary, const RawRangeBoundary& aSecondBoundary, bool* aDisconnected); -template int32_t nsContentUtils::ComparePoints( +template int32_t nsContentUtils::ComparePoints_Deprecated( const RawRangeBoundary& aFirstBoundary, const RangeBoundary& aSecondBoundary, bool* aDisconnected); -template int32_t nsContentUtils::ComparePoints( +template int32_t nsContentUtils::ComparePoints_Deprecated( const RawRangeBoundary& aFirstBoundary, const RawRangeBoundary& aSecondBoundary, bool* aDisconnected); @@ -2365,10 +2365,9 @@ bool nsContentUtils::PositionIsBefore(nsINode* aNode1, nsINode* aNode2, } /* static */ -int32_t nsContentUtils::ComparePoints(const nsINode* aParent1, int32_t aOffset1, - const nsINode* aParent2, int32_t aOffset2, - bool* aDisconnected, - ComparePointsCache* aParent1Cache) { +int32_t nsContentUtils::ComparePoints_Deprecated( + const nsINode* aParent1, int32_t aOffset1, const nsINode* aParent2, + int32_t aOffset2, bool* aDisconnected, ComparePointsCache* aParent1Cache) { if (aParent1 == aParent2) { // XXX This is odd. aOffset1 and/or aOffset2 may be -1, e.g., it's result // of nsINode::ComputeIndexOf(), but this compares such invalid @@ -2487,7 +2486,7 @@ nsINode* nsContentUtils::GetCommonAncestorUnderInteractiveContent( /* static */ template -int32_t nsContentUtils::ComparePoints( +int32_t nsContentUtils::ComparePoints_Deprecated( const RangeBoundaryBase& aFirstBoundary, const RangeBoundaryBase& aSecondBoundary, bool* aDisconnected) { if (NS_WARN_IF(!aFirstBoundary.IsSet()) || @@ -2496,7 +2495,7 @@ int32_t nsContentUtils::ComparePoints( } // XXX Re-implement this without calling `Offset()` as far as possible, // and the other overload should be an alias of this. - return ComparePoints( + return ComparePoints_Deprecated( aFirstBoundary.Container(), *aFirstBoundary.Offset( RangeBoundaryBase::OffsetFilter::kValidOrInvalidOffsets), diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 10e79d958d49..cd1fa7664222 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -483,12 +483,12 @@ class nsContentUtils { * On the other hand, nsINode can have ATTRCHILD_ARRAY_MAX_CHILD_COUN * (0x3FFFFF) at most. Therefore, they can be int32_t for now. */ - static int32_t ComparePoints(const nsINode* aParent1, int32_t aOffset1, - const nsINode* aParent2, int32_t aOffset2, - bool* aDisconnected = nullptr, - ComparePointsCache* aParent1Cache = nullptr); + static int32_t ComparePoints_Deprecated( + const nsINode* aParent1, int32_t aOffset1, const nsINode* aParent2, + int32_t aOffset2, bool* aDisconnected = nullptr, + ComparePointsCache* aParent1Cache = nullptr); template - static int32_t ComparePoints( + static int32_t ComparePoints_Deprecated( const mozilla::RangeBoundaryBase& aFirstBoundary, const mozilla::RangeBoundaryBase& aSecondBoundary, bool* aDisconnected = nullptr); diff --git a/dom/base/nsRange.cpp b/dom/base/nsRange.cpp index b893cd4a869c..5bbdeb358a9c 100644 --- a/dom/base/nsRange.cpp +++ b/dom/base/nsRange.cpp @@ -138,11 +138,11 @@ struct IsItemInRangeComparator { nsContentUtils::ComparePointsCache* mCache; int operator()(const nsRange* const aRange) const { - int32_t cmp = nsContentUtils::ComparePoints( + int32_t cmp = nsContentUtils::ComparePoints_Deprecated( mNode, static_cast(mEndOffset), aRange->GetStartContainer(), static_cast(aRange->StartOffset()), nullptr, mCache); if (cmp == 1) { - cmp = nsContentUtils::ComparePoints( + cmp = nsContentUtils::ComparePoints_Deprecated( mNode, static_cast(mStartOffset), aRange->GetEndContainer(), static_cast(aRange->EndOffset()), nullptr, mCache); if (cmp == -1) { @@ -212,7 +212,7 @@ bool nsRange::IsNodeSelected(nsINode* aNode, uint32_t aStartOffset, // if node end > start of middle+1, result = 1 if (middle + 1 < high && (middlePlus1 = selection->GetRangeAt(middle + 1)) && - nsContentUtils::ComparePoints( + nsContentUtils::ComparePoints_Deprecated( aNode, static_cast(aEndOffset), middlePlus1->GetStartContainer(), static_cast(middlePlus1->StartOffset()), nullptr, @@ -221,7 +221,7 @@ bool nsRange::IsNodeSelected(nsINode* aNode, uint32_t aStartOffset, // if node start < end of middle - 1, result = -1 } else if (middle >= 1 && (middleMinus1 = selection->GetRangeAt(middle - 1)) && - nsContentUtils::ComparePoints( + nsContentUtils::ComparePoints_Deprecated( aNode, static_cast(aStartOffset), middleMinus1->GetEndContainer(), static_cast(middleMinus1->EndOffset()), @@ -873,11 +873,11 @@ int16_t nsRange::ComparePoint(nsINode& aContainer, uint32_t aOffset, MOZ_ASSERT(point.IsSetAndValid()); - const int32_t cmp = nsContentUtils::ComparePoints(point, mStart); + const int32_t cmp = nsContentUtils::ComparePoints_Deprecated(point, mStart); if (cmp <= 0) { return cmp; } - if (nsContentUtils::ComparePoints(mEnd, point) == -1) { + if (nsContentUtils::ComparePoints_Deprecated(mEnd, point) == -1) { return 1; } @@ -904,11 +904,11 @@ bool nsRange::IntersectsNode(nsINode& aNode, ErrorResult& aRv) { // Steps 6-7. // Note: if disconnected is true, ComparePoints returns 1. bool disconnected = false; - bool result = nsContentUtils::ComparePoints( + bool result = nsContentUtils::ComparePoints_Deprecated( mStart.Container(), *mStart.Offset(RangeBoundary::OffsetFilter::kValidOffsets), parent, nodeIndex + 1, &disconnected) < 0 && - nsContentUtils::ComparePoints( + nsContentUtils::ComparePoints_Deprecated( parent, nodeIndex, mEnd.Container(), *mEnd.Offset(RangeBoundary::OffsetFilter::kValidOffsets), &disconnected) < 0; @@ -1123,7 +1123,7 @@ void nsRange::SetStart(const RawRangeBoundary& aPoint, ErrorResult& aRv) { // Collapse if not positioned yet, if positioned in another doc or // if the new start is after end. if (!mIsPositioned || newRoot != mRoot || - nsContentUtils::ComparePoints(aPoint, mEnd) == 1) { + nsContentUtils::ComparePoints_Deprecated(aPoint, mEnd) == 1) { DoSetRange(aPoint, aPoint, newRoot); return; } @@ -1199,7 +1199,7 @@ void nsRange::SetEnd(const RawRangeBoundary& aPoint, ErrorResult& aRv) { // Collapse if not positioned yet, if positioned in another doc or // if the new end is before start. if (!mIsPositioned || newRoot != mRoot || - nsContentUtils::ComparePoints(mStart, aPoint) == 1) { + nsContentUtils::ComparePoints_Deprecated(mStart, aPoint) == 1) { DoSetRange(aPoint, aPoint, newRoot); return; } @@ -1700,11 +1700,11 @@ nsresult nsRange::CutContents(DocumentFragment** aFragment) { RefPtr doctype = commonAncestorDocument->GetDoctype(); if (doctype && - nsContentUtils::ComparePoints(startContainer, - static_cast(startOffset), - doctype, 0) < 0 && - nsContentUtils::ComparePoints(doctype, 0, endContainer, - static_cast(endOffset)) < 0) { + nsContentUtils::ComparePoints_Deprecated( + startContainer, static_cast(startOffset), doctype, 0) < + 0 && + nsContentUtils::ComparePoints_Deprecated( + doctype, 0, endContainer, static_cast(endOffset)) < 0) { return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR; } } @@ -2020,9 +2020,9 @@ int16_t nsRange::CompareBoundaryPoints(uint16_t aHow, nsRange& aOtherRange, return 0; } - return nsContentUtils::ComparePoints(ourNode, static_cast(ourOffset), - otherNode, - static_cast(otherOffset)); + return nsContentUtils::ComparePoints_Deprecated( + ourNode, static_cast(ourOffset), otherNode, + static_cast(otherOffset)); } /* static */ diff --git a/dom/events/ContentEventHandler.cpp b/dom/events/ContentEventHandler.cpp index da087972c083..3f0aea926fa0 100644 --- a/dom/events/ContentEventHandler.cpp +++ b/dom/events/ContentEventHandler.cpp @@ -50,7 +50,7 @@ using namespace widget; /******************************************************************/ void ContentEventHandler::RawRange::AssertStartIsBeforeOrEqualToEnd() { - MOZ_ASSERT(nsContentUtils::ComparePoints( + MOZ_ASSERT(nsContentUtils::ComparePoints_Deprecated( mStart.Container(), static_cast(*mStart.Offset( NodePosition::OffsetFilter::kValidOrInvalidOffsets)), @@ -1353,8 +1353,8 @@ nsresult ContentEventHandler::OnQuerySelectedText( return NS_ERROR_FAILURE; } - int16_t compare = nsContentUtils::ComparePoints(anchorNode, anchorOffset, - focusNode, focusOffset); + int16_t compare = nsContentUtils::ComparePoints_Deprecated( + anchorNode, anchorOffset, focusNode, focusOffset); aEvent->mReply.mReversed = compare > 0; } // However, if there are 2 or more selection ranges, we have no information diff --git a/dom/events/TextComposition.cpp b/dom/events/TextComposition.cpp index cb33376d6b30..88fb2326386c 100644 --- a/dom/events/TextComposition.cpp +++ b/dom/events/TextComposition.cpp @@ -716,7 +716,7 @@ RawRangeBoundary TextComposition::GetStartRef() const { } // Unfortunately, really slow path. bool disconnected = false; - if (nsContentUtils::ComparePoints( + if (nsContentUtils::ComparePoints_Deprecated( range->StartRef(), firstRange->StartRef(), &disconnected) == -1) { firstRange = range; } @@ -773,8 +773,8 @@ RawRangeBoundary TextComposition::GetEndRef() const { } // Unfortunately, really slow path. bool disconnected = false; - if (nsContentUtils::ComparePoints(lastRange->EndRef(), range->EndRef(), - &disconnected) == -1) { + if (nsContentUtils::ComparePoints_Deprecated( + lastRange->EndRef(), range->EndRef(), &disconnected) == -1) { lastRange = range; } } diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 3385c334cf38..a0f8decb188d 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -5628,7 +5628,7 @@ nsresult EditorBase::TopLevelEditSubActionData::AddRangeToChangedRange( bool disconnected = false; int16_t relation = mChangedRange->StartRef().IsSet() - ? nsContentUtils::ComparePoints( + ? nsContentUtils::ComparePoints_Deprecated( mChangedRange->StartRef(), aStart.ToRawRangeBoundary(), &disconnected) : 1; @@ -5646,9 +5646,9 @@ nsresult EditorBase::TopLevelEditSubActionData::AddRangeToChangedRange( } relation = mChangedRange->EndRef().IsSet() - ? nsContentUtils::ComparePoints(mChangedRange->EndRef(), - aEnd.ToRawRangeBoundary(), - &disconnected) + ? nsContentUtils::ComparePoints_Deprecated( + mChangedRange->EndRef(), aEnd.ToRawRangeBoundary(), + &disconnected) : 1; if (NS_WARN_IF(disconnected)) { return NS_ERROR_FAILURE; diff --git a/editor/libeditor/HTMLEditSubActionHandler.cpp b/editor/libeditor/HTMLEditSubActionHandler.cpp index 5ac478b18e06..60d10168d302 100644 --- a/editor/libeditor/HTMLEditSubActionHandler.cpp +++ b/editor/libeditor/HTMLEditSubActionHandler.cpp @@ -7159,13 +7159,13 @@ nsresult HTMLEditor::MaybeExtendSelectionToHardLineEdgesForBlockEditAction() { // start, or new start after old end. If so then just leave things alone. int16_t comp; - comp = nsContentUtils::ComparePoints(startPoint.ToRawRangeBoundary(), - newEndPoint.ToRawRangeBoundary()); + comp = nsContentUtils::ComparePoints_Deprecated( + startPoint.ToRawRangeBoundary(), newEndPoint.ToRawRangeBoundary()); if (comp == 1) { return NS_OK; // New end before old start. } - comp = nsContentUtils::ComparePoints(newStartPoint.ToRawRangeBoundary(), - endPoint.ToRawRangeBoundary()); + comp = nsContentUtils::ComparePoints_Deprecated( + newStartPoint.ToRawRangeBoundary(), endPoint.ToRawRangeBoundary()); if (comp == 1) { return NS_OK; // New start after old end. } diff --git a/editor/libeditor/WSRunObject.cpp b/editor/libeditor/WSRunObject.cpp index 93c24fb8358c..dad977665135 100644 --- a/editor/libeditor/WSRunObject.cpp +++ b/editor/libeditor/WSRunObject.cpp @@ -84,9 +84,9 @@ WSRunScanner::WSRunScanner(const HTMLEditor* aHTMLEditor, mStartRun(nullptr), mEndRun(nullptr), mHTMLEditor(aHTMLEditor) { - MOZ_ASSERT( - nsContentUtils::ComparePoints(aScanStartPoint.ToRawRangeBoundary(), - aScanEndPoint.ToRawRangeBoundary()) <= 0); + MOZ_ASSERT(nsContentUtils::ComparePoints_Deprecated( + aScanStartPoint.ToRawRangeBoundary(), + aScanEndPoint.ToRawRangeBoundary()) <= 0); GetWSNodes(); GetRuns(); } @@ -1644,7 +1644,7 @@ WSRunScanner::WSFragment* WSRunScanner::FindNearestRun( MOZ_ASSERT(aPoint.IsSetAndValid()); for (WSFragment* run = mStartRun; run; run = run->mRight) { - int32_t comp = run->mStartNode ? nsContentUtils::ComparePoints( + int32_t comp = run->mStartNode ? nsContentUtils::ComparePoints_Deprecated( aPoint.ToRawRangeBoundary(), run->StartPoint().ToRawRangeBoundary()) : -1; @@ -1654,7 +1654,7 @@ WSRunScanner::WSFragment* WSRunScanner::FindNearestRun( return aForward ? run : nullptr; } - comp = run->mEndNode ? nsContentUtils::ComparePoints( + comp = run->mEndNode ? nsContentUtils::ComparePoints_Deprecated( aPoint.ToRawRangeBoundary(), run->EndPoint().ToRawRangeBoundary()) : -1; @@ -1710,8 +1710,8 @@ WSRunScanner::WSPoint WSRunScanner::GetNextCharPointInternal( uint32_t firstNum = 0, curNum = numNodes / 2, lastNum = numNodes; while (curNum != lastNum) { Text* curNode = mNodeArray[curNum]; - int16_t cmp = nsContentUtils::ComparePoints(aPoint.ToRawRangeBoundary(), - RawRangeBoundary(curNode, 0u)); + int16_t cmp = nsContentUtils::ComparePoints_Deprecated( + aPoint.ToRawRangeBoundary(), RawRangeBoundary(curNode, 0u)); if (cmp < 0) { lastNum = curNum; } else { @@ -1760,8 +1760,8 @@ WSRunScanner::WSPoint WSRunScanner::GetPreviousCharPointInternal( // ComparePoints(), which is expensive. while (curNum != lastNum) { Text* curNode = mNodeArray[curNum]; - cmp = nsContentUtils::ComparePoints(aPoint.ToRawRangeBoundary(), - RawRangeBoundary(curNode, 0u)); + cmp = nsContentUtils::ComparePoints_Deprecated( + aPoint.ToRawRangeBoundary(), RawRangeBoundary(curNode, 0u)); if (cmp < 0) { lastNum = curNum; } else { diff --git a/editor/spellchecker/FilteredContentIterator.cpp b/editor/spellchecker/FilteredContentIterator.cpp index a2f4ca49e3ea..f6fd41e24727 100644 --- a/editor/spellchecker/FilteredContentIterator.cpp +++ b/editor/spellchecker/FilteredContentIterator.cpp @@ -225,10 +225,10 @@ static bool ContentIsInTraversalRange(nsIContent* aContent, bool aIsPreMode, if (!aIsPreMode) ++indx; - int32_t startRes = nsContentUtils::ComparePoints( + int32_t startRes = nsContentUtils::ComparePoints_Deprecated( aStartContainer, aStartOffset, parentNode, indx); - int32_t endRes = nsContentUtils::ComparePoints(aEndContainer, aEndOffset, - parentNode, indx); + int32_t endRes = nsContentUtils::ComparePoints_Deprecated( + aEndContainer, aEndOffset, parentNode, indx); return (startRes <= 0) && (endRes >= 0); } diff --git a/editor/spellchecker/TextServicesDocument.cpp b/editor/spellchecker/TextServicesDocument.cpp index cea705d1fb80..65a60ff33c89 100644 --- a/editor/spellchecker/TextServicesDocument.cpp +++ b/editor/spellchecker/TextServicesDocument.cpp @@ -1888,10 +1888,10 @@ nsresult TextServicesDocument::GetCollapsedSelection( uint32_t offset = range->StartOffset(); - int32_t e1s1 = nsContentUtils::ComparePoints( + int32_t e1s1 = nsContentUtils::ComparePoints_Deprecated( eStart->mNode, eStartOffset, parent, static_cast(offset)); - int32_t e2s1 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset, parent, - static_cast(offset)); + int32_t e2s1 = nsContentUtils::ComparePoints_Deprecated( + eEnd->mNode, eEndOffset, parent, static_cast(offset)); if (e1s1 > 0 || e2s1 < 0) { // We're done if the caret is outside the current text block. @@ -2094,10 +2094,10 @@ nsresult TextServicesDocument::GetUncollapsedSelection( NS_ENSURE_SUCCESS(rv, rv); - e1s2 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset, - endContainer, endOffset); - e2s1 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset, - startContainer, startOffset); + e1s2 = nsContentUtils::ComparePoints_Deprecated(eStart->mNode, eStartOffset, + endContainer, endOffset); + e2s1 = nsContentUtils::ComparePoints_Deprecated( + eEnd->mNode, eEndOffset, startContainer, startOffset); // Break out of the loop if the text block intersects the current range. @@ -2116,10 +2116,10 @@ nsresult TextServicesDocument::GetUncollapsedSelection( // Now that we have an intersecting range, find out more info: - e1s1 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset, - startContainer, startOffset); - e2s2 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset, endContainer, - endOffset); + e1s1 = nsContentUtils::ComparePoints_Deprecated(eStart->mNode, eStartOffset, + startContainer, startOffset); + e2s2 = nsContentUtils::ComparePoints_Deprecated(eEnd->mNode, eEndOffset, + endContainer, endOffset); if (rangeCount > 1) { // There are multiple selection ranges, we only deal diff --git a/layout/base/AccessibleCaretManager.cpp b/layout/base/AccessibleCaretManager.cpp index 894af5f04252..7e57ba9cd055 100644 --- a/layout/base/AccessibleCaretManager.cpp +++ b/layout/base/AccessibleCaretManager.cpp @@ -1121,7 +1121,7 @@ bool AccessibleCaretManager::RestrictCaretDraggingOffsets( // Compare the active caret's new position (aOffsets) to the inactive caret's // position. - int32_t cmpToInactiveCaretPos = nsContentUtils::ComparePoints( + int32_t cmpToInactiveCaretPos = nsContentUtils::ComparePoints_Deprecated( aOffsets.content, aOffsets.StartOffset(), content, contentOffset); // Move one character (in the direction of dir) from the inactive caret's @@ -1135,9 +1135,9 @@ bool AccessibleCaretManager::RestrictCaretDraggingOffsets( } // Compare the active caret's new position (aOffsets) to the limit. - int32_t cmpToLimit = - nsContentUtils::ComparePoints(aOffsets.content, aOffsets.StartOffset(), - limit.mResultContent, limit.mContentOffset); + int32_t cmpToLimit = nsContentUtils::ComparePoints_Deprecated( + aOffsets.content, aOffsets.StartOffset(), limit.mResultContent, + limit.mContentOffset); auto SetOffsetsToLimit = [&aOffsets, &limit]() { aOffsets.content = limit.mResultContent; diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp index 772e582a4f00..2170d83a6682 100644 --- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -1052,10 +1052,10 @@ bool nsFrameSelection::AdjustForMaintainedSelection(nsIContent* aContent, int32_t rangeStartOffset = mMaintainRange->StartOffset(); int32_t rangeEndOffset = mMaintainRange->EndOffset(); - int32_t relToStart = nsContentUtils::ComparePoints( + int32_t relToStart = nsContentUtils::ComparePoints_Deprecated( rangeStartNode, rangeStartOffset, aContent, aOffset); - int32_t relToEnd = nsContentUtils::ComparePoints(rangeEndNode, rangeEndOffset, - aContent, aOffset); + int32_t relToEnd = nsContentUtils::ComparePoints_Deprecated( + rangeEndNode, rangeEndOffset, aContent, aOffset); // If aContent/aOffset is inside the maintained selection, or if it is on the // "anchor" side of the maintained selection, we need to do something. @@ -1138,7 +1138,7 @@ void nsFrameSelection::HandleDrag(nsIFrame* aFrame, const nsPoint& aPoint) { if (mMaintainRange && mMaintainedAmount != eSelectNoAmount) { nsINode* rangenode = mMaintainRange->GetStartContainer(); int32_t rangeOffset = mMaintainRange->StartOffset(); - int32_t relativePosition = nsContentUtils::ComparePoints( + int32_t relativePosition = nsContentUtils::ComparePoints_Deprecated( rangenode, rangeOffset, offsets.content, offsets.offset); nsDirection direction = relativePosition > 0 ? eDirPrevious : eDirNext;