bug 804927 - fix text control frame and accessibility issues. r=ehsan,tbsaunde

This commit is contained in:
Jonathan Kew 2012-11-03 12:08:09 +00:00
parent cd349de7a0
commit 5d7d9f4189
2 changed files with 9 additions and 1 deletions

View File

@ -1497,6 +1497,14 @@ HyperTextAccessible::GetEditor() const
nsresult nsresult
HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos) HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos)
{ {
// Before setting the selection range, we need to ensure that the editor
// is initialized. (See bug 804927.)
// Otherwise, it's possible that lazy editor initialization will override
// the selection we set here and leave the caret at the end of the text.
// By calling GetEditor here, we ensure that editor initialization is
// completed before we set the selection.
nsCOMPtr<nsIEditor> editor = GetEditor();
bool isFocusable = InteractiveState() & states::FOCUSABLE; bool isFocusable = InteractiveState() & states::FOCUSABLE;
// If accessible is focusable then focus it before setting the selection to // If accessible is focusable then focus it before setting the selection to

View File

@ -1198,7 +1198,7 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
preDestroyer.Init(newEditor); preDestroyer.Init(newEditor);
// Make sure we clear out the non-breaking space before we initialize the editor // Make sure we clear out the non-breaking space before we initialize the editor
rv = mBoundFrame->UpdateValueDisplay(false, true); rv = mBoundFrame->UpdateValueDisplay(true, true);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} else { } else {
if (aValue || !mEditorInitialized) { if (aValue || !mEditorInitialized) {