Bug 704758, assertion with null frame, handle ime events that get retargeted by getting the right frame, r=smaug

This commit is contained in:
Neil Deakin 2011-12-23 14:21:09 -05:00
parent c263d22263
commit 499a154f1d

View File

@ -5818,7 +5818,28 @@ PresShell::HandleEvent(nsIFrame *aFrame,
return NS_OK;
if (presShell != this) {
return presShell->HandleEvent(presShell->GetRootFrame(), aEvent, true, aEventStatus);
nsIFrame* frame = presShell->GetRootFrame();
if (!frame) {
if (aEvent->message == NS_QUERY_TEXT_CONTENT ||
NS_IS_CONTENT_COMMAND_EVENT(aEvent)) {
return NS_OK;
}
nsIView* view = presShell->GetViewManager()->GetRootView();
while (view && !view->GetFrame()) {
view = view->GetParent();
}
if (view) {
frame = view->GetFrame();
}
}
if (!frame)
return NS_OK;
nsCOMPtr<nsIPresShell> shell = frame->PresContext()->GetPresShell();
return shell->HandleEvent(frame, aEvent, true, aEventStatus);
}
}
}