Bug 1600267: part 14) Call `ComparePoints` instead of `ComparePoints_Deprecated` in `WSRunScanner`. r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D58912

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mirko Brodesser 2020-01-08 09:49:11 +00:00
Родитель 7410ac5cd6
Коммит 5675fea9e5
1 изменённых файлов: 13 добавлений и 9 удалений

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

@ -84,8 +84,8 @@ WSRunScanner::WSRunScanner(const HTMLEditor* aHTMLEditor,
mStartRun(nullptr),
mEndRun(nullptr),
mHTMLEditor(aHTMLEditor) {
MOZ_ASSERT(nsContentUtils::ComparePoints_Deprecated(
aScanStartPoint.ToRawRangeBoundary(),
MOZ_ASSERT(
*nsContentUtils::ComparePoints(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_Deprecated(
int32_t comp = run->mStartNode ? *nsContentUtils::ComparePoints(
aPoint.ToRawRangeBoundary(),
run->StartPoint().ToRawRangeBoundary())
: -1;
@ -1654,7 +1654,7 @@ WSRunScanner::WSFragment* WSRunScanner::FindNearestRun(
return aForward ? run : nullptr;
}
comp = run->mEndNode ? nsContentUtils::ComparePoints_Deprecated(
comp = run->mEndNode ? *nsContentUtils::ComparePoints(
aPoint.ToRawRangeBoundary(),
run->EndPoint().ToRawRangeBoundary())
: -1;
@ -1696,6 +1696,8 @@ WSRunScanner::WSPoint WSRunScanner::GetNextCharPointInternal(
const EditorDOMPointBase<PT, CT>& aPoint) const {
// Note: only to be called if aPoint.GetContainer() is not a ws node.
MOZ_ASSERT(aPoint.IsSetAndValid());
// Binary search on wsnodes
uint32_t numNodes = mNodeArray.Length();
@ -1710,8 +1712,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_Deprecated(
aPoint.ToRawRangeBoundary(), RawRangeBoundary(curNode, 0u));
int16_t cmp = *nsContentUtils::ComparePoints(aPoint.ToRawRangeBoundary(),
RawRangeBoundary(curNode, 0u));
if (cmp < 0) {
lastNum = curNum;
} else {
@ -1744,6 +1746,8 @@ WSRunScanner::WSPoint WSRunScanner::GetPreviousCharPointInternal(
const EditorDOMPointBase<PT, CT>& aPoint) const {
// Note: only to be called if aNode is not a ws node.
MOZ_ASSERT(aPoint.IsSetAndValid());
// Binary search on wsnodes
uint32_t numNodes = mNodeArray.Length();
@ -1760,8 +1764,8 @@ WSRunScanner::WSPoint WSRunScanner::GetPreviousCharPointInternal(
// ComparePoints(), which is expensive.
while (curNum != lastNum) {
Text* curNode = mNodeArray[curNum];
cmp = nsContentUtils::ComparePoints_Deprecated(
aPoint.ToRawRangeBoundary(), RawRangeBoundary(curNode, 0u));
cmp = *nsContentUtils::ComparePoints(aPoint.ToRawRangeBoundary(),
RawRangeBoundary(curNode, 0u));
if (cmp < 0) {
lastNum = curNum;
} else {