зеркало из https://github.com/mozilla/gecko-dev.git
Bug 285974 Crash when we use ATOK on the other of editor[@ nsWindow::OnIMEQueryCharPosition]
patch by masayuki@d-toybox.com r=timeless sr=roc
This commit is contained in:
Родитель
c9ed31bf55
Коммит
10c1d75093
|
@ -2211,7 +2211,8 @@ nsEditor::GetQueryCaretRect(nsQueryCaretRectEventReply* aReply)
|
|||
PRBool cursorIsCollapsed;
|
||||
rv = caretP->GetCaretCoordinates(nsICaret::eIMECoordinates, selection,
|
||||
&aReply->mCaretRect, &cursorIsCollapsed, nsnull);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
aReply->mRectIsValid = PR_TRUE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -735,9 +735,11 @@ struct nsReconversionEvent : public nsInputEvent
|
|||
|
||||
struct nsQueryCaretRectEventReply {
|
||||
nsQueryCaretRectEventReply()
|
||||
: mRectIsValid(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool mRectIsValid;
|
||||
nsRect mCaretRect;
|
||||
};
|
||||
|
||||
|
|
|
@ -6963,6 +6963,11 @@ PRBool nsWindow::OnIMEQueryCharPosition(LPARAM aData, LRESULT *oResult, PRBool a
|
|||
nsQueryCaretRectEvent event(NS_QUERYCARETRECT, this);
|
||||
InitEvent(event, &point);
|
||||
DispatchWindowEvent(&event);
|
||||
// The active widget doesn't support this event.
|
||||
if (!event.theReply.mRectIsValid) {
|
||||
*oResult = FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
NS_RELEASE(event.widget);
|
||||
|
||||
nsRect screenRect, widgetRect(event.theReply.mCaretRect);
|
||||
|
@ -6978,6 +6983,13 @@ PRBool nsWindow::OnIMEQueryCharPosition(LPARAM aData, LRESULT *oResult, PRBool a
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// If the char positions are not cached, we should not return the values by LPARAM.
|
||||
// Because in this case, the active widget is not editor.
|
||||
if (!sIMECompCharPos) {
|
||||
*oResult = FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
long charPosition;
|
||||
if (aUseUnicode || pCharPosition->dwCharPos == 0) {
|
||||
if (pCharPosition->dwCharPos > sIMECompUnicode->Length()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче