зеркало из https://github.com/mozilla/gecko-dev.git
fixe for 23558: windows ime bug - typing escape in ime can cause selection to move to top of document
This commit is contained in:
Родитель
579e3b88f4
Коммит
e6db193491
|
@ -4473,6 +4473,15 @@ nsHTMLEditor::SetCompositionString(const nsString& aCompositionString, nsIPrivat
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsICaret> caretP;
|
||||
|
||||
// workaround for windows ime bug 23558: we get every ime event twice.
|
||||
// for escape keypress, this causes an empty string to be passed
|
||||
// twice, which freaks out the editor. This is to detect and aviod that
|
||||
// situation:
|
||||
if (aCompositionString.IsEmpty() && !mIMETextNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsresult result = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
@ -4490,6 +4499,12 @@ nsHTMLEditor::SetCompositionString(const nsString& aCompositionString, nsIPrivat
|
|||
ps->GetCaret(getter_AddRefs(caretP));
|
||||
caretP->GetWindowRelativeCoordinates(aReply->mCursorPosition,aReply->mCursorIsCollapsed);
|
||||
|
||||
// second part of 23558 fix:
|
||||
if (aCompositionString.IsEmpty())
|
||||
{
|
||||
mIMETextNode = nsnull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -4473,6 +4473,15 @@ nsHTMLEditor::SetCompositionString(const nsString& aCompositionString, nsIPrivat
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsICaret> caretP;
|
||||
|
||||
// workaround for windows ime bug 23558: we get every ime event twice.
|
||||
// for escape keypress, this causes an empty string to be passed
|
||||
// twice, which freaks out the editor. This is to detect and aviod that
|
||||
// situation:
|
||||
if (aCompositionString.IsEmpty() && !mIMETextNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsresult result = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
@ -4490,6 +4499,12 @@ nsHTMLEditor::SetCompositionString(const nsString& aCompositionString, nsIPrivat
|
|||
ps->GetCaret(getter_AddRefs(caretP));
|
||||
caretP->GetWindowRelativeCoordinates(aReply->mCursorPosition,aReply->mCursorIsCollapsed);
|
||||
|
||||
// second part of 23558 fix:
|
||||
if (aCompositionString.IsEmpty())
|
||||
{
|
||||
mIMETextNode = nsnull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче