Bug 1343037 part 7. Get rid of nsIDOMHTMLTextareaElement's selectionDirection attribute. r=ehsan
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 09 Mar 2017 14:44:04 -0500
changeset 347106 70ea4278d286c633534c8a9878e80c044b7dcf4d
parent 347105 605f2142963de41e871ce790a7d887a40cecc453
child 347107 ba3520682a3f82458c5cf67a89375306e0b5cefa
push id31491
push usercbook@mozilla.com
push dateMon, 13 Mar 2017 14:24:00 +0000
treeherdermozilla-central@8d9fd089cabd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1343037
milestone55.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 1343037 part 7. Get rid of nsIDOMHTMLTextareaElement's selectionDirection attribute. r=ehsan MozReview-Commit-ID: EQWxjgTdloR
dom/html/HTMLTextAreaElement.cpp
dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -716,31 +716,30 @@ HTMLTextAreaElement::SetSelectionStart(c
   }
 
   if (mState.IsSelectionCached()) {
     mState.GetSelectionProperties().SetStart(selStart);
     return;
   }
 
   nsAutoString direction;
-  nsresult rv = GetSelectionDirection(direction);
-  if (NS_FAILED(rv)) {
-    aError.Throw(rv);
+  GetSelectionDirection(direction, aError);
+  if (aError.Failed()) {
     return;
   }
   int32_t start, end;
   GetSelectionRange(&start, &end, aError);
   if (aError.Failed()) {
     return;
   }
   start = selStart;
   if (end < start) {
     end = start;
   }
-  rv = SetSelectionRange(start, end, direction);
+  nsresult rv = SetSelectionRange(start, end, direction);
   if (NS_FAILED(rv)) {
     aError.Throw(rv);
   }
 }
 
 Nullable<uint32_t>
 HTMLTextAreaElement::GetSelectionEnd(ErrorResult& aError)
 {
@@ -759,31 +758,30 @@ HTMLTextAreaElement::SetSelectionEnd(con
   }
 
   if (mState.IsSelectionCached()) {
     mState.GetSelectionProperties().SetEnd(selEnd);
     return;
   }
 
   nsAutoString direction;
-  nsresult rv = GetSelectionDirection(direction);
-  if (NS_FAILED(rv)) {
-    aError.Throw(rv);
+  GetSelectionDirection(direction, aError);
+  if (aError.Failed()) {
     return;
   }
   int32_t start, end;
   GetSelectionRange(&start, &end, aError);
   if (aError.Failed()) {
     return;
   }
   end = selEnd;
   if (start > end) {
     start = end;
   }
-  rv = SetSelectionRange(start, end, direction);
+  nsresult rv = SetSelectionRange(start, end, direction);
   if (NS_FAILED(rv)) {
     aError.Throw(rv);
   }
 }
 
 void
 HTMLTextAreaElement::GetSelectionRange(int32_t* aSelectionStart,
                                        int32_t* aSelectionEnd,
@@ -801,24 +799,16 @@ DirectionToName(nsITextControlFrame::Sel
     aDirection.AssignLiteral("forward");
   } else if (dir == nsITextControlFrame::eBackward) {
     aDirection.AssignLiteral("backward");
   } else {
     NS_NOTREACHED("Invalid SelectionDirection value");
   }
 }
 
-nsresult
-HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection)
-{
-  ErrorResult error;
-  GetSelectionDirection(aDirection, error);
-  return error.StealNSResult();
-}
-
 void
 HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& aError)
 {
   nsresult rv = NS_ERROR_FAILURE;
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
   if (formControlFrame) {
     nsITextControlFrame::SelectionDirection dir;
     rv = mState.GetSelectionDirection(&dir);
@@ -831,24 +821,16 @@ HTMLTextAreaElement::GetSelectionDirecti
   if (mState.IsSelectionCached()) {
     DirectionToName(mState.GetSelectionProperties().GetDirection(), aDirection);
     return;
   }
 
   aError.Throw(rv);
 }
 
-NS_IMETHODIMP
-HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection)
-{
-  ErrorResult error;
-  SetSelectionDirection(aDirection, error);
-  return error.StealNSResult();
-}
-
 void
 HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection,
                                            ErrorResult& aError)
 {
   if (mState.IsSelectionCached()) {
     nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
     if (aDirection.EqualsLiteral("forward")) {
       dir = nsITextControlFrame::eForward;
--- a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl
@@ -50,16 +50,15 @@ interface nsIDOMHTMLTextAreaElement : ns
   readonly attribute boolean               willValidate;
   readonly attribute nsIDOMValidityState   validity;
   readonly attribute DOMString             validationMessage;
   boolean checkValidity();
   void setCustomValidity(in DOMString error);
 
   void select();
   void setSelectionRange(in long selectionStart, in long selectionEnd, [optional] in DOMString direction);
-           attribute DOMString             selectionDirection;
 
 
   // Mozilla extensions
   // Please make sure to update the HTMLTextAreaElement Web IDL interface to
   // mirror the list of Mozilla extensions here when changing it.
   readonly attribute nsIControllers   controllers;
 };