Bug 352093. Part 4: IME code should use GetRootWidget so it works with documents that don't have their own widgets. r=masayuki

This commit is contained in:
Robert O'Callahan 2009-07-22 12:45:05 +12:00
parent 469425a1ed
commit f14e143e57
3 changed files with 5 additions and 4 deletions

View File

@ -222,7 +222,7 @@ nsIMEStateManager::GetWidget(nsPresContext* aPresContext)
if (!vm)
return nsnull;
nsCOMPtr<nsIWidget> widget = nsnull;
nsresult rv = vm->GetWidget(getter_AddRefs(widget));
nsresult rv = vm->GetRootWidget(getter_AddRefs(widget));
NS_ENSURE_SUCCESS(rv, nsnull);
return widget;
}
@ -497,7 +497,7 @@ nsIMEStateManager::OnTextStateFocus(nsPresContext* aPresContext,
NS_ENSURE_TRUE(vm, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIWidget> widget;
nsresult rv = vm->GetWidget(getter_AddRefs(widget));
nsresult rv = vm->GetRootWidget(getter_AddRefs(widget));
NS_ENSURE_SUCCESS(rv, NS_ERROR_NOT_AVAILABLE);
rv = widget->OnIMEFocusChange(PR_TRUE);

View File

@ -5973,6 +5973,7 @@ PresShell::HandleEvent(nsIView *aView,
// key and IME events must be targeted at the presshell for the focused frame
if (!sDontRetargetEvents &&
(NS_IS_KEY_EVENT(aEvent) || NS_IS_IME_EVENT(aEvent) ||
NS_IS_QUERY_CONTENT_EVENT(aEvent) || NS_IS_SELECTION_EVENT(aEvent) ||
NS_IS_CONTEXT_MENU_KEY(aEvent))) {
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (!fm)

View File

@ -2669,7 +2669,7 @@ TestApp::TestNotification(void)
if (NS_SUCCEEDED(nsr) && presShell) {
nsCOMPtr<nsIViewManager> viewManager = presShell->GetViewManager();
if (viewManager) {
nsr = viewManager->GetWidget(getter_AddRefs(widget));
nsr = viewManager->GetRootWidget(getter_AddRefs(widget));
}
}
}
@ -2736,7 +2736,7 @@ TestApp::TestContentEvents(void)
if (NS_SUCCEEDED(nsr) && presShell) {
nsCOMPtr<nsIViewManager> viewManager = presShell->GetViewManager();
if (viewManager) {
nsr = viewManager->GetWidget(getter_AddRefs(widget));
nsr = viewManager->GetRootWidget(getter_AddRefs(widget));
}
}
}