From e2e4a1bf2bddbd6bcce5824178fbb7f325f87522 Mon Sep 17 00:00:00 2001 From: Neil Deakin Date: Fri, 23 Dec 2011 14:21:09 -0500 Subject: [PATCH] Bug 704758, assertion with null frame, handle ime events that get retargeted by getting the right frame, r=smaug --- layout/base/nsPresShell.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 8914620a2ef..03fa8bddaa3 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -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 shell = frame->PresContext()->GetPresShell(); + return shell->HandleEvent(frame, aEvent, true, aEventStatus); } } }