Bug 1343037 part 9. Simplify the setup around the editor state's GetSelectionDirection function. r=ehsan
Really, there are only two cases we need to worry about. Either IsSelectionCached(), and then our SelectionProperties has the data we want, or not and then we have a non-null mSelCon which has the data we want. MozReview-Commit-ID: AEW9D1zG6sM
This commit is contained in:
@@ -807,23 +807,12 @@ DirectionToName(nsITextControlFrame::SelectionDirection dir, nsAString& aDirecti
|
||||
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);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
DirectionToName(dir, aDirection);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mState.IsSelectionCached()) {
|
||||
DirectionToName(mState.GetSelectionProperties().GetDirection(), aDirection);
|
||||
nsITextControlFrame::SelectionDirection dir =
|
||||
mState.GetSelectionDirection(aError);
|
||||
if (aError.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
aError.Throw(rv);
|
||||
DirectionToName(dir, aDirection);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user