Bug 405151 IME handling is killed at opening a popup which has |ignorekeys=true| r=enndeakin, sr=roc, b1.9=beltzner

This commit is contained in:
masayuki@d-toybox.com 2007-12-03 20:07:12 -08:00
Родитель e1961ddec2
Коммит 33dc350fab
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -1270,13 +1270,16 @@ void
nsXULPopupManager::UpdateKeyboardListeners() nsXULPopupManager::UpdateKeyboardListeners()
{ {
nsCOMPtr<nsIDOMEventTarget> newTarget; nsCOMPtr<nsIDOMEventTarget> newTarget;
PRBool isForMenu = PR_FALSE;
nsMenuChainItem* item = GetTopVisibleMenu(); nsMenuChainItem* item = GetTopVisibleMenu();
if (item) { if (item) {
if (!item->IgnoreKeys()) if (!item->IgnoreKeys())
newTarget = do_QueryInterface(item->Content()->GetDocument()); newTarget = do_QueryInterface(item->Content()->GetDocument());
isForMenu = item->PopupType() == ePopupTypeMenu;
} }
else if (mActiveMenuBar) { else if (mActiveMenuBar) {
newTarget = do_QueryInterface(mActiveMenuBar->GetContent()->GetDocument()); newTarget = do_QueryInterface(mActiveMenuBar->GetContent()->GetDocument());
isForMenu = PR_TRUE;
} }
if (mKeyListener != newTarget) { if (mKeyListener != newTarget) {
@ -1292,7 +1295,7 @@ nsXULPopupManager::UpdateKeyboardListeners()
newTarget->AddEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE); newTarget->AddEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE);
newTarget->AddEventListener(NS_LITERAL_STRING("keydown"), this, PR_TRUE); newTarget->AddEventListener(NS_LITERAL_STRING("keydown"), this, PR_TRUE);
newTarget->AddEventListener(NS_LITERAL_STRING("keyup"), this, PR_TRUE); newTarget->AddEventListener(NS_LITERAL_STRING("keyup"), this, PR_TRUE);
nsContentUtils::NotifyInstalledMenuKeyboardListener(PR_TRUE); nsContentUtils::NotifyInstalledMenuKeyboardListener(isForMenu);
mKeyListener = newTarget; mKeyListener = newTarget;
} }
} }