Bug 1600267: part 12) Call `ComparePoints` instead of `ComparePoints_Deprecated` in `EditorBase`. r=masayuki
authorMirko Brodesser <mbrodesser@mozilla.com>
Mon, 06 Jan 2020 14:49:39 +0000
changeset 509046 c1747d1fcad00811eb57ab807d7807f342f33246
parent 509045 f6d4c4f8fca34318f7bf78a627a5f75e53dea5cc
child 509047 1ae1b9789e5d98860d4bb3c4b80550b2e9fad2a6
push id36990
push usernbeleuzu@mozilla.com
push dateTue, 07 Jan 2020 16:19:47 +0000
treeherdermozilla-central@9f55d547e196 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1600267
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1600267: part 12) Call `ComparePoints` instead of `ComparePoints_Deprecated` in `EditorBase`. r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D57968
editor/libeditor/EditorBase.cpp
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -5623,46 +5623,44 @@ nsresult EditorBase::TopLevelEditSubActi
   if (!mChangedRange->IsPositioned()) {
     nsresult rv = mChangedRange->SetStartAndEnd(aStart.ToRawRangeBoundary(),
                                                 aEnd.ToRawRangeBoundary());
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
                          "Failed to set mChangedRange to given range");
     return rv;
   }
 
-  bool disconnected = false;
-  int16_t relation = mChangedRange->StartRef().IsSet()
-                         ? nsContentUtils::ComparePoints_Deprecated(
-                               mChangedRange->StartRef(),
-                               aStart.ToRawRangeBoundary(), &disconnected)
-                         : 1;
-  if (NS_WARN_IF(disconnected)) {
+  Maybe<int32_t> relation =
+      mChangedRange->StartRef().IsSet()
+          ? nsContentUtils::ComparePoints(mChangedRange->StartRef(),
+                                          aStart.ToRawRangeBoundary())
+          : Some(1);
+  if (NS_WARN_IF(!relation)) {
     return NS_ERROR_FAILURE;
   }
 
   // If aStart is before start of mChangedRange, reset the start.
-  if (relation > 0) {
+  if (*relation > 0) {
     ErrorResult error;
     mChangedRange->SetStart(aStart.ToRawRangeBoundary(), error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
   }
 
   relation = mChangedRange->EndRef().IsSet()
-                 ? nsContentUtils::ComparePoints_Deprecated(
-                       mChangedRange->EndRef(), aEnd.ToRawRangeBoundary(),
-                       &disconnected)
-                 : 1;
-  if (NS_WARN_IF(disconnected)) {
+                 ? nsContentUtils::ComparePoints(mChangedRange->EndRef(),
+                                                 aEnd.ToRawRangeBoundary())
+                 : Some(1);
+  if (NS_WARN_IF(!relation)) {
     return NS_ERROR_FAILURE;
   }
 
   // If aEnd is after end of mChangedRange, reset the end.
-  if (relation < 0) {
+  if (*relation < 0) {
     ErrorResult error;
     mChangedRange->SetEnd(aEnd.ToRawRangeBoundary(), error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
   }
 
   return NS_OK;