Bug 1377989 - part1: Rename nsRange::GetStartParent() to nsRange::GetStartContainer() r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 11 Jul 2017 20:53:04 +0900
changeset 368338 0dc608377abd95f03e6eab9991b47b3fa43f120d
parent 368337 bedf96cb62fd4444ab8d6afc4e22d9656286bf22
child 368339 071e78737dde6e08c6c459b231b2969e74a67589
push id92469
push usercbook@mozilla.com
push dateWed, 12 Jul 2017 09:18:17 +0000
treeherdermozilla-inbound@235ab635d172 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1377989
milestone56.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 1377989 - part1: Rename nsRange::GetStartParent() to nsRange::GetStartContainer() r=smaug Web standards use "Container" instead of "Parent". So, nsRange shouldn't use "Parent" for its members and methods. MozReview-Commit-ID: Ho6N0diuWtE
accessible/generic/HyperTextAccessible.cpp
dom/base/Selection.cpp
dom/base/nsContentIterator.cpp
dom/base/nsContentUtils.cpp
dom/base/nsDocumentEncoder.cpp
dom/base/nsRange.cpp
dom/base/nsRange.h
dom/events/ContentEventHandler.cpp
dom/events/IMEContentObserver.cpp
editor/libeditor/DeleteRangeTransaction.cpp
editor/libeditor/EditorBase.cpp
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLStyleEditor.cpp
editor/libeditor/SelectionState.cpp
editor/libeditor/TextEditRules.cpp
editor/libeditor/TextEditor.cpp
extensions/spellcheck/src/mozInlineSpellChecker.cpp
layout/base/AccessibleCaretManager.cpp
layout/base/PresShell.cpp
layout/base/nsLayoutUtils.cpp
layout/generic/nsFrameSelection.cpp
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1606,17 +1606,17 @@ HyperTextAccessible::SelectionBoundsAt(i
 
   uint32_t rangeCount = ranges.Length();
   if (aSelectionNum < 0 || aSelectionNum >= static_cast<int32_t>(rangeCount))
     return false;
 
   nsRange* range = ranges[aSelectionNum];
 
   // Get start and end points.
-  nsINode* startNode = range->GetStartParent();
+  nsINode* startNode = range->GetStartContainer();
   nsINode* endNode = range->GetEndParent();
   int32_t startOffset = range->StartOffset(), endOffset = range->EndOffset();
 
   // 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);
   if (rangeCompare < 0) {
@@ -1783,24 +1783,24 @@ HyperTextAccessible::SelectionRanges(nsT
   if (!sel)
     return;
 
   aRanges->SetCapacity(sel->RangeCount());
 
   for (uint32_t idx = 0; idx < sel->RangeCount(); idx++) {
     nsRange* DOMRange = sel->GetRangeAt(idx);
     HyperTextAccessible* startParent =
-      nsAccUtils::GetTextContainer(DOMRange->GetStartParent());
+      nsAccUtils::GetTextContainer(DOMRange->GetStartContainer());
     HyperTextAccessible* endParent =
       nsAccUtils::GetTextContainer(DOMRange->GetEndParent());
     if (!startParent || !endParent)
       continue;
 
     int32_t startOffset =
-      startParent->DOMPointToOffset(DOMRange->GetStartParent(),
+      startParent->DOMPointToOffset(DOMRange->GetStartContainer(),
                                     DOMRange->StartOffset(), false);
     int32_t endOffset =
       endParent->DOMPointToOffset(DOMRange->GetEndParent(),
                                   DOMRange->EndOffset(), true);
 
     TextRange tr(IsTextField() ? const_cast<HyperTextAccessible*>(this) : mDoc,
                     startParent, startOffset, endParent, endOffset);
     *(aRanges->AppendElement()) = Move(tr);
@@ -2155,17 +2155,17 @@ HyperTextAccessible::GetSpellTextAttr(ns
     if (nsContentUtils::ComparePoints(aNode, aNodeOffset,
                                       endNode, endNodeOffset) >= 0)
       continue;
 
     // At this point our point is either in this range or before it but after
     // the previous range.  So we check to see if the range starts before the
     // point in which case the point is in the missspelled range, otherwise it
     // must be before the range and after the previous one if any.
-    nsINode* startNode = range->GetStartParent();
+    nsINode* startNode = range->GetStartContainer();
     int32_t startNodeOffset = range->StartOffset();
     if (nsContentUtils::ComparePoints(startNode, startNodeOffset, aNode,
                                       aNodeOffset) <= 0) {
       startOffset = DOMPointToOffset(startNode, startNodeOffset);
 
       endOffset = DOMPointToOffset(endNode, endNodeOffset);
 
       if (startOffset > *aStartOffset)
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -438,17 +438,17 @@ struct MOZ_RAII AutoPrepareFocusRange
 
 #ifdef PRINT_RANGE
 void printRange(nsRange *aDomRange)
 {
   if (!aDomRange)
   {
     printf("NULL nsIDOMRange\n");
   }
-  nsINode* startNode = aDomRange->GetStartParent();
+  nsINode* startNode = aDomRange->GetStartContainer();
   nsINode* endNode = aDomRange->GetEndParent();
   int32_t startOffset = aDomRange->StartOffset();
   int32_t endOffset = aDomRange->EndOffset();
 
   printf("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n",
          (unsigned long)aDomRange,
          (unsigned long)startNode, (long)startOffset,
          (unsigned long)endNode, (long)endOffset);
@@ -630,17 +630,17 @@ Selection::GetTableCellLocationFromRange
   // Don't fail if range does not point to a single table cell,
   //  let aSelectionType tell user if we don't have a cell
   if (*aSelectionType  != nsISelectionPrivate::TABLESELECTION_CELL)
     return NS_OK;
 
   // Get the child content (the cell) pointed to by starting node of range
   // We do minimal checking since GetTableSelectionType assures
   //   us that this really is a table cell
-  nsCOMPtr<nsIContent> content = do_QueryInterface(aRange->GetStartParent());
+  nsCOMPtr<nsIContent> content = do_QueryInterface(aRange->GetStartContainer());
   if (!content)
     return NS_ERROR_FAILURE;
 
   nsIContent *child = content->GetChildAt(aRange->StartOffset());
   if (!child)
     return NS_ERROR_FAILURE;
 
   //Note: This is a non-ref-counted pointer to the frame
@@ -702,17 +702,17 @@ Selection::GetTableSelectionType(nsIDOMR
     return NS_ERROR_NULL_POINTER;
   nsRange* range = static_cast<nsRange*>(aDOMRange);
 
   *aTableSelectionType = nsISelectionPrivate::TABLESELECTION_NONE;
 
   // Must have access to frame selection to get cell info
   if(!mFrameSelection) return NS_OK;
 
-  nsINode* startNode = range->GetStartParent();
+  nsINode* startNode = range->GetStartContainer();
   if (!startNode) return NS_ERROR_FAILURE;
 
   nsINode* endNode = range->GetEndParent();
   if (!endNode) return NS_ERROR_FAILURE;
 
   // Not a single selected node
   if (startNode != endNode) return NS_OK;
 
@@ -855,17 +855,17 @@ Selection::GetAnchorNode(nsIDOMNode** aA
 
 nsINode*
 Selection::GetAnchorNode()
 {
   if (!mAnchorFocusRange)
     return nullptr;
 
   if (GetDirection() == eDirNext) {
-    return mAnchorFocusRange->GetStartParent();
+    return mAnchorFocusRange->GetStartContainer();
   }
 
   return mAnchorFocusRange->GetEndParent();
 }
 
 NS_IMETHODIMP
 Selection::GetAnchorOffset(int32_t* aAnchorOffset)
 {
@@ -891,17 +891,17 @@ Selection::GetFocusNode()
 {
   if (!mAnchorFocusRange)
     return nullptr;
 
   if (GetDirection() == eDirNext){
     return mAnchorFocusRange->GetEndParent();
   }
 
-  return mAnchorFocusRange->GetStartParent();
+  return mAnchorFocusRange->GetStartContainer();
 }
 
 NS_IMETHODIMP
 Selection::GetFocusOffset(int32_t* aFocusOffset)
 {
   *aFocusOffset = static_cast<int32_t>(FocusOffset());
   return NS_OK;
 }
@@ -945,17 +945,17 @@ Selection::FocusOffset()
 
   return mAnchorFocusRange->StartOffset();
 }
 
 static nsresult
 CompareToRangeStart(nsINode* aCompareNode, int32_t aCompareOffset,
                     nsRange* aRange, int32_t* aCmp)
 {
-  nsINode* start = aRange->GetStartParent();
+  nsINode* start = aRange->GetStartContainer();
   NS_ENSURE_STATE(aCompareNode && start);
   // If the nodes that we're comparing are not in the same document,
   // assume that aCompareNode will fall at the end of the ranges.
   if (aCompareNode->GetComposedDoc() != start->GetComposedDoc() ||
       !start->GetComposedDoc()) {
     *aCmp = 1;
   } else {
     *aCmp = nsContentUtils::ComparePoints(aCompareNode, aCompareOffset,
@@ -1037,17 +1037,17 @@ Selection::FindInsertionPoint(
 nsresult
 Selection::SubtractRange(RangeData* aRange, nsRange* aSubtract,
                          nsTArray<RangeData>* aOutput)
 {
   nsRange* range = aRange->mRange;
 
   // First we want to compare to the range start
   int32_t cmp;
-  nsresult rv = CompareToRangeStart(range->GetStartParent(),
+  nsresult rv = CompareToRangeStart(range->GetStartContainer(),
                                     range->StartOffset(),
                                     aSubtract, &cmp);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Also, make a comparison to the range end
   int32_t cmp2;
   rv = CompareToRangeEnd(range->GetEndParent(),
                          range->EndOffset(),
@@ -1074,20 +1074,21 @@ Selection::SubtractRange(RangeData* aRan
         return NS_ERROR_OUT_OF_MEMORY;
       (*aOutput)[0].mTextRangeStyle = aRange->mTextRangeStyle;
     }
   }
 
   if (cmp < 0) {
     // We need to add a new RangeData to the output, running from
     // the start of the range to the start of aSubtract
-    RefPtr<nsRange> preOverlap = new nsRange(range->GetStartParent());
-    rv = preOverlap->SetStartAndEnd(
-                       range->GetStartParent(), range->StartOffset(),
-                       aSubtract->GetStartParent(), aSubtract->StartOffset());
+    RefPtr<nsRange> preOverlap = new nsRange(range->GetStartContainer());
+    rv = preOverlap->SetStartAndEnd(range->GetStartContainer(),
+                                    range->StartOffset(),
+                                    aSubtract->GetStartContainer(),
+                                    aSubtract->StartOffset());
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
     if (!preOverlap->Collapsed()) {
       if (!aOutput->InsertElementAt(0, RangeData(preOverlap)))
         return NS_ERROR_OUT_OF_MEMORY;
       (*aOutput)[0].mTextRangeStyle = aRange->mTextRangeStyle;
     }
@@ -1151,17 +1152,17 @@ Selection::AddItem(nsRange* aItem, int32
         // initiated event.
         bool defaultAction = true;
 
         // The spec currently doesn't say that we should dispatch this event
         // on text controls, so for now we only support doing that under a
         // pref, disabled by default.
         // See https://github.com/w3c/selection-api/issues/53.
         bool dispatchEvent = true;
-        nsCOMPtr<nsINode> target = aItem->GetStartParent();
+        nsCOMPtr<nsINode> target = aItem->GetStartContainer();
         if (nsFrameSelection::sSelectionEventsOnTextControlsEnabled) {
           // Get the first element which isn't in a native anonymous subtree
           while (target && target->IsInNativeAnonymousSubtree()) {
             target = target->GetParent();
           }
         } else {
           if (target->IsInNativeAnonymousSubtree()) {
             // This is a selection under a text control, so don't dispatch the
@@ -1227,17 +1228,17 @@ Selection::AddItemInternal(nsRange* aIte
       return NS_ERROR_OUT_OF_MEMORY;
     aItem->SetSelection(this);
 
     *aOutIndex = 0;
     return NS_OK;
   }
 
   int32_t startIndex, endIndex;
-  nsresult rv = GetIndicesForInterval(aItem->GetStartParent(),
+  nsresult rv = GetIndicesForInterval(aItem->GetStartContainer(),
                                       aItem->StartOffset(),
                                       aItem->GetEndParent(),
                                       aItem->EndOffset(), false,
                                       &startIndex, &endIndex);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (endIndex == -1) {
     // All ranges start after the given range. We can insert our range at
@@ -1247,20 +1248,20 @@ Selection::AddItemInternal(nsRange* aIte
   } else if (startIndex == -1) {
     // All ranges end before the given range. We can insert our range at
     // the end of the array, knowing there are no overlaps (handled below)
     startIndex = mRanges.Length();
     endIndex = startIndex;
   }
 
   // If the range is already contained in mRanges, silently succeed
-  bool sameRange = EqualsRangeAtPoint(aItem->GetStartParent(),
-                                        aItem->StartOffset(),
-                                        aItem->GetEndParent(),
-                                        aItem->EndOffset(), startIndex);
+  bool sameRange = EqualsRangeAtPoint(aItem->GetStartContainer(),
+                                      aItem->StartOffset(),
+                                      aItem->GetEndParent(),
+                                      aItem->EndOffset(), startIndex);
   if (sameRange) {
     *aOutIndex = startIndex;
     return NS_OK;
   }
 
   if (startIndex == endIndex) {
     // The new range doesn't overlap any existing ranges
     if (!mRanges.InsertElementAt(startIndex, RangeData(aItem)))
@@ -1294,17 +1295,17 @@ Selection::AddItemInternal(nsRange* aIte
   nsTArray<RangeData> temp;
   for (int32_t i = overlaps.Length() - 1; i >= 0; i--) {
     nsresult rv = SubtractRange(&overlaps[i], aItem, &temp);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // Insert the new element into our "leftovers" array
   int32_t insertionPoint;
-  rv = FindInsertionPoint(&temp, aItem->GetStartParent(),
+  rv = FindInsertionPoint(&temp, aItem->GetStartContainer(),
                           aItem->StartOffset(), CompareToRangeStart,
                           &insertionPoint);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!temp.InsertElementAt(insertionPoint, RangeData(aItem)))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Merge the leftovers back in to mRanges
@@ -1395,17 +1396,18 @@ Selection::GetType(int16_t* aType)
 // RangeMatches*Point
 //
 //    Compares the range beginning or ending point, and returns true if it
 //    exactly matches the given DOM point.
 
 static inline bool
 RangeMatchesBeginPoint(nsRange* aRange, nsINode* aNode, int32_t aOffset)
 {
-  return aRange->GetStartParent() == aNode && aRange->StartOffset() == aOffset;
+  return aRange->GetStartContainer() == aNode &&
+         aRange->StartOffset() == aOffset;
 }
 
 static inline bool
 RangeMatchesEndPoint(nsRange* aRange, nsINode* aNode, int32_t aOffset)
 {
   return aRange->GetEndParent() == aNode && aRange->EndOffset() == aOffset;
 }
 
@@ -1792,17 +1794,17 @@ Selection::SelectFrames(nsPresContext* a
       frame->InvalidateFrameSubtree();
     }
     return NS_OK;
   }
 
 
   // Loop through the content iterator for each content node; for each text
   // node, call SetSelected on it:
-  nsINode* startNode = aRange->GetStartParent();
+  nsINode* startNode = aRange->GetStartContainer();
   nsIContent* startContent =
     startNode->IsContent() ? startNode->AsContent() : nullptr;
   if (!startContent) {
     // Don't warn, bug 1055722
     // XXX The range can start from a document node and such range can be
     //     added to Selection with JS.  Therefore, even in such cases,
     //     shouldn't we handle selection in the range?
     return NS_ERROR_UNEXPECTED;
@@ -1933,17 +1935,17 @@ Selection::LookUpSelection(nsIContent* a
   if (overlappingRanges.Length() == 0) {
     return aDetailsHead;
   }
 
   UniquePtr<SelectionDetails> detailsHead = Move(aDetailsHead);
 
   for (uint32_t i = 0; i < overlappingRanges.Length(); i++) {
     nsRange* range = overlappingRanges[i];
-    nsINode* startNode = range->GetStartParent();
+    nsINode* startNode = range->GetStartContainer();
     nsINode* endNode = range->GetEndParent();
     int32_t startOffset = range->StartOffset();
     int32_t endOffset = range->EndOffset();
 
     int32_t start = -1, end = -1;
     if (startNode == aContent && endNode == aContent) {
       if (startOffset < (aContentOffset + aContentLength)  &&
           endOffset > aContentOffset) {
@@ -2379,17 +2381,17 @@ void
 Selection::RemoveRange(nsRange& aRange, ErrorResult& aRv)
 {
   nsresult rv = RemoveItem(&aRange);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return;
   }
 
-  nsINode* beginNode = aRange.GetStartParent();
+  nsINode* beginNode = aRange.GetStartContainer();
   nsINode* endNode = aRange.GetEndParent();
 
   if (!beginNode || !endNode) {
     // Detached range; nothing else to do here.
     return;
   }
 
   // find out the length of the end node, so we can select all of it
@@ -2616,17 +2618,17 @@ Selection::CollapseToStart(ErrorResult& 
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   if (mFrameSelection) {
     int16_t reason = mFrameSelection->PopReason() | nsISelectionListener::COLLAPSETOSTART_REASON;
     mFrameSelection->PostReason(reason);
   }
-  nsINode* parent = firstRange->GetStartParent();
+  nsINode* parent = firstRange->GetStartContainer();
   if (!parent) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
   Collapse(*parent, firstRange->StartOffset(), aRv);
 }
 
 /*
@@ -2901,17 +2903,17 @@ Selection::Extend(nsINode& aParentNode, 
 #endif
   nsINode* anchorNode = GetAnchorNode();
   nsINode* focusNode = GetFocusNode();
   uint32_t anchorOffset = AnchorOffset();
   uint32_t focusOffset = FocusOffset();
 
   RefPtr<nsRange> range = mAnchorFocusRange->CloneRange();
 
-  nsINode* startNode = range->GetStartParent();
+  nsINode* startNode = range->GetStartContainer();
   nsINode* endNode = range->GetEndParent();
   int32_t startOffset = range->StartOffset();
   int32_t endOffset = range->EndOffset();
 
   //compare anchor to old cursor.
 
   // We pass |disconnected| to the following ComparePoints calls in order
   // to avoid assertions. ComparePoints returns 1 in the disconnected case
@@ -3058,17 +3060,17 @@ Selection::Extend(nsINode& aParentNode, 
     }
 
     res = SetAnchorFocusToRange(range);
     if (NS_FAILED(res)) {
       aRv.Throw(res);
       return;
     }
     SelectFrames(presContext, difRange , false);
-    difRange->SetStart(range->GetStartParent(), range->StartOffset());
+    difRange->SetStart(range->GetStartContainer(), range->StartOffset());
     SelectFrames(presContext, difRange, true); // must reselect last node
   }
   else if (result3 >= 0 && result1 <= 0) {//2,a,1 or 2a,1 or 2,a1 or 2a1
     if (GetDirection() == eDirNext){
       range->SetEnd(startNode, startOffset);
     }
     SetDirection(eDirPrevious);
     range->SetStart(aParentNode, aOffset, aRv);
@@ -3103,17 +3105,17 @@ Selection::Extend(nsINode& aParentNode, 
   else if (result2 >= 0 && result1 >= 0) {//2,1,a or 21,a or 2,1a or 21a
     //select from 2 to 1
     range->SetStart(aParentNode, aOffset, aRv);
     if (aRv.Failed()) {
       return;
     }
     SetDirection(eDirPrevious);
     res = difRange->SetStartAndEnd(
-                      range->GetStartParent(), range->StartOffset(),
+                      range->GetStartContainer(), range->StartOffset(),
                       focusNode, focusOffset);
     if (NS_FAILED(res)) {
       aRv.Throw(res);
       return;
     }
 
     SelectFrames(presContext, difRange, true);
     res = SetAnchorFocusToRange(range);
@@ -3282,19 +3284,21 @@ Selection::ContainsPoint(const nsPoint& 
 {
   if (IsCollapsed()) {
     return false;
   }
   PointInRectChecker checker(aPoint);
   for (uint32_t i = 0; i < RangeCount(); i++) {
     nsRange* range = GetRangeAt(i);
     nsRange::CollectClientRectsAndText(&checker, nullptr, range,
-                                range->GetStartParent(), range->StartOffset(),
-                                range->GetEndParent(), range->EndOffset(),
-                                true, false);
+                                       range->GetStartContainer(),
+                                       range->StartOffset(),
+                                       range->GetEndParent(),
+                                       range->EndOffset(),
+                                       true, false);
     if (checker.MatchFound()) {
       return true;
     }
   }
   return false;
 }
 
 nsPresContext*
--- a/dom/base/nsContentIterator.cpp
+++ b/dom/base/nsContentIterator.cpp
@@ -304,17 +304,17 @@ nsContentIterator::Init(nsIDOMRange* aDO
   mCommonParent = range->GetCommonAncestor();
   if (NS_WARN_IF(!mCommonParent)) {
     return NS_ERROR_FAILURE;
   }
 
   // get the start node and offset
   int32_t startIndx = range->StartOffset();
   NS_WARNING_ASSERTION(startIndx >= 0, "bad startIndx");
-  nsINode* startNode = range->GetStartParent();
+  nsINode* startNode = range->GetStartContainer();
   if (NS_WARN_IF(!startNode)) {
     return NS_ERROR_FAILURE;
   }
 
   // get the end node and offset
   int32_t endIndx = range->EndOffset();
   NS_WARNING_ASSERTION(endIndx >= 0, "bad endIndx");
   nsINode* endNode = range->GetEndParent();
@@ -1278,17 +1278,17 @@ nsContentSubtreeIterator::Init(nsIDOMRan
   MOZ_ASSERT(aRange);
 
   mIsDone = false;
 
   mRange = static_cast<nsRange*>(aRange);
 
   // get the start node and offset, convert to nsINode
   mCommonParent = mRange->GetCommonAncestor();
-  nsINode* startParent = mRange->GetStartParent();
+  nsINode* startParent = mRange->GetStartContainer();
   int32_t startOffset = mRange->StartOffset();
   nsINode* endParent = mRange->GetEndParent();
   int32_t endOffset = mRange->EndOffset();
   MOZ_ASSERT(mCommonParent && startParent && endParent);
   // Bug 767169
   MOZ_ASSERT(uint32_t(startOffset) <= startParent->Length() &&
              uint32_t(endOffset) <= endParent->Length());
 
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7453,17 +7453,17 @@ nsContentUtils::GetSelectionInTextContro
   if (!range) {
     // Nothing selected
     aOutStartOffset = aOutEndOffset = 0;
     return;
   }
 
   // All the node pointers here are raw pointers for performance.  We shouldn't
   // be doing anything in this function that invalidates the node tree.
-  nsINode* startParent = range->GetStartParent();
+  nsINode* startParent = range->GetStartContainer();
   uint32_t startOffset = range->StartOffset();
   nsINode* endParent = range->GetEndParent();
   uint32_t endOffset = range->EndOffset();
 
   // We have at most two children, consisting of an optional text node followed
   // by an optional <br>.
   NS_ASSERTION(aRoot->GetChildCount() <= 2, "Unexpected children");
   nsIContent* firstChild = aRoot->GetFirstChild();
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -938,17 +938,17 @@ nsDocumentEncoder::SerializeRangeToStrin
   if (!aRange || aRange->Collapsed())
     return NS_OK;
 
   mCommonParent = aRange->GetCommonAncestor();
 
   if (!mCommonParent)
     return NS_OK;
 
-  nsINode* startParent = aRange->GetStartParent();
+  nsINode* startParent = aRange->GetStartContainer();
   NS_ENSURE_TRUE(startParent, NS_ERROR_FAILURE);
   int32_t startOffset = aRange->StartOffset();
 
   nsINode* endParent = aRange->GetEndParent();
   NS_ENSURE_TRUE(endParent, NS_ERROR_FAILURE);
   int32_t endOffset = aRange->EndOffset();
 
   mStartDepth = mEndDepth = 0;
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -113,17 +113,17 @@ nsRange::CompareNodeToRange(nsINode* aNo
     nodeStart = 0;
     nodeEnd = aNode->GetChildCount();
   }
   else {
     nodeStart = parent->IndexOf(aNode);
     nodeEnd = nodeStart + 1;
   }
 
-  nsINode* rangeStartParent = aRange->GetStartParent();
+  nsINode* rangeStartParent = aRange->GetStartContainer();
   nsINode* rangeEndParent = aRange->GetEndParent();
   int32_t rangeStartOffset = aRange->StartOffset();
   int32_t rangeEndOffset = aRange->EndOffset();
 
   // is RANGE(start) <= NODE(start) ?
   bool disconnected = false;
   *outNodeBefore = nsContentUtils::ComparePoints(rangeStartParent,
                                                  rangeStartOffset,
@@ -160,17 +160,17 @@ struct IsItemInRangeComparator
 {
   nsINode* mNode;
   uint32_t mStartOffset;
   uint32_t mEndOffset;
 
   int operator()(const nsRange* const aRange) const
   {
     int32_t cmp = nsContentUtils::ComparePoints(mNode, mEndOffset,
-                                                aRange->GetStartParent(),
+                                                aRange->GetStartContainer(),
                                                 aRange->StartOffset());
     if (cmp == 1) {
       cmp = nsContentUtils::ComparePoints(mNode, mStartOffset,
                                           aRange->GetEndParent(),
                                           aRange->EndOffset());
       if (cmp == -1) {
         return 0;
       }
@@ -1981,17 +1981,17 @@ ValidateCurrentNode(nsRange* aRange, Ran
   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 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->GetStartParent()) {
+      if (before && node == aRange->GetStartContainer()) {
         before = false;
       }
       if (after && node == aRange->GetEndParent()) {
         after = false;
       }
     }
   }
 
@@ -2325,23 +2325,23 @@ nsRange::CompareBoundaryPoints(uint16_t 
 
   nsINode *ourNode, *otherNode;
   int32_t ourOffset, otherOffset;
 
   switch (aHow) {
     case nsIDOMRange::START_TO_START:
       ourNode = mStartParent;
       ourOffset = mStartOffset;
-      otherNode = aOtherRange.GetStartParent();
+      otherNode = aOtherRange.GetStartContainer();
       otherOffset = aOtherRange.StartOffset();
       break;
     case nsIDOMRange::START_TO_END:
       ourNode = mEndParent;
       ourOffset = mEndOffset;
-      otherNode = aOtherRange.GetStartParent();
+      otherNode = aOtherRange.GetStartContainer();
       otherOffset = aOtherRange.StartOffset();
       break;
     case nsIDOMRange::END_TO_START:
       ourNode = mStartParent;
       ourOffset = mStartOffset;
       otherNode = aOtherRange.GetEndParent();
       otherOffset = aOtherRange.EndOffset();
       break;
--- a/dom/base/nsRange.h
+++ b/dom/base/nsRange.h
@@ -68,17 +68,17 @@ public:
   // nsIDOMRange interface
   NS_DECL_NSIDOMRANGE
 
   nsINode* GetRoot() const
   {
     return mRoot;
   }
 
-  nsINode* GetStartParent() const
+  nsINode* GetStartContainer() const
   {
     return mStartParent;
   }
 
   nsINode* GetEndParent() const
   {
     return mEndParent;
   }
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -159,17 +159,17 @@ ContentEventHandler::InitRootContent(Sel
   }
 
   // If there is a selection, we should retrieve the selection root from
   // the range since when the window is inactivated, the ancestor limiter
   // of selection was cleared by blur event handler of EditorBase but the
   // selection range still keeps storing the nodes.  If the active element of
   // the deactive window is <input> or <textarea>, we can compute the
   // selection root from them.
-  nsINode* startNode = range->GetStartParent();
+  nsINode* startNode = range->GetStartContainer();
   nsINode* endNode = range->GetEndParent();
   if (NS_WARN_IF(!startNode) || NS_WARN_IF(!endNode)) {
     return NS_ERROR_FAILURE;
   }
 
   // See bug 537041 comment 5, the range could have removed node.
   if (NS_WARN_IF(startNode->GetUncomposedDoc() != mPresShell->GetDocument())) {
     return NS_ERROR_FAILURE;
@@ -684,17 +684,17 @@ ContentEventHandler::GenerateFlatTextCon
                                              LineBreakType aLineBreakType)
 {
   MOZ_ASSERT(aString.IsEmpty());
 
   if (aRange->Collapsed()) {
     return NS_OK;
   }
 
-  nsINode* startNode = aRange->GetStartParent();
+  nsINode* startNode = aRange->GetStartContainer();
   nsINode* endNode = aRange->GetEndParent();
   if (NS_WARN_IF(!startNode) || NS_WARN_IF(!endNode)) {
     return NS_ERROR_FAILURE;
   }
 
   if (startNode == endNode && startNode->IsNodeOfType(nsINode::eTEXT)) {
     nsIContent* content = startNode->AsContent();
     AppendSubString(aString, content, aRange->StartOffset(),
@@ -858,17 +858,17 @@ ContentEventHandler::GenerateFlatFontRan
                                             LineBreakType aLineBreakType)
 {
   MOZ_ASSERT(aFontRanges.IsEmpty(), "aRanges must be empty array");
 
   if (aRange->Collapsed()) {
     return NS_OK;
   }
 
-  nsINode* startNode = aRange->GetStartParent();
+  nsINode* startNode = aRange->GetStartContainer();
   nsINode* endNode = aRange->GetEndParent();
   if (NS_WARN_IF(!startNode) || NS_WARN_IF(!endNode)) {
     return NS_ERROR_FAILURE;
   }
 
   // baseOffset is the flattened offset of each content node.
   int32_t baseOffset = 0;
   nsCOMPtr<nsIContentIterator> iter = NS_NewPreContentIterator();
@@ -1301,17 +1301,17 @@ ContentEventHandler::OnQuerySelectedText
     MOZ_ASSERT(aEvent->mInput.mSelectionType != SelectionType::eNormal);
     MOZ_ASSERT(aEvent->mReply.mOffset == WidgetQueryContentEvent::NOT_FOUND);
     MOZ_ASSERT(aEvent->mReply.mString.IsEmpty());
     MOZ_ASSERT(!aEvent->mReply.mHasSelection);
     aEvent->mSucceeded = true;
     return NS_OK;
   }
 
-  nsINode* const startNode = mFirstSelectedRange->GetStartParent();
+  nsINode* const startNode = mFirstSelectedRange->GetStartContainer();
   nsINode* const endNode = mFirstSelectedRange->GetEndParent();
 
   // Make sure the selection is within the root content range.
   if (!nsContentUtils::ContentIsDescendantOf(startNode, mRootContent) ||
       !nsContentUtils::ContentIsDescendantOf(endNode, mRootContent)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -1359,17 +1359,17 @@ ContentEventHandler::OnQuerySelectedText
       }
     } else {
       aEvent->mReply.mString.Truncate();
     }
   } else {
     NS_ASSERTION(mFirstSelectedRange->Collapsed(),
       "When mSelection doesn't have selection, mFirstSelectedRange must be "
       "collapsed");
-    anchorNode = focusNode = mFirstSelectedRange->GetStartParent();
+    anchorNode = focusNode = mFirstSelectedRange->GetStartContainer();
     if (NS_WARN_IF(!anchorNode)) {
       return NS_ERROR_FAILURE;
     }
     anchorOffset = focusOffset =
       static_cast<int32_t>(mFirstSelectedRange->StartOffset());
     if (NS_WARN_IF(anchorOffset < 0)) {
       return NS_ERROR_FAILURE;
     }
@@ -1503,17 +1503,17 @@ ContentEventHandler::GetFirstFrameInRang
     if (!node->IsContent()) {
       continue;
     }
 
     if (node->IsNodeOfType(nsINode::eTEXT)) {
       // If the range starts at the end of a text node, we need to find
       // next node which causes text.
       int32_t offsetInNode =
-        node == aRange->GetStartParent() ? aRange->StartOffset() : 0;
+        node == aRange->GetStartContainer() ? aRange->StartOffset() : 0;
       if (static_cast<uint32_t>(offsetInNode) < node->Length()) {
         nodePosition.mNode = node;
         nodePosition.mOffset = offsetInNode;
         break;
       }
       continue;
     }
 
@@ -1562,17 +1562,17 @@ ContentEventHandler::GetLastFrameInRange
   // of "d" instead of right-bottom of "c").  Therefore, this method shouldn't
   // include the last frame when its content isn't really in aRange.
   nsINode* nextNodeOfRangeEnd = nullptr;
   if (endNode->IsNodeOfType(nsINode::eTEXT)) {
     // Don't set nextNodeOfRangeEnd to the start node of aRange because if
     // endNode is same as start node of the range, the text node shouldn't be
     // next of range end even if the offset is 0.  This could occur with empty
     // text node.
-    if (!endOffset && aRange->GetStartParent() != endNode) {
+    if (!endOffset && aRange->GetStartContainer() != endNode) {
       nextNodeOfRangeEnd = endNode;
     }
   } else if (endOffset < endNode->GetChildCount()) {
     nextNodeOfRangeEnd = endNode->GetChildAt(endOffset);
   }
 
   for (iter->Last(); !iter->IsDone(); iter->Prev()) {
     nsINode* node = iter->GetCurrentNode();
@@ -1901,17 +1901,18 @@ ContentEventHandler::OnQueryTextRectArra
         RefPtr<nsRange> rangeToPrevOffset = new nsRange(mRootContent);
         rv = SetRangeFromFlatTextOffset(rangeToPrevOffset,
                                         aEvent->mInput.mOffset - 1, 1,
                                         lineBreakType, true, nullptr);
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return rv;
         }
         startsBetweenLineBreaker =
-          range->GetStartParent() == rangeToPrevOffset->GetStartParent() &&
+          range->GetStartContainer() ==
+            rangeToPrevOffset->GetStartContainer() &&
           range->StartOffset() == rangeToPrevOffset->StartOffset();
       }
     }
     // Other contents should cause a line breaker rect before it.
     // Note that moz-<br> element does not cause any text, however,
     // it represents empty line at the last of current block.  Therefore,
     // we need to compute its rect too.
     else if (ShouldBreakLineBefore(firstContent, mRootContent) ||
@@ -2835,31 +2836,31 @@ ContentEventHandler::GetFlatTextLengthIn
 nsresult
 ContentEventHandler::GetStartOffset(nsRange* aRange,
                                     uint32_t* aOffset,
                                     LineBreakType aLineBreakType)
 {
   MOZ_ASSERT(aRange);
   return GetFlatTextLengthInRange(
            NodePosition(mRootContent, 0),
-           NodePosition(aRange->GetStartParent(), aRange->StartOffset()),
+           NodePosition(aRange->GetStartContainer(), aRange->StartOffset()),
            mRootContent, aOffset, aLineBreakType);
 }
 
 nsresult
 ContentEventHandler::AdjustCollapsedRangeMaybeIntoTextNode(nsRange* aRange)
 {
   MOZ_ASSERT(aRange);
   MOZ_ASSERT(aRange->Collapsed());
 
   if (!aRange || !aRange->Collapsed()) {
     return NS_ERROR_INVALID_ARG;
   }
 
-  nsCOMPtr<nsINode> parentNode = aRange->GetStartParent();
+  nsCOMPtr<nsINode> parentNode = aRange->GetStartContainer();
   int32_t offsetInParentNode = aRange->StartOffset();
   if (NS_WARN_IF(!parentNode) || NS_WARN_IF(offsetInParentNode < 0)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   // If the node is text node, we don't need to modify aRange.
   if (parentNode->IsNodeOfType(nsINode::eTEXT)) {
     return NS_OK;
@@ -2901,17 +2902,17 @@ ContentEventHandler::GetStartFrameAndOff
                                             nsIFrame*& aFrame,
                                             int32_t& aOffsetInFrame)
 {
   MOZ_ASSERT(aRange);
 
   aFrame = nullptr;
   aOffsetInFrame = -1;
 
-  nsINode* node = aRange->GetStartParent();
+  nsINode* node = aRange->GetStartContainer();
   if (NS_WARN_IF(!node) ||
       NS_WARN_IF(!node->IsNodeOfType(nsINode::eCONTENT))) {
     return NS_ERROR_FAILURE;
   }
   nsIContent* content = static_cast<nsIContent*>(node);
   RefPtr<nsFrameSelection> fs = mPresShell->FrameSelection();
   aFrame = fs->GetFrameForNodeOffset(content, aRange->StartOffset(),
                                      fs->GetHint(), &aOffsetInFrame);
@@ -3008,17 +3009,17 @@ ContentEventHandler::OnSelectionEvent(Wi
 
   // Get range from offset and length
   RefPtr<nsRange> range = new nsRange(mRootContent);
   rv = SetRangeFromFlatTextOffset(range, aEvent->mOffset, aEvent->mLength,
                                   GetLineBreakType(aEvent),
                                   aEvent->mExpandToClusterBoundary);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsINode* startNode = range->GetStartParent();
+  nsINode* startNode = range->GetStartContainer();
   nsINode* endNode = range->GetEndParent();
   int32_t startNodeOffset = range->StartOffset();
   int32_t endNodeOffset = range->EndOffset();
   AdjustRangeForSelection(mRootContent, &startNode, &startNodeOffset);
   AdjustRangeForSelection(mRootContent, &endNode, &endNodeOffset);
   if (NS_WARN_IF(!startNode) || NS_WARN_IF(!endNode) ||
       NS_WARN_IF(startNodeOffset < 0) || NS_WARN_IF(endNodeOffset < 0)) {
     return NS_ERROR_UNEXPECTED;
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -331,21 +331,21 @@ IMEContentObserver::InitWithEditor(nsPre
                        getter_AddRefs(mSelection));
   if (NS_WARN_IF(!mSelection)) {
     return false;
   }
 
   nsCOMPtr<nsIDOMRange> selDomRange;
   if (NS_SUCCEEDED(mSelection->GetRangeAt(0, getter_AddRefs(selDomRange)))) {
     nsRange* selRange = static_cast<nsRange*>(selDomRange.get());
-    if (NS_WARN_IF(!selRange) || NS_WARN_IF(!selRange->GetStartParent())) {
+    if (NS_WARN_IF(!selRange) || NS_WARN_IF(!selRange->GetStartContainer())) {
       return false;
     }
 
-    mRootContent = selRange->GetStartParent()->
+    mRootContent = selRange->GetStartContainer()->
                      GetSelectionRootContent(presShell);
   } else {
     mRootContent = mEditableNode->GetSelectionRootContent(presShell);
   }
   if (!mRootContent && mEditableNode->IsNodeOfType(nsINode::eDOCUMENT)) {
     // The document node is editable, but there are no contents, this document
     // is not editable.
     return false;
--- a/editor/libeditor/DeleteRangeTransaction.cpp
+++ b/editor/libeditor/DeleteRangeTransaction.cpp
@@ -51,17 +51,17 @@ DeleteRangeTransaction::DoTransaction()
   // Swap mRangeToDelete out into a stack variable, so we make sure to null it
   // out on return from this function.  Once this function returns, we no longer
   // need mRangeToDelete, and keeping it alive in the long term slows down all
   // DOM mutations because it's observing them.
   RefPtr<nsRange> rangeToDelete;
   rangeToDelete.swap(mRangeToDelete);
 
   // build the child transactions
-  nsCOMPtr<nsINode> startParent = rangeToDelete->GetStartParent();
+  nsCOMPtr<nsINode> startParent = rangeToDelete->GetStartContainer();
   int32_t startOffset = rangeToDelete->StartOffset();
   nsCOMPtr<nsINode> endParent = rangeToDelete->GetEndParent();
   int32_t endOffset = rangeToDelete->EndOffset();
   MOZ_ASSERT(startParent && endParent);
 
   if (startParent == endParent) {
     // the selection begins and ends in the same node
     nsresult rv =
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2889,17 +2889,17 @@ EditorBase::SplitNodeImpl(nsIContent& aE
     } else if (!range.mSelection) {
       // For non-normal selections, skip over the non-existing ones.
       continue;
     }
 
     for (uint32_t j = 0; j < range.mSelection->RangeCount(); ++j) {
       RefPtr<nsRange> r = range.mSelection->GetRangeAt(j);
       MOZ_ASSERT(r->IsPositioned());
-      range.mStartNode = r->GetStartParent();
+      range.mStartNode = r->GetStartContainer();
       range.mStartOffset = r->StartOffset();
       range.mEndNode = r->GetEndParent();
       range.mEndOffset = r->EndOffset();
 
       savedRanges.AppendElement(range);
     }
   }
 
@@ -3036,17 +3036,17 @@ EditorBase::JoinNodesImpl(nsINode* aNode
     } else if (!range.mSelection) {
       // For non-normal selections, skip over the non-existing ones.
       continue;
     }
 
     for (uint32_t j = 0; j < range.mSelection->RangeCount(); ++j) {
       RefPtr<nsRange> r = range.mSelection->GetRangeAt(j);
       MOZ_ASSERT(r->IsPositioned());
-      range.mStartNode = r->GetStartParent();
+      range.mStartNode = r->GetStartContainer();
       range.mStartOffset = r->StartOffset();
       range.mEndNode = r->GetEndParent();
       range.mEndOffset = r->EndOffset();
 
       // If selection endpoint is between the nodes, remember it as being
       // in the one that is going away instead.  This simplifies later selection
       // adjustment logic at end of this method.
       if (range.mStartNode) {
@@ -3822,17 +3822,17 @@ EditorBase::GetStartNodeAndOffset(Select
     return NS_ERROR_FAILURE;
   }
 
   const nsRange* range = aSelection->GetRangeAt(0);
   NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
 
   NS_ENSURE_TRUE(range->IsPositioned(), NS_ERROR_FAILURE);
 
-  NS_IF_ADDREF(*aStartNode = range->GetStartParent());
+  NS_IF_ADDREF(*aStartNode = range->GetStartContainer());
   *aStartOffset = range->StartOffset();
   return NS_OK;
 }
 
 /**
  * GetEndNodeAndOffset() returns whatever the end parent & offset is of
  * the first range in the selection.
  */
@@ -4486,17 +4486,17 @@ EditorBase::CreateTxnForDeleteRange(nsRa
                                     EDirection aAction,
                                     nsINode** aRemovingNode,
                                     int32_t* aOffset,
                                     int32_t* aLength)
 {
   MOZ_ASSERT(aAction != eNone);
 
   // get the node and offset of the insertion point
-  nsCOMPtr<nsINode> node = aRangeToDelete->GetStartParent();
+  nsCOMPtr<nsINode> node = aRangeToDelete->GetStartContainer();
   if (NS_WARN_IF(!node)) {
     return nullptr;
   }
 
   int32_t offset = aRangeToDelete->StartOffset();
 
   // determine if the insertion point is at the beginning, middle, or end of
   // the node
@@ -4897,17 +4897,17 @@ EditorBase::InitializeSelection(nsIDOMEv
   // If there is composition when this is called, we may need to restore IME
   // selection because if the editor is reframed, this already forgot IME
   // selection and the transaction.
   if (mComposition && !mIMETextNode && mIMETextLength) {
     // We need to look for the new mIMETextNode from current selection.
     // XXX If selection is changed during reframe, this doesn't work well!
     nsRange* firstRange = selection->GetRangeAt(0);
     NS_ENSURE_TRUE(firstRange, NS_ERROR_FAILURE);
-    nsCOMPtr<nsINode> startNode = firstRange->GetStartParent();
+    nsCOMPtr<nsINode> startNode = firstRange->GetStartContainer();
     int32_t startOffset = firstRange->StartOffset();
     FindBetterInsertionPoint(startNode, startOffset);
     Text* textNode = startNode->GetAsText();
     MOZ_ASSERT(textNode,
                "There must be text node if mIMETextLength is larger than 0");
     if (textNode) {
       MOZ_ASSERT(textNode->Length() >= mIMETextOffset + mIMETextLength,
                  "The text node must be different from the old mIMETextNode");
@@ -5327,17 +5327,17 @@ EditorBase::GetIMESelectionStartOffsetIn
     if (!selection) {
       continue;
     }
     for (uint32_t i = 0; i < selection->RangeCount(); i++) {
       RefPtr<nsRange> range = selection->GetRangeAt(i);
       if (NS_WARN_IF(!range)) {
         continue;
       }
-      if (NS_WARN_IF(range->GetStartParent() != aTextNode)) {
+      if (NS_WARN_IF(range->GetStartContainer() != aTextNode)) {
         // ignore the start offset...
       } else {
         MOZ_ASSERT(range->StartOffset() >= 0,
                    "start offset shouldn't be negative");
         minOffset = std::min(minOffset, range->StartOffset());
       }
       if (NS_WARN_IF(range->GetEndParent() != aTextNode)) {
         // ignore the end offset...
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -345,17 +345,17 @@ HTMLEditRules::BeforeEdit(EditAction act
 
     // Get selection
     RefPtr<Selection> selection = htmlEditor->GetSelection();
 
     // Get the selection location
     if (NS_WARN_IF(!selection) || !selection->RangeCount()) {
       return NS_ERROR_UNEXPECTED;
     }
-    mRangeItem->startNode = selection->GetRangeAt(0)->GetStartParent();
+    mRangeItem->startNode = selection->GetRangeAt(0)->GetStartContainer();
     mRangeItem->startOffset = selection->GetRangeAt(0)->StartOffset();
     mRangeItem->endNode = selection->GetRangeAt(0)->GetEndParent();
     mRangeItem->endOffset = selection->GetRangeAt(0)->EndOffset();
     nsCOMPtr<nsINode> selStartNode = mRangeItem->startNode;
     nsCOMPtr<nsINode> selEndNode = mRangeItem->endNode;
 
     // Register with range updater to track this as we perturb the doc
     htmlEditor->mRangeUpdater.RegisterRangeItem(mRangeItem);
@@ -606,17 +606,17 @@ HTMLEditRules::WillDoAction(Selection* a
 
   // Nothing to do if there's no selection to act on
   if (!aSelection) {
     return NS_OK;
   }
   NS_ENSURE_TRUE(aSelection->RangeCount(), NS_OK);
 
   RefPtr<nsRange> range = aSelection->GetRangeAt(0);
-  nsCOMPtr<nsINode> selStartNode = range->GetStartParent();
+  nsCOMPtr<nsINode> selStartNode = range->GetStartContainer();
 
   NS_ENSURE_STATE(mHTMLEditor);
   if (!mHTMLEditor->IsModifiableNode(selStartNode)) {
     *aCancel = true;
     return NS_OK;
   }
 
   nsCOMPtr<nsINode> selEndNode = range->GetEndParent();
@@ -844,18 +844,19 @@ HTMLEditRules::GetAlignment(bool* aMixed
   // Get selection location
   NS_ENSURE_TRUE(htmlEditor->GetRoot(), NS_ERROR_FAILURE);
   OwningNonNull<Element> root = *htmlEditor->GetRoot();
 
   int32_t rootOffset = root->GetParentNode() ?
                        root->GetParentNode()->IndexOf(root) : -1;
 
   NS_ENSURE_STATE(selection->GetRangeAt(0) &&
-                  selection->GetRangeAt(0)->GetStartParent());
-  OwningNonNull<nsINode> parent = *selection->GetRangeAt(0)->GetStartParent();
+                  selection->GetRangeAt(0)->GetStartContainer());
+  OwningNonNull<nsINode> parent =
+    *selection->GetRangeAt(0)->GetStartContainer();
   int32_t offset = selection->GetRangeAt(0)->StartOffset();
 
   // Is the selection collapsed?
   nsCOMPtr<nsINode> nodeToExamine;
   if (selection->Collapsed() || parent->GetAsText()) {
     // If selection is collapsed, we want to look at 'parent' and its ancestors
     // for divs with alignment on them.  If we are in a text node, then that is
     // the node of interest.
@@ -1208,18 +1209,19 @@ HTMLEditRules::WillInsert(Selection& aSe
   // selection), so we ignore those types of selections.
   if (!aSelection.Collapsed()) {
     return;
   }
 
   // If we are after a mozBR in the same block, then move selection to be
   // before it
   NS_ENSURE_TRUE_VOID(aSelection.GetRangeAt(0) &&
-                      aSelection.GetRangeAt(0)->GetStartParent());
-  OwningNonNull<nsINode> selNode = *aSelection.GetRangeAt(0)->GetStartParent();
+                      aSelection.GetRangeAt(0)->GetStartContainer());
+  OwningNonNull<nsINode> selNode =
+    *aSelection.GetRangeAt(0)->GetStartContainer();
   int32_t selOffset = aSelection.GetRangeAt(0)->StartOffset();
 
   // Get prior node
   nsCOMPtr<nsIContent> priorNode = htmlEditor->GetPriorHTMLNode(selNode,
                                                                 selOffset);
   if (priorNode && TextEditUtils::IsMozBR(priorNode)) {
     nsCOMPtr<Element> block1 = htmlEditor->GetBlock(selNode);
     nsCOMPtr<Element> block2 = htmlEditor->GetBlockNodeParent(priorNode);
@@ -1286,17 +1288,17 @@ HTMLEditRules::WillInsertText(EditAction
 
   // for every property that is set, insert a new inline style node
   nsresult rv = CreateStyleForInsertText(*aSelection, *doc);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // get the (collapsed) selection location
   NS_ENSURE_STATE(mHTMLEditor);
   NS_ENSURE_STATE(aSelection->GetRangeAt(0));
-  nsCOMPtr<nsINode> selNode = aSelection->GetRangeAt(0)->GetStartParent();
+  nsCOMPtr<nsINode> selNode = aSelection->GetRangeAt(0)->GetStartContainer();
   int32_t selOffset = aSelection->GetRangeAt(0)->StartOffset();
   NS_ENSURE_STATE(selNode);
 
   // dont put text in places that can't have it
   NS_ENSURE_STATE(mHTMLEditor);
   if (!EditorBase::IsTextNode(selNode) &&
       (!mHTMLEditor || !mHTMLEditor->CanContainTag(*selNode,
                                                    *nsGkAtoms::textTagName))) {
@@ -1521,19 +1523,19 @@ HTMLEditRules::WillInsertBreak(Selection
     NS_ENSURE_SUCCESS(rv, rv);
     if (*aHandled) {
       return NS_OK;
     }
   }
 
   // Smart splitting rules
   NS_ENSURE_TRUE(aSelection.GetRangeAt(0) &&
-                 aSelection.GetRangeAt(0)->GetStartParent(),
+                 aSelection.GetRangeAt(0)->GetStartContainer(),
                  NS_ERROR_FAILURE);
-  OwningNonNull<nsINode> node = *aSelection.GetRangeAt(0)->GetStartParent();
+  OwningNonNull<nsINode> node = *aSelection.GetRangeAt(0)->GetStartContainer();
   int32_t offset = aSelection.GetRangeAt(0)->StartOffset();
 
   // Do nothing if the node is read-only
   if (!htmlEditor->IsModifiableNode(node)) {
     *aCancel = true;
     return NS_OK;
   }
 
@@ -1572,20 +1574,20 @@ HTMLEditRules::WillInsertBreak(Selection
     nsresult rv = MakeBasicBlock(aSelection,
                                  ParagraphSeparatorElement(separator));
     // We warn on failure, but don't handle it, because it might be harmless.
     // Instead we just check that a new block was actually created.
     Unused << NS_WARN_IF(NS_FAILED(rv));
 
     // Reinitialize node/offset in case they're not inside the new block
     if (NS_WARN_IF(!aSelection.GetRangeAt(0) ||
-                   !aSelection.GetRangeAt(0)->GetStartParent())) {
+                   !aSelection.GetRangeAt(0)->GetStartContainer())) {
       return NS_ERROR_FAILURE;
     }
-    node = *aSelection.GetRangeAt(0)->GetStartParent();
+    node = *aSelection.GetRangeAt(0)->GetStartContainer();
     offset = aSelection.GetRangeAt(0)->StartOffset();
 
     blockParent = mHTMLEditor->GetBlock(node);
     if (NS_WARN_IF(!blockParent)) {
       return NS_ERROR_UNEXPECTED;
     }
     if (NS_WARN_IF(blockParent == host)) {
       // Didn't create a new block for some reason, fall back to <br>
@@ -1928,17 +1930,17 @@ HTMLEditRules::WillDeleteSelection(Selec
   bool bCollapsed = aSelection->Collapsed();
   bool join = false;
   bool origCollapsed = bCollapsed;
 
   nsCOMPtr<nsINode> selNode;
   int32_t selOffset;
 
   NS_ENSURE_STATE(aSelection->GetRangeAt(0));
-  nsCOMPtr<nsINode> startNode = aSelection->GetRangeAt(0)->GetStartParent();
+  nsCOMPtr<nsINode> startNode = aSelection->GetRangeAt(0)->GetStartContainer();
   int32_t startOffset = aSelection->GetRangeAt(0)->StartOffset();
   NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
 
   if (bCollapsed) {
     // If we are inside an empty block, delete it.
     NS_ENSURE_STATE(mHTMLEditor);
     nsCOMPtr<Element> host = mHTMLEditor->GetActiveEditingHost();
     NS_ENSURE_TRUE(host, NS_ERROR_FAILURE);
@@ -1962,17 +1964,17 @@ HTMLEditRules::WillDeleteSelection(Selec
 
     // We should delete nothing.
     if (aAction == nsIEditor::eNone) {
       return NS_OK;
     }
 
     // ExtendSelectionForDelete() may have changed the selection, update it
     NS_ENSURE_STATE(aSelection->GetRangeAt(0));
-    startNode = aSelection->GetRangeAt(0)->GetStartParent();
+    startNode = aSelection->GetRangeAt(0)->GetStartContainer();
     startOffset = aSelection->GetRangeAt(0)->StartOffset();
     NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
 
     bCollapsed = aSelection->Collapsed();
   }
 
   if (bCollapsed) {
     // What's in the direction we are deleting?
@@ -2034,17 +2036,17 @@ HTMLEditRules::WillDeleteSelection(Selec
               NS_IS_HIGH_SURROGATE(text->CharAt(so - 1))) {
             so--;
           }
         }
       } else {
         RefPtr<nsRange> range = aSelection->GetRangeAt(0);
         NS_ENSURE_STATE(range);
 
-        NS_ASSERTION(range->GetStartParent() == visNode,
+        NS_ASSERTION(range->GetStartContainer() == visNode,
                      "selection start not in visNode");
         NS_ASSERTION(range->GetEndParent() == visNode,
                      "selection end not in visNode");
 
         so = range->StartOffset();
         eo = range->EndOffset();
       }
       NS_ENSURE_STATE(mHTMLEditor);
@@ -2362,17 +2364,17 @@ HTMLEditRules::WillDeleteSelection(Selec
   rv = ExpandSelectionForDeletion(*aSelection);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Remember that we did a ranged delete for the benefit of AfterEditInner().
   mDidRangedDelete = true;
 
   // Refresh start and end points
   NS_ENSURE_STATE(aSelection->GetRangeAt(0));
-  startNode = aSelection->GetRangeAt(0)->GetStartParent();
+  startNode = aSelection->GetRangeAt(0)->GetStartContainer();
   startOffset = aSelection->GetRangeAt(0)->StartOffset();
   NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
   nsCOMPtr<nsINode> endNode = aSelection->GetRangeAt(0)->GetEndParent();
   int32_t endOffset = aSelection->GetRangeAt(0)->EndOffset();
   NS_ENSURE_TRUE(endNode, NS_ERROR_FAILURE);
 
   // Figure out if the endpoints are in nodes that can be merged.  Adjust
   // surrounding whitespace in preparation to delete selection.
@@ -3221,17 +3223,17 @@ HTMLEditRules::WillMakeList(Selection* a
         NS_ENSURE_STATE(mHTMLEditor);
         rv = mHTMLEditor->DeleteNode(node);
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }
 
     // get selection location
     NS_ENSURE_STATE(aSelection->RangeCount());
-    nsCOMPtr<nsINode> parent = aSelection->GetRangeAt(0)->GetStartParent();
+    nsCOMPtr<nsINode> parent = aSelection->GetRangeAt(0)->GetStartContainer();
     int32_t offset = aSelection->GetRangeAt(0)->StartOffset();
     NS_ENSURE_STATE(parent);
 
     // make sure we can put a list here
     NS_ENSURE_STATE(mHTMLEditor);
     if (!mHTMLEditor->CanContainTag(*parent, listType)) {
       *aCancel = true;
       return NS_OK;
@@ -3566,19 +3568,19 @@ HTMLEditRules::MakeBasicBlock(Selection&
   rv = GetNodesFromSelection(aSelection, EditAction::makeBasicBlock,
                              arrayOfNodes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // If nothing visible in list, make an empty block
   if (ListIsEmptyLine(arrayOfNodes)) {
     // Get selection location
     NS_ENSURE_STATE(aSelection.GetRangeAt(0) &&
-                    aSelection.GetRangeAt(0)->GetStartParent());
+                    aSelection.GetRangeAt(0)->GetStartContainer());
     OwningNonNull<nsINode> parent =
-      *aSelection.GetRangeAt(0)->GetStartParent();
+      *aSelection.GetRangeAt(0)->GetStartContainer();
     int32_t offset = aSelection.GetRangeAt(0)->StartOffset();
 
     if (&blockType == nsGkAtoms::normal ||
         &blockType == nsGkAtoms::_empty) {
       // We are removing blocks (going to "body text")
       NS_ENSURE_TRUE(htmlEditor->GetBlock(parent), NS_ERROR_NULL_POINTER);
       OwningNonNull<Element> curBlock = *htmlEditor->GetBlock(parent);
       if (HTMLEditUtils::IsFormatNode(curBlock)) {
@@ -3663,19 +3665,19 @@ HTMLEditRules::DidMakeBasicBlock(Selecti
 {
   NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
   // check for empty block.  if so, put a moz br in it.
   if (!aSelection->Collapsed()) {
     return NS_OK;
   }
 
   NS_ENSURE_STATE(aSelection->GetRangeAt(0) &&
-                  aSelection->GetRangeAt(0)->GetStartParent());
+                  aSelection->GetRangeAt(0)->GetStartContainer());
   nsresult rv =
-    InsertMozBRIfNeeded(*aSelection->GetRangeAt(0)->GetStartParent());
+    InsertMozBRIfNeeded(*aSelection->GetRangeAt(0)->GetStartContainer());
   NS_ENSURE_SUCCESS(rv, rv);
   return NS_OK;
 }
 
 nsresult
 HTMLEditRules::WillIndent(Selection* aSelection,
                           bool* aCancel,
                           bool* aHandled)
@@ -3746,17 +3748,17 @@ HTMLEditRules::WillCSSIndent(Selection* 
     rv = GetNodesFromSelection(*aSelection, EditAction::indent, arrayOfNodes);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // if nothing visible in list, make an empty block
   if (ListIsEmptyLine(arrayOfNodes)) {
     // get selection location
     NS_ENSURE_STATE(aSelection->RangeCount());
-    nsCOMPtr<nsINode> parent = aSelection->GetRangeAt(0)->GetStartParent();
+    nsCOMPtr<nsINode> parent = aSelection->GetRangeAt(0)->GetStartContainer();
     int32_t offset = aSelection->GetRangeAt(0)->StartOffset();
     NS_ENSURE_STATE(parent);
 
     // make sure we can put a block here
     rv = SplitAsNeeded(*nsGkAtoms::div, parent, offset);
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ENSURE_STATE(mHTMLEditor);
     nsCOMPtr<Element> theBlock = mHTMLEditor->CreateNode(nsGkAtoms::div,
@@ -3933,17 +3935,17 @@ HTMLEditRules::WillHTMLIndent(Selection*
   nsTArray<OwningNonNull<nsINode>> arrayOfNodes;
   rv = GetNodesForOperation(arrayOfRanges, arrayOfNodes, EditAction::indent);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // if nothing visible in list, make an empty block
   if (ListIsEmptyLine(arrayOfNodes)) {
     // get selection location
     NS_ENSURE_STATE(aSelection->RangeCount());
-    nsCOMPtr<nsINode> parent = aSelection->GetRangeAt(0)->GetStartParent();
+    nsCOMPtr<nsINode> parent = aSelection->GetRangeAt(0)->GetStartContainer();
     int32_t offset = aSelection->GetRangeAt(0)->StartOffset();
     NS_ENSURE_STATE(parent);
 
     // make sure we can put a block here
     rv = SplitAsNeeded(*nsGkAtoms::blockquote, parent, offset);
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ENSURE_STATE(mHTMLEditor);
     nsCOMPtr<Element> theBlock = mHTMLEditor->CreateNode(nsGkAtoms::blockquote,
@@ -4354,28 +4356,29 @@ HTMLEditRules::WillOutdent(Selection& aS
     }
   }
   // Make sure selection didn't stick to last piece of content in old bq (only
   // a problem for collapsed selections)
   if (rememberedLeftBQ || rememberedRightBQ) {
     if (aSelection.Collapsed()) {
       // Push selection past end of rememberedLeftBQ
       NS_ENSURE_TRUE(aSelection.GetRangeAt(0), NS_OK);
-      nsCOMPtr<nsINode> startNode = aSelection.GetRangeAt(0)->GetStartParent();
+      nsCOMPtr<nsINode> startNode =
+        aSelection.GetRangeAt(0)->GetStartContainer();
       int32_t startOffset = aSelection.GetRangeAt(0)->StartOffset();
       if (rememberedLeftBQ &&
           (startNode == rememberedLeftBQ ||
            EditorUtils::IsDescendantOf(startNode, rememberedLeftBQ))) {
         // Selection is inside rememberedLeftBQ - push it past it.
         startNode = rememberedLeftBQ->GetParentNode();
         startOffset = startNode ? 1 + startNode->IndexOf(rememberedLeftBQ) : 0;
         aSelection.Collapse(startNode, startOffset);
       }
       // And pull selection before beginning of rememberedRightBQ
-      startNode = aSelection.GetRangeAt(0)->GetStartParent();
+      startNode = aSelection.GetRangeAt(0)->GetStartContainer();
       startOffset = aSelection.GetRangeAt(0)->StartOffset();
       if (rememberedRightBQ &&
           (startNode == rememberedRightBQ ||
            EditorUtils::IsDescendantOf(startNode, rememberedRightBQ))) {
         // Selection is inside rememberedRightBQ - push it before it.
         startNode = rememberedRightBQ->GetParentNode();
         startOffset = startNode ? startNode->IndexOf(rememberedRightBQ) : -1;
         aSelection.Collapse(startNode, startOffset);
@@ -4533,17 +4536,17 @@ HTMLEditRules::ConvertListType(Element* 
 nsresult
 HTMLEditRules::CreateStyleForInsertText(Selection& aSelection,
                                         nsIDocument& aDoc)
 {
   MOZ_ASSERT(mHTMLEditor->mTypeInState);
 
   bool weDidSomething = false;
   NS_ENSURE_STATE(aSelection.GetRangeAt(0));
-  nsCOMPtr<nsINode> node = aSelection.GetRangeAt(0)->GetStartParent();
+  nsCOMPtr<nsINode> node = aSelection.GetRangeAt(0)->GetStartContainer();
   int32_t offset = aSelection.GetRangeAt(0)->StartOffset();
 
   // next examine our present style and make sure default styles are either
   // present or explicitly overridden.  If neither, add the default style to
   // the TypeInState
   int32_t length = mHTMLEditor->mDefaultStyles.Length();
   for (int32_t j = 0; j < length; j++) {
     PropItem* propItem = mHTMLEditor->mDefaultStyles[j];
@@ -4719,27 +4722,27 @@ HTMLEditRules::WillAlign(Selection& aSel
       //
       // XXX: It seems a little error prone for the emptyDiv special case code
       // to assume that the start node of the selection is the parent of the
       // single node in the nodeArray, as the paragraph above points out. Do we
       // rely on the selection start node because of the fact that nodeArray
       // can be empty?  We should probably revisit this issue. - kin
 
       NS_ENSURE_STATE(aSelection.GetRangeAt(0) &&
-                      aSelection.GetRangeAt(0)->GetStartParent());
+                      aSelection.GetRangeAt(0)->GetStartContainer());
       OwningNonNull<nsINode> parent =
-        *aSelection.GetRangeAt(0)->GetStartParent();
+        *aSelection.GetRangeAt(0)->GetStartContainer();
 
       emptyDiv = !HTMLEditUtils::IsTableElement(parent) ||
                  HTMLEditUtils::IsTableCellOrCaption(parent);
     }
   }
   if (emptyDiv) {
     nsCOMPtr<nsINode> parent =
-      aSelection.GetRangeAt(0) ? aSelection.GetRangeAt(0)->GetStartParent()
+      aSelection.GetRangeAt(0) ? aSelection.GetRangeAt(0)->GetStartContainer()
                                : nullptr;
     NS_ENSURE_STATE(parent);
     int32_t offset = aSelection.GetRangeAt(0)->StartOffset();
 
     rv = SplitAsNeeded(*nsGkAtoms::div, parent, offset);
     NS_ENSURE_SUCCESS(rv, rv);
     // Consume a trailing br, if any.  This is to keep an alignment from
     // creating extra lines, if possible.
@@ -5163,17 +5166,17 @@ HTMLEditRules::ExpandSelectionForDeletio
   if (aSelection.RangeCount() != 1) {
     return NS_OK;
   }
 
   // Find current sel start and end
   NS_ENSURE_TRUE(aSelection.GetRangeAt(0), NS_ERROR_NULL_POINTER);
   OwningNonNull<nsRange> range = *aSelection.GetRangeAt(0);
 
-  nsCOMPtr<nsINode> selStartNode = range->GetStartParent();
+  nsCOMPtr<nsINode> selStartNode = range->GetStartContainer();
   int32_t selStartOffset = range->StartOffset();
   nsCOMPtr<nsINode> selEndNode = range->GetEndParent();
   int32_t selEndOffset = range->EndOffset();
 
   // Find current selection common block parent
   nsCOMPtr<Element> selCommon =
     HTMLEditor::GetBlock(*range->GetCommonAncestor());
   NS_ENSURE_STATE(selCommon);
@@ -5665,17 +5668,17 @@ HTMLEditRules::PromoteRange(nsRange& aRa
 {
   NS_ENSURE_TRUE(mHTMLEditor, );
   RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
 
   if (!aRange.IsPositioned()) {
     return;
   }
 
-  nsCOMPtr<nsINode> startNode = aRange.GetStartParent();
+  nsCOMPtr<nsINode> startNode = aRange.GetStartContainer();
   nsCOMPtr<nsINode> endNode = aRange.GetEndParent();
   int32_t startOffset = aRange.StartOffset();
   int32_t endOffset = aRange.EndOffset();
 
   // MOOSE major hack:
   // GetPromotedPoint doesn't really do the right thing for collapsed ranges
   // inside block elements that contain nothing but a solo <br>.  It's easier
   // to put a workaround here than to revamp GetPromotedPoint.  :-(
@@ -7271,17 +7274,17 @@ HTMLEditRules::ReapplyCachedStyles()
     // selection.
     return NS_OK;
   }
   if (!selection->RangeCount()) {
     // Nothing to do
     return NS_OK;
   }
   nsCOMPtr<nsIContent> selNode =
-    do_QueryInterface(selection->GetRangeAt(0)->GetStartParent());
+    do_QueryInterface(selection->GetRangeAt(0)->GetStartContainer());
   if (!selNode) {
     // Nothing to do
     return NS_OK;
   }
 
   StyleCache styleAtInsertionPoint[SIZE_STYLE_TABLE];
   InitStyleCacheArray(styleAtInsertionPoint);
   nsCOMPtr<nsIDOMNode> selDOMNode = do_QueryInterface(selNode);
@@ -7458,18 +7461,19 @@ HTMLEditRules::CheckInterlinePosition(Se
     return;
   }
 
   NS_ENSURE_TRUE_VOID(mHTMLEditor);
   RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
 
   // Get the (collapsed) selection location
   NS_ENSURE_TRUE_VOID(aSelection.GetRangeAt(0) &&
-                      aSelection.GetRangeAt(0)->GetStartParent());
-  OwningNonNull<nsINode> selNode = *aSelection.GetRangeAt(0)->GetStartParent();
+                      aSelection.GetRangeAt(0)->GetStartContainer());
+  OwningNonNull<nsINode> selNode =
+    *aSelection.GetRangeAt(0)->GetStartContainer();
   int32_t selOffset = aSelection.GetRangeAt(0)->StartOffset();
 
   // First, let's check to see if we are after a <br>.  We take care of this
   // special-case first so that we don't accidentally fall through into one of
   // the other conditionals.
   nsCOMPtr<nsIContent> node =
     htmlEditor->GetPriorHTMLNode(selNode, selOffset, true);
   if (node && node->IsHTMLElement(nsGkAtoms::br)) {
@@ -8721,19 +8725,19 @@ HTMLEditRules::WillAbsolutePosition(Sele
   rv = GetNodesForOperation(arrayOfRanges, arrayOfNodes,
                             EditAction::setAbsolutePosition);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // If nothing visible in list, make an empty block
   if (ListIsEmptyLine(arrayOfNodes)) {
     // Get selection location
     NS_ENSURE_STATE(aSelection.GetRangeAt(0) &&
-                    aSelection.GetRangeAt(0)->GetStartParent());
+                    aSelection.GetRangeAt(0)->GetStartContainer());
     OwningNonNull<nsINode> parent =
-      *aSelection.GetRangeAt(0)->GetStartParent();
+      *aSelection.GetRangeAt(0)->GetStartContainer();
     int32_t offset = aSelection.GetRangeAt(0)->StartOffset();
 
     // Make sure we can put a block here
     rv = SplitAsNeeded(*nsGkAtoms::div, parent, offset);
     NS_ENSURE_SUCCESS(rv, rv);
     nsCOMPtr<Element> positionedDiv =
       htmlEditor->CreateNode(nsGkAtoms::div, parent, offset);
     NS_ENSURE_STATE(positionedDiv);
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -639,17 +639,17 @@ HTMLEditor::HandleKeyPressEvent(WidgetKe
       if (aKeyboardEvent->IsControl() || aKeyboardEvent->IsAlt() ||
           aKeyboardEvent->IsMeta() || aKeyboardEvent->IsOS()) {
         return NS_OK;
       }
 
       RefPtr<Selection> selection = GetSelection();
       NS_ENSURE_TRUE(selection && selection->RangeCount(), NS_ERROR_FAILURE);
 
-      nsCOMPtr<nsINode> node = selection->GetRangeAt(0)->GetStartParent();
+      nsCOMPtr<nsINode> node = selection->GetRangeAt(0)->GetStartContainer();
       MOZ_ASSERT(node);
 
       nsCOMPtr<Element> blockParent = GetBlock(*node);
 
       if (!blockParent) {
         break;
       }
 
@@ -1794,17 +1794,17 @@ HTMLEditor::GetCSSBackgroundColorState(b
   // the default background color is transparent
   aOutColor.AssignLiteral("transparent");
 
   // get selection
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_STATE(selection && selection->GetRangeAt(0));
 
   // get selection location
-  nsCOMPtr<nsINode> parent = selection->GetRangeAt(0)->GetStartParent();
+  nsCOMPtr<nsINode> parent = selection->GetRangeAt(0)->GetStartContainer();
   int32_t offset = selection->GetRangeAt(0)->StartOffset();
   NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
 
   // is the selection collapsed?
   nsCOMPtr<nsINode> nodeToExamine;
   if (selection->Collapsed() || IsTextNode(parent)) {
     // we want to look at the parent and ancestors
     nodeToExamine = parent;
@@ -2006,21 +2006,21 @@ HTMLEditor::MakeOrChangeList(const nsASt
     return rv;
   }
 
   if (!handled) {
     // Find out if the selection is collapsed:
     bool isCollapsed = selection->Collapsed();
 
     NS_ENSURE_TRUE(selection->GetRangeAt(0) &&
-                   selection->GetRangeAt(0)->GetStartParent() &&
-                   selection->GetRangeAt(0)->GetStartParent()->IsContent(),
+                   selection->GetRangeAt(0)->GetStartContainer() &&
+                   selection->GetRangeAt(0)->GetStartContainer()->IsContent(),
                    NS_ERROR_FAILURE);
     OwningNonNull<nsIContent> node =
-      *selection->GetRangeAt(0)->GetStartParent()->AsContent();
+      *selection->GetRangeAt(0)->GetStartContainer()->AsContent();
     int32_t offset = selection->GetRangeAt(0)->StartOffset();
 
     if (isCollapsed) {
       // have to find a place to put the list
       nsCOMPtr<nsIContent> parent = node;
       nsCOMPtr<nsIContent> topChild = node;
 
       nsCOMPtr<nsIAtom> listAtom = NS_Atomize(aListType);
@@ -2143,21 +2143,21 @@ HTMLEditor::InsertBasicBlock(const nsASt
     return rv;
   }
 
   if (!handled) {
     // Find out if the selection is collapsed:
     bool isCollapsed = selection->Collapsed();
 
     NS_ENSURE_TRUE(selection->GetRangeAt(0) &&
-                   selection->GetRangeAt(0)->GetStartParent() &&
-                   selection->GetRangeAt(0)->GetStartParent()->IsContent(),
+                   selection->GetRangeAt(0)->GetStartContainer() &&
+                   selection->GetRangeAt(0)->GetStartContainer()->IsContent(),
                    NS_ERROR_FAILURE);
     OwningNonNull<nsIContent> node =
-      *selection->GetRangeAt(0)->GetStartParent()->AsContent();
+      *selection->GetRangeAt(0)->GetStartContainer()->AsContent();
     int32_t offset = selection->GetRangeAt(0)->StartOffset();
 
     if (isCollapsed) {
       // have to find a place to put the block
       nsCOMPtr<nsIContent> parent = node;
       nsCOMPtr<nsIContent> topChild = node;
 
       nsCOMPtr<nsIAtom> blockAtom = NS_Atomize(aBlockType);
@@ -2214,21 +2214,21 @@ HTMLEditor::Indent(const nsAString& aInd
     return rv;
   }
 
   if (!handled) {
     // Do default - insert a blockquote node if selection collapsed
     bool isCollapsed = selection->Collapsed();
 
     NS_ENSURE_TRUE(selection->GetRangeAt(0) &&
-                   selection->GetRangeAt(0)->GetStartParent() &&
-                   selection->GetRangeAt(0)->GetStartParent()->IsContent(),
+                   selection->GetRangeAt(0)->GetStartContainer() &&
+                   selection->GetRangeAt(0)->GetStartContainer()->IsContent(),
                    NS_ERROR_FAILURE);
     OwningNonNull<nsIContent> node =
-      *selection->GetRangeAt(0)->GetStartParent()->AsContent();
+      *selection->GetRangeAt(0)->GetStartContainer()->AsContent();
     int32_t offset = selection->GetRangeAt(0)->StartOffset();
 
     if (aIndent.EqualsLiteral("indent")) {
       if (isCollapsed) {
         // have to find a place to put the blockquote
         nsCOMPtr<nsIContent> parent = node;
         nsCOMPtr<nsIContent> topChild = node;
         while (!CanContainTag(*parent, *nsGkAtoms::blockquote)) {
@@ -2248,17 +2248,18 @@ HTMLEditor::Indent(const nsAString& aInd
         NS_ENSURE_STATE(newBQ);
         // put a space in it so layout will draw the list item
         rv = selection->Collapse(newBQ, 0);
         NS_ENSURE_SUCCESS(rv, rv);
         rv = InsertText(NS_LITERAL_STRING(" "));
         NS_ENSURE_SUCCESS(rv, rv);
         // reposition selection to before the space character
         NS_ENSURE_STATE(selection->GetRangeAt(0));
-        rv = selection->Collapse(selection->GetRangeAt(0)->GetStartParent(), 0);
+        rv = selection->Collapse(selection->GetRangeAt(0)->GetStartContainer(),
+                                 0);
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }
   }
   return rules->DidDoAction(selection, &ruleInfo, rv);
 }
 
 //TODO: IMPLEMENT ALIGNMENT!
@@ -4567,17 +4568,17 @@ HTMLEditor::SetCSSBackgroundColor(const 
     // Loop through the ranges in the selection
     for (uint32_t i = 0; i < selection->RangeCount(); i++) {
       RefPtr<nsRange> range = selection->GetRangeAt(i);
       NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
 
       nsCOMPtr<Element> cachedBlockParent;
 
       // Check for easy case: both range endpoints in same text node
-      nsCOMPtr<nsINode> startNode = range->GetStartParent();
+      nsCOMPtr<nsINode> startNode = range->GetStartContainer();
       int32_t startOffset = range->StartOffset();
       nsCOMPtr<nsINode> endNode = range->GetEndParent();
       int32_t endOffset = range->EndOffset();
       if (startNode == endNode && IsTextNode(startNode)) {
         // Let's find the block container of the text node
         nsCOMPtr<Element> blockParent = GetBlockNodeParent(startNode);
         // And apply the background color to that block container
         if (blockParent && cachedBlockParent != blockParent) {
@@ -4859,17 +4860,17 @@ HTMLEditor::GetSelectionContainer()
   if (selection->Collapsed()) {
     focusNode = selection->GetFocusNode();
   } else {
     int32_t rangeCount = selection->RangeCount();
 
     if (rangeCount == 1) {
       RefPtr<nsRange> range = selection->GetRangeAt(0);
 
-      nsCOMPtr<nsINode> startContainer = range->GetStartParent();
+      nsCOMPtr<nsINode> startContainer = range->GetStartContainer();
       int32_t startOffset = range->StartOffset();
       nsCOMPtr<nsINode> endContainer = range->GetEndParent();
       int32_t endOffset = range->EndOffset();
 
       if (startContainer == endContainer && startOffset + 1 == endOffset) {
         nsCOMPtr<nsIDOMElement> focusElement;
         nsresult rv = GetSelectedElement(EmptyString(),
                                          getter_AddRefs(focusElement));
@@ -4880,17 +4881,17 @@ HTMLEditor::GetSelectionContainer()
       }
       if (!focusNode) {
         focusNode = range->GetCommonAncestor();
       }
     } else {
       for (int32_t i = 0; i < rangeCount; i++) {
         RefPtr<nsRange> range = selection->GetRangeAt(i);
 
-        nsCOMPtr<nsINode> startContainer = range->GetStartParent();
+        nsCOMPtr<nsINode> startContainer = range->GetStartContainer();
         if (!focusNode) {
           focusNode = startContainer;
         } else if (focusNode != startContainer) {
           focusNode = startContainer->GetParentNode();
           break;
         }
       }
     }
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -138,17 +138,17 @@ HTMLEditor::SetInlineProperty(nsIAtom* a
     AutoRangeArray arrayOfRanges(selection);
     for (auto& range : arrayOfRanges.mRanges) {
       // Adjust range to include any ancestors whose children are entirely
       // selected
       rv = PromoteInlineRange(*range);
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Check for easy case: both range endpoints in same text node
-      nsCOMPtr<nsINode> startNode = range->GetStartParent();
+      nsCOMPtr<nsINode> startNode = range->GetStartContainer();
       nsCOMPtr<nsINode> endNode = range->GetEndParent();
       if (startNode && startNode == endNode && startNode->GetAsText()) {
         rv = SetInlinePropertyOnTextNode(*startNode->GetAsText(),
                                          range->StartOffset(),
                                          range->EndOffset(),
                                          *aProperty, &aAttribute, aValue);
         NS_ENSURE_SUCCESS(rv, rv);
         continue;
@@ -505,17 +505,17 @@ HTMLEditor::SetInlinePropertyOnNode(nsIC
 
 nsresult
 HTMLEditor::SplitStyleAboveRange(nsRange* inRange,
                                  nsIAtom* aProperty,
                                  const nsAString* aAttribute)
 {
   NS_ENSURE_TRUE(inRange, NS_ERROR_NULL_POINTER);
 
-  nsCOMPtr<nsINode> startNode = inRange->GetStartParent();
+  nsCOMPtr<nsINode> startNode = inRange->GetStartContainer();
   int32_t startOffset = inRange->StartOffset();
   nsCOMPtr<nsINode> endNode = inRange->GetEndParent();
   int32_t endOffset = inRange->EndOffset();
 
   nsCOMPtr<nsINode> origStartNode = startNode;
 
   // split any matching style nodes above the start of range
   {
@@ -847,17 +847,17 @@ HTMLEditor::IsOnlyAttribute(const nsICon
   // other than aAttribute, then return true
   return true;
 }
 
 nsresult
 HTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange& aRange)
 {
   // We assume that <a> is not nested.
-  nsCOMPtr<nsINode> startNode = aRange.GetStartParent();
+  nsCOMPtr<nsINode> startNode = aRange.GetStartContainer();
   int32_t startOffset = aRange.StartOffset();
   nsCOMPtr<nsINode> endNode = aRange.GetEndParent();
   int32_t endOffset = aRange.EndOffset();
 
   nsCOMPtr<nsINode> parent = startNode;
 
   while (parent && !parent->IsHTMLElement(nsGkAtoms::body) &&
          !HTMLEditUtils::IsNamedAnchor(parent)) {
@@ -889,17 +889,17 @@ HTMLEditor::PromoteRangeIfStartsOrEndsIn
   }
 
   return NS_OK;
 }
 
 nsresult
 HTMLEditor::PromoteInlineRange(nsRange& aRange)
 {
-  nsCOMPtr<nsINode> startNode = aRange.GetStartParent();
+  nsCOMPtr<nsINode> startNode = aRange.GetStartContainer();
   int32_t startOffset = aRange.StartOffset();
   nsCOMPtr<nsINode> endNode = aRange.GetEndParent();
   int32_t endOffset = aRange.EndOffset();
 
   while (startNode && !startNode->IsHTMLElement(nsGkAtoms::body) &&
          IsEditable(startNode) && IsAtFrontOfNode(*startNode, startOffset)) {
     nsCOMPtr<nsINode> parent = startNode->GetParentNode();
     NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
@@ -988,17 +988,17 @@ HTMLEditor::GetInlinePropertyBase(nsIAto
   RefPtr<nsRange> range = selection->GetRangeAt(0);
   // XXX: Should be a while loop, to get each separate range
   // XXX: ERROR_HANDLING can currentItem be null?
   if (range) {
     // For each range, set a flag
     bool firstNodeInRange = true;
 
     if (isCollapsed) {
-      nsCOMPtr<nsINode> collapsedNode = range->GetStartParent();
+      nsCOMPtr<nsINode> collapsedNode = range->GetStartContainer();
       NS_ENSURE_TRUE(collapsedNode, NS_ERROR_FAILURE);
       bool isSet, theSetting;
       nsString tOutString;
       if (aAttribute) {
         nsString tString(*aAttribute);
         mTypeInState->GetTypingState(isSet, theSetting, &aProperty, tString,
                                      &tOutString);
         if (outValue) {
@@ -1259,17 +1259,17 @@ HTMLEditor::RemoveInlinePropertyImpl(nsI
       }
 
       // Remove this style from ancestors of our range endpoints, splitting
       // them as appropriate
       rv = SplitStyleAboveRange(range, aProperty, aAttribute);
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Check for easy case: both range endpoints in same text node
-      nsCOMPtr<nsINode> startNode = range->GetStartParent();
+      nsCOMPtr<nsINode> startNode = range->GetStartContainer();
       nsCOMPtr<nsINode> endNode = range->GetEndParent();
       if (startNode && startNode == endNode && startNode->GetAsText()) {
         // We're done with this range!
         if (IsCSSEnabled() &&
             mCSSEditUtils->IsCSSEditableProperty(startNode, aProperty,
                                                  aAttribute)) {
           // The HTML style defined by aProperty/aAttribute has a CSS
           // equivalence in this implementation for startNode
@@ -1358,19 +1358,19 @@ HTMLEditor::RelativeFontChange(FontSize 
   NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
   // If selection is collapsed, set typing state
   if (selection->Collapsed()) {
     nsIAtom& atom = aDir == FontSize::incr ? *nsGkAtoms::big :
                                              *nsGkAtoms::small;
 
     // Let's see in what kind of element the selection is
     NS_ENSURE_TRUE(selection->RangeCount() &&
-                   selection->GetRangeAt(0)->GetStartParent(), NS_OK);
+                   selection->GetRangeAt(0)->GetStartContainer(), NS_OK);
     OwningNonNull<nsINode> selectedNode =
-      *selection->GetRangeAt(0)->GetStartParent();
+      *selection->GetRangeAt(0)->GetStartContainer();
     if (IsTextNode(selectedNode)) {
       NS_ENSURE_TRUE(selectedNode->GetParentNode(), NS_OK);
       selectedNode = *selectedNode->GetParentNode();
     }
     if (!CanContainTag(selectedNode, atom)) {
       return NS_OK;
     }
 
@@ -1390,17 +1390,17 @@ HTMLEditor::RelativeFontChange(FontSize 
   // Loop through the ranges in the selection
   AutoRangeArray arrayOfRanges(selection);
   for (auto& range : arrayOfRanges.mRanges) {
     // Adjust range to include any ancestors with entirely selected children
     nsresult rv = PromoteInlineRange(*range);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Check for easy case: both range endpoints in same text node
-    nsCOMPtr<nsINode> startNode = range->GetStartParent();
+    nsCOMPtr<nsINode> startNode = range->GetStartContainer();
     nsCOMPtr<nsINode> endNode = range->GetEndParent();
     if (startNode == endNode && IsTextNode(startNode)) {
       rv = RelativeFontChangeOnTextNode(aDir, *startNode->GetAsText(),
                                         range->StartOffset(),
                                         range->EndOffset());
       NS_ENSURE_SUCCESS(rv, rv);
     } else {
       // Not the easy case.  Range not contained in single text node.  There
--- a/editor/libeditor/SelectionState.cpp
+++ b/editor/libeditor/SelectionState.cpp
@@ -648,17 +648,17 @@ RangeItem::~RangeItem()
 NS_IMPL_CYCLE_COLLECTION(RangeItem, startNode, endNode)
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(RangeItem, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(RangeItem, Release)
 
 void
 RangeItem::StoreRange(nsRange* aRange)
 {
   MOZ_ASSERT(aRange);
-  startNode = aRange->GetStartParent();
+  startNode = aRange->GetStartContainer();
   startOffset = aRange->StartOffset();
   endNode = aRange->GetEndParent();
   endOffset = aRange->EndOffset();
 }
 
 already_AddRefed<nsRange>
 RangeItem::GetRange()
 {
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -747,17 +747,17 @@ TextEditRules::WillInsertText(EditAction
                                nsITimer::TYPE_ONE_SHOT);
     } else {
       FillBufWithPWChars(outString, outString->Length());
     }
   }
 
   // get the (collapsed) selection location
   NS_ENSURE_STATE(aSelection->GetRangeAt(0));
-  nsCOMPtr<nsINode> selNode = aSelection->GetRangeAt(0)->GetStartParent();
+  nsCOMPtr<nsINode> selNode = aSelection->GetRangeAt(0)->GetStartContainer();
   int32_t selOffset = aSelection->GetRangeAt(0)->StartOffset();
   NS_ENSURE_STATE(selNode);
 
   // don't put text in places that can't have it
   NS_ENSURE_STATE(mTextEditor);
   if (!EditorBase::IsTextNode(selNode) &&
       !mTextEditor->CanContainTag(*selNode, *nsGkAtoms::textTagName)) {
     return NS_ERROR_FAILURE;
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -709,17 +709,17 @@ TextEditor::InsertLineBreak()
   TextRulesInfo ruleInfo(EditAction::insertBreak);
   ruleInfo.maxLength = mMaxTextLength;
   bool cancel, handled;
   nsresult rv = rules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!cancel && !handled) {
     // get the (collapsed) selection location
     NS_ENSURE_STATE(selection->GetRangeAt(0));
-    nsCOMPtr<nsINode> selNode = selection->GetRangeAt(0)->GetStartParent();
+    nsCOMPtr<nsINode> selNode = selection->GetRangeAt(0)->GetStartContainer();
     int32_t selOffset = selection->GetRangeAt(0)->StartOffset();
     NS_ENSURE_STATE(selNode);
 
     // don't put text in places that can't have it
     if (!IsTextNode(selNode) && !CanContainTag(*selNode,
                                                *nsGkAtoms::textTagName)) {
       return NS_ERROR_FAILURE;
     }
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -1477,17 +1477,17 @@ nsresult mozInlineSpellChecker::DoSpellC
   // range inclusion later (we have no ranges when we are initially checking or
   // when there are no misspelled words yet).
   int32_t originalRangeCount = aSpellCheckSelection->RangeCount();
 
   // set the starting DOM position to be the beginning of our range
   {
     // Scope for the node/offset pairs here so they don't get
     // accidentally used later
-    nsINode* beginNode = aStatus->mRange->GetStartParent();
+    nsINode* beginNode = aStatus->mRange->GetStartContainer();
     int32_t beginOffset = aStatus->mRange->StartOffset();
     nsINode* endNode = aStatus->mRange->GetEndParent();
     int32_t endOffset = aStatus->mRange->EndOffset();
 
     // Now check that we're still looking at a range that's under
     // aWordUtil.GetRootNode()
     nsINode* rootNode = aWordUtil.GetRootNode();
     if (!nsContentUtils::ContentIsDescendantOf(beginNode, rootNode) ||
--- a/layout/base/AccessibleCaretManager.cpp
+++ b/layout/base/AccessibleCaretManager.cpp
@@ -1050,24 +1050,24 @@ AccessibleCaretManager::GetFrameForFirst
   int32_t nodeOffset = 0;
   CaretAssociationHint hint;
 
   RefPtr<Selection> selection = GetSelection();
   bool findInFirstRangeStart = aDirection == eDirNext;
 
   if (findInFirstRangeStart) {
     range = selection->GetRangeAt(0);
-    startNode = range->GetStartParent();
+    startNode = range->GetStartContainer();
     endNode = range->GetEndParent();
     nodeOffset = range->StartOffset();
     hint = CARET_ASSOCIATE_AFTER;
   } else {
     range = selection->GetRangeAt(selection->RangeCount() - 1);
     startNode = range->GetEndParent();
-    endNode = range->GetStartParent();
+    endNode = range->GetStartContainer();
     nodeOffset = range->EndOffset();
     hint = CARET_ASSOCIATE_BEFORE;
   }
 
   nsCOMPtr<nsIContent> startContent = do_QueryInterface(startNode);
   RefPtr<nsFrameSelection> fs = GetFrameSelection();
   nsIFrame* startFrame =
     fs->GetFrameForNodeOffset(startContent, nodeOffset, hint, aOutOffset);
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -4781,17 +4781,17 @@ PresShell::ClipListToRange(nsDisplayList
   nsDisplayItem* i;
   while ((i = aList->RemoveBottom())) {
     // itemToInsert indiciates the item that should be inserted into the
     // temporary list. If null, no item should be inserted.
     nsDisplayItem* itemToInsert = nullptr;
     nsIFrame* frame = i->Frame();
     nsIContent* content = frame->GetContent();
     if (content) {
-      bool atStart = (content == aRange->GetStartParent());
+      bool atStart = (content == aRange->GetStartContainer());
       bool atEnd = (content == aRange->GetEndParent());
       if ((atStart || atEnd) && frame->IsTextFrame()) {
         int32_t frameStartOffset, frameEndOffset;
         frame->GetOffsets(frameStartOffset, frameEndOffset);
 
         int32_t hilightStart =
           atStart ? std::max(aRange->StartOffset(), frameStartOffset) : frameStartOffset;
         int32_t hilightEnd =
@@ -4825,17 +4825,17 @@ PresShell::ClipListToRange(nsDisplayList
           i->IntersectClip(aBuilder, &newClipChain);
           itemToInsert = i;
         }
       }
       // Don't try to descend into subdocuments.
       // If this ever changes we'd need to add handling for subdocuments with
       // different zoom levels.
       else if (content->GetUncomposedDoc() ==
-                 aRange->GetStartParent()->GetUncomposedDoc()) {
+                 aRange->GetStartContainer()->GetUncomposedDoc()) {
         // if the node is within the range, append it to the temporary list
         bool before, after;
         nsresult rv =
           nsRange::CompareNodeToRange(content, aRange, &before, &after);
         if (NS_SUCCEEDED(rv) && !before && !after) {
           itemToInsert = i;
           bool snap;
           surfaceRect.UnionRect(surfaceRect, i->GetBounds(aBuilder, &snap));
@@ -4878,17 +4878,17 @@ PresShell::CreateRangePaintInfo(nsIDOMRa
 {
   nsRange* range = static_cast<nsRange*>(aRange);
   nsIFrame* ancestorFrame;
   nsIFrame* rootFrame = GetRootFrame();
 
   // If the start or end of the range is the document, just use the root
   // frame, otherwise get the common ancestor of the two endpoints of the
   // range.
-  nsINode* startParent = range->GetStartParent();
+  nsINode* startParent = range->GetStartContainer();
   nsINode* endParent = range->GetEndParent();
   nsIDocument* doc = startParent->GetComposedDoc();
   if (startParent == doc || endParent == doc) {
     ancestorFrame = rootFrame;
   } else {
     nsINode* ancestor = nsContentUtils::GetCommonAncestor(startParent, endParent);
     NS_ASSERTION(!ancestor || ancestor->IsNodeOfType(nsINode::eCONTENT),
                  "common ancestor is not content");
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -9154,19 +9154,21 @@ nsLayoutUtils::GetSelectionBoundingRect(
       res = TransformFrameRectToAncestor(frame, res, relativeTo);
     }
   } else {
     int32_t rangeCount = aSel->RangeCount();
     RectAccumulator accumulator;
     for (int32_t idx = 0; idx < rangeCount; ++idx) {
       nsRange* range = aSel->GetRangeAt(idx);
       nsRange::CollectClientRectsAndText(&accumulator, nullptr, range,
-                                  range->GetStartParent(), range->StartOffset(),
-                                  range->GetEndParent(), range->EndOffset(),
-                                  true, false);
+                                         range->GetStartContainer(),
+                                         range->StartOffset(),
+                                         range->GetEndParent(),
+                                         range->EndOffset(),
+                                         true, false);
     }
     res = accumulator.mResultRect.IsEmpty() ? accumulator.mFirstRect :
       accumulator.mResultRect;
   }
 
   return res;
 }
 
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -635,17 +635,17 @@ nsFrameSelection::UndefineCaretBidiLevel
 
 #ifdef PRINT_RANGE
 void printRange(nsRange *aDomRange)
 {
   if (!aDomRange)
   {
     printf("NULL nsIDOMRange\n");
   }
-  nsINode* startNode = aDomRange->GetStartParent();
+  nsINode* startNode = aDomRange->GetStartContainer();
   nsINode* endNode = aDomRange->GetEndParent();
   int32_t startOffset = aDomRange->StartOffset();
   int32_t endOffset = aDomRange->EndOffset();
 
   printf("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n",
          (unsigned long)aDomRange,
          (unsigned long)startNode, (long)startOffset,
          (unsigned long)endNode, (long)endOffset);
@@ -830,17 +830,17 @@ nsFrameSelection::MoveCaret(nsDirection 
   }
 
   if (doCollapse) {
     const nsRange* anchorFocusRange = sel->GetAnchorFocusRange();
     if (anchorFocusRange) {
       nsINode* node;
       int32_t offset;
       if (aDirection == eDirPrevious) {
-        node =  anchorFocusRange->GetStartParent();
+        node =  anchorFocusRange->GetStartContainer();
         offset = anchorFocusRange->StartOffset();
       } else {
         node = anchorFocusRange->GetEndParent();
         offset = anchorFocusRange->EndOffset();
       }
       sel->Collapse(node, offset);
     }
     sel->ScrollIntoView(nsISelectionController::SELECTION_FOCUS_REGION,
@@ -1206,17 +1206,17 @@ nsFrameSelection::AdjustForMaintainedSel
   if (!aContent) {
     return false;
   }
 
   int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return false;
 
-  nsINode* rangeStartNode = mMaintainRange->GetStartParent();
+  nsINode* rangeStartNode = mMaintainRange->GetStartContainer();
   nsINode* rangeEndNode = mMaintainRange->GetEndParent();
   int32_t rangeStartOffset = mMaintainRange->StartOffset();
   int32_t rangeEndOffset = mMaintainRange->EndOffset();
 
   int32_t relToStart =
     nsContentUtils::ComparePoints(rangeStartNode, rangeStartOffset,
                                   aContent, aOffset);
   int32_t relToEnd =
@@ -1306,17 +1306,17 @@ nsFrameSelection::HandleDrag(nsIFrame *a
   if (newFrame->IsSelected() &&
       AdjustForMaintainedSelection(offsets.content, offsets.offset))
     return;
 
   // Adjust offsets according to maintained amount
   if (mMaintainRange &&
       mMaintainedAmount != eSelectNoAmount) {
 
-    nsINode* rangenode = mMaintainRange->GetStartParent();
+    nsINode* rangenode = mMaintainRange->GetStartContainer();
     int32_t rangeOffset = mMaintainRange->StartOffset();
     int32_t relativePosition =
       nsContentUtils::ComparePoints(rangenode, rangeOffset,
                                     offsets.content, offsets.offset);
 
     nsDirection direction = relativePosition > 0 ? eDirPrevious : eDirNext;
     nsSelectionAmount amount = mMaintainedAmount;
     if (amount == eSelectBeginLine && direction == eDirNext)
@@ -2099,21 +2099,21 @@ nsFrameSelection::ClearNormalSelection()
 
 static nsIContent*
 GetFirstSelectedContent(nsRange* aRange)
 {
   if (!aRange) {
     return nullptr;
   }
 
-  NS_PRECONDITION(aRange->GetStartParent(), "Must have start parent!");
-  NS_PRECONDITION(aRange->GetStartParent()->IsElement(),
+  NS_PRECONDITION(aRange->GetStartContainer(), "Must have start parent!");
+  NS_PRECONDITION(aRange->GetStartContainer()->IsElement(),
                   "Unexpected parent");
 
-  return aRange->GetStartParent()->GetChildAt(aRange->StartOffset());
+  return aRange->GetStartContainer()->GetChildAt(aRange->StartOffset());
 }
 
 // Table selection support.
 // TODO: Separate table methods into a separate nsITableSelection interface
 nsresult
 nsFrameSelection::HandleTableSelection(nsINode* aParentContent,
                                        int32_t aContentOffset,
                                        int32_t aTarget,
@@ -2381,17 +2381,17 @@ printf("HandleTableSelection: Unselectin
 #endif
         for( int32_t i = 0; i < rangeCount; i++)
         {
           // Strong reference, because sometimes we want to remove
           // this range, and then we might be the only owner.
           RefPtr<nsRange> range = mDomSelections[index]->GetRangeAt(i);
           if (!range) return NS_ERROR_NULL_POINTER;
 
-          nsINode* parent = range->GetStartParent();
+          nsINode* parent = range->GetStartContainer();
           if (!parent) return NS_ERROR_NULL_POINTER;
 
           int32_t offset = range->StartOffset();
           // Be sure previous selection is a table cell
           nsIContent* child = parent->GetChildAt(offset);
           if (child && IsCell(child))
             previousCellParent = parent;
 
@@ -2732,17 +2732,17 @@ nsFrameSelection::SelectRowOrColumn(nsIC
   return NS_OK;
 }
 
 nsIContent*
 nsFrameSelection::GetFirstCellNodeInRange(nsRange *aRange) const
 {
   if (!aRange) return nullptr;
 
-  nsINode* startParent = aRange->GetStartParent();
+  nsINode* startParent = aRange->GetStartContainer();
   if (!startParent)
     return nullptr;
 
   int32_t offset = aRange->StartOffset();
 
   nsIContent* childContent = startParent->GetChildAt(offset);
   if (!childContent)
     return nullptr;