Bug 1446533 part 11. Remove remaining nsIDOMCharacterData uses in range code. r=mystor
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 19 Mar 2018 15:45:58 -0400
changeset 408876 18e3eb86e416f40cddb4c78faa7eb6e98f4b3be3
parent 408875 6525e7ba0b1d25e045834a80cc2c441cb5429b14
child 408877 22f71b21eb19eb1b746708d239089da9ee313ebb
push id33663
push userapavel@mozilla.com
push dateMon, 19 Mar 2018 22:40:21 +0000
treeherdermozilla-central@bfb7edfd0436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmystor
bugs1446533
milestone61.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 1446533 part 11. Remove remaining nsIDOMCharacterData uses in range code. r=mystor MozReview-Commit-ID: 8YLea3SmQQU
dom/base/nsRange.cpp
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -1892,31 +1892,31 @@ RangeSubtreeIterator::Init(nsRange *aRan
   // Grab the start point of the range and QI it to
   // a CharacterData pointer. If it is CharacterData store
   // a pointer to the node.
 
   ErrorResult rv;
   nsCOMPtr<nsINode> node = aRange->GetStartContainer(rv);
   if (!node) return NS_ERROR_FAILURE;
 
-  nsCOMPtr<nsIDOMCharacterData> startData = do_QueryInterface(node);
-  if (startData || (node->IsElement() &&
-                    node->AsElement()->GetChildCount() == aRange->GetStartOffset(rv))) {
+  if (node->IsCharacterData() ||
+      (node->IsElement() &&
+       node->AsElement()->GetChildCount() == aRange->GetStartOffset(rv))) {
     mStart = node;
   }
 
   // Grab the end point of the range and QI it to
   // a CharacterData pointer. If it is CharacterData store
   // a pointer to the node.
 
   node = aRange->GetEndContainer(rv);
   if (!node) return NS_ERROR_FAILURE;
 
-  nsCOMPtr<nsIDOMCharacterData> endData = do_QueryInterface(node);
-  if (endData || (node->IsElement() && aRange->GetEndOffset(rv) == 0)) {
+  if (node->IsCharacterData() ||
+      (node->IsElement() && aRange->GetEndOffset(rv) == 0)) {
     mEnd = node;
   }
 
   if (mStart && mStart == mEnd)
   {
     // The range starts and stops in the same CharacterData
     // node. Null out the end pointer so we only visit the
     // node once!
@@ -2166,18 +2166,17 @@ ValidateCurrentNode(nsRange* aRange, Ran
     // e.g., the iterator is done.
     return true;
   }
 
   nsresult res = nsRange::CompareNodeToRange(node, aRange, &before, &after);
   NS_ENSURE_SUCCESS(res, false);
 
   if (before || after) {
-    nsCOMPtr<nsIDOMCharacterData> charData = do_QueryInterface(node);
-    if (charData) {
+    if (node->IsCharacterData()) {
       // If we're dealing with the start/end container which is a character
       // node, pretend that the node is in the range.
       if (before && node == aRange->GetStartContainer()) {
         before = false;
       }
       if (after && node == aRange->GetEndContainer()) {
         after = false;
       }