Bug 1387143 part 15. Remove nsISelectionPrivate::Get/SetSelectionDirection. r=mats
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 08 May 2018 13:52:38 -0400
changeset 474167 4d6054f4b7e9494ce6a57c365a4565bd69ab1ad4
parent 474166 8bd354b5a5915bf0680ef62a866b1ae96e31a004
child 474168 db8412ba88f25342985edf421e63d09c2428a6ab
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1387143
milestone62.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 1387143 part 15. Remove nsISelectionPrivate::Get/SetSelectionDirection. r=mats
dom/base/Selection.cpp
dom/base/nsISelectionPrivate.idl
dom/html/nsTextEditorState.cpp
layout/forms/nsTextControlFrame.cpp
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -4114,26 +4114,16 @@ Selection::ResetColors()
 }
 
 void
 Selection::ResetColors(ErrorResult& aRv)
 {
   mCustomColors = nullptr;
 }
 
-NS_IMETHODIMP_(nsDirection)
-Selection::GetSelectionDirection() {
-  return mDirection;
-}
-
-NS_IMETHODIMP_(void)
-Selection::SetSelectionDirection(nsDirection aDirection) {
-  mDirection = aDirection;
-}
-
 JSObject*
 Selection::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return mozilla::dom::SelectionBinding::Wrap(aCx, this, aGivenProto);
 }
 
 // AutoHideSelectionChanges
 AutoHideSelectionChanges::AutoHideSelectionChanges(const nsFrameSelection* aFrame)
--- a/dom/base/nsISelectionPrivate.idl
+++ b/dom/base/nsISelectionPrivate.idl
@@ -27,22 +27,16 @@ struct ScrollAxis;
 [ref] native nsPointRef(nsPoint);
 native nsDirection(nsDirection);
 native ScrollAxis(nsIPresShell::ScrollAxis);
 
 [uuid(0c9f4f74-ee7e-4fe9-be6b-0ba856368178)]
 interface nsISelectionPrivate : nsISupports
 {
     /**
-     * Get the direction of the selection.
-     */
-    [noscript, notxpcom] nsDirection getSelectionDirection();
-    [noscript, notxpcom] void setSelectionDirection(in nsDirection aDirection);
-
-    /**
      * Returns the type of the selection (see nsISelectionController for
      * available constants).
      */
     readonly attribute short type;
 
     /**
      * Return array of ranges intersecting with the given DOM interval.
      */
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -1657,17 +1657,17 @@ nsTextEditorState::GetSelectionDirection
   }
 
   Selection* sel = mSelCon->GetSelection(SelectionType::eNormal);
   if (NS_WARN_IF(!sel)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nsITextControlFrame::eForward; // Doesn't really matter
   }
 
-  nsDirection direction = sel->GetSelectionDirection();
+  nsDirection direction = sel->GetDirection();
   if (direction == eDirNext) {
     return nsITextControlFrame::eForward;
   }
 
   MOZ_ASSERT(direction == eDirPrevious);
   return nsITextControlFrame::eBackward;
 }
 
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -882,39 +882,36 @@ nsTextControlFrame::SetSelectionInternal
   NS_ASSERTION(txtCtrl, "Content not a text control element");
   nsISelectionController* selCon = txtCtrl->GetSelectionController();
   NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
 
   RefPtr<Selection> selection =
     selCon->GetSelection(nsISelectionController::SELECTION_NORMAL);
   NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
 
-  nsCOMPtr<nsISelectionPrivate> selPriv = do_QueryObject(selection, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   nsDirection direction;
   if (aDirection == eNone) {
     // Preserve the direction
-    direction = selPriv->GetSelectionDirection();
+    direction = selection->GetDirection();
   } else {
     direction = (aDirection == eBackward) ? eDirPrevious : eDirNext;
   }
 
   ErrorResult err;
   selection->RemoveAllRanges(err);
   if (NS_WARN_IF(err.Failed())) {
     return err.StealNSResult();
   }
 
   selection->AddRange(*range, err);  // NOTE: can destroy the world
   if (NS_WARN_IF(err.Failed())) {
     return err.StealNSResult();
   }
 
-  selPriv->SetSelectionDirection(direction);
+  selection->SetDirection(direction);
   return rv;
 }
 
 nsresult
 nsTextControlFrame::ScrollSelectionIntoView()
 {
   nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
   NS_ASSERTION(txtCtrl, "Content not a text control element");