Bug 1343037 part 14. Implement nsTextEditorState::SetSelectionDirection. r=ehsan
This introduces two behavior changes:
1) In cached mode, we used to treat unknown selection directions as "none".
Now we treat it like "forward", consistently with the "have an editor" mode.
2) Before this change, in cached mode, we did not fire "select" events on
selectionDirection changes.
MozReview-Commit-ID: 4nBCAm3mAiz
This commit is contained in:
@@ -6561,22 +6561,8 @@ HTMLInputElement::SetSelectionDirection(const nsAString& aDirection, ErrorResult
|
||||
}
|
||||
|
||||
nsTextEditorState* state = GetEditorState();
|
||||
if (state && state->IsSelectionCached()) {
|
||||
nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
|
||||
if (aDirection.EqualsLiteral("forward")) {
|
||||
dir = nsITextControlFrame::eForward;
|
||||
} else if (aDirection.EqualsLiteral("backward")) {
|
||||
dir = nsITextControlFrame::eBackward;
|
||||
}
|
||||
state->GetSelectionProperties().SetDirection(dir);
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t start, end;
|
||||
GetSelectionRange(&start, &end, aRv);
|
||||
if (!aRv.Failed()) {
|
||||
aRv = SetSelectionRange(start, end, aDirection);
|
||||
}
|
||||
MOZ_ASSERT(state, "SupportsTextSelection came back true!");
|
||||
state->SetSelectionDirection(aDirection, aRv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
Reference in New Issue
Block a user