зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1600267: part 1) Rename `nsContentUtils::ComparePoints` to `ComparePoints_Deprecated`. r=smaug
In a follow-up commit a new `ComparePoints` method with cleaner arguments and return value will be added. Differential Revision: https://phabricator.services.mozilla.com/D55295 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a2b3c15851
Коммит
b8bb35cc69
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <typename FPT, typename FRT, typename SPT, typename SRT>
|
||||
int32_t nsContentUtils::ComparePoints(
|
||||
int32_t nsContentUtils::ComparePoints_Deprecated(
|
||||
const RangeBoundaryBase<FPT, FRT>& aFirstBoundary,
|
||||
const RangeBoundaryBase<SPT, SRT>& 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<FPT, FRT>::OffsetFilter::kValidOrInvalidOffsets),
|
||||
|
|
|
@ -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 <typename FPT, typename FRT, typename SPT, typename SRT>
|
||||
static int32_t ComparePoints(
|
||||
static int32_t ComparePoints_Deprecated(
|
||||
const mozilla::RangeBoundaryBase<FPT, FRT>& aFirstBoundary,
|
||||
const mozilla::RangeBoundaryBase<SPT, SRT>& aSecondBoundary,
|
||||
bool* aDisconnected = nullptr);
|
||||
|
|
|
@ -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<int32_t>(mEndOffset), aRange->GetStartContainer(),
|
||||
static_cast<int32_t>(aRange->StartOffset()), nullptr, mCache);
|
||||
if (cmp == 1) {
|
||||
cmp = nsContentUtils::ComparePoints(
|
||||
cmp = nsContentUtils::ComparePoints_Deprecated(
|
||||
mNode, static_cast<int32_t>(mStartOffset), aRange->GetEndContainer(),
|
||||
static_cast<int32_t>(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<int32_t>(aEndOffset),
|
||||
middlePlus1->GetStartContainer(),
|
||||
static_cast<int32_t>(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<int32_t>(aStartOffset),
|
||||
middleMinus1->GetEndContainer(),
|
||||
static_cast<int32_t>(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<DocumentType> doctype = commonAncestorDocument->GetDoctype();
|
||||
|
||||
if (doctype &&
|
||||
nsContentUtils::ComparePoints(startContainer,
|
||||
static_cast<int32_t>(startOffset),
|
||||
doctype, 0) < 0 &&
|
||||
nsContentUtils::ComparePoints(doctype, 0, endContainer,
|
||||
static_cast<int32_t>(endOffset)) < 0) {
|
||||
nsContentUtils::ComparePoints_Deprecated(
|
||||
startContainer, static_cast<int32_t>(startOffset), doctype, 0) <
|
||||
0 &&
|
||||
nsContentUtils::ComparePoints_Deprecated(
|
||||
doctype, 0, endContainer, static_cast<int32_t>(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<int32_t>(ourOffset),
|
||||
otherNode,
|
||||
static_cast<int32_t>(otherOffset));
|
||||
return nsContentUtils::ComparePoints_Deprecated(
|
||||
ourNode, static_cast<int32_t>(ourOffset), otherNode,
|
||||
static_cast<int32_t>(otherOffset));
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -50,7 +50,7 @@ using namespace widget;
|
|||
/******************************************************************/
|
||||
|
||||
void ContentEventHandler::RawRange::AssertStartIsBeforeOrEqualToEnd() {
|
||||
MOZ_ASSERT(nsContentUtils::ComparePoints(
|
||||
MOZ_ASSERT(nsContentUtils::ComparePoints_Deprecated(
|
||||
mStart.Container(),
|
||||
static_cast<int32_t>(*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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<int32_t>(offset));
|
||||
int32_t e2s1 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset, parent,
|
||||
static_cast<int32_t>(offset));
|
||||
int32_t e2s1 = nsContentUtils::ComparePoints_Deprecated(
|
||||
eEnd->mNode, eEndOffset, parent, static_cast<int32_t>(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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче