Use patch of 120209 to fix bug 124285, "Script focus control problem in Siebel app", a=jdunn
git-svn-id: svn://10.0.0.236/branches/SUN_6_2_1_BRANCH@116357 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -398,40 +398,46 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
|
||||
gLastFocusedDocument->GetScriptGlobalObject(getter_AddRefs(ourGlobal));
|
||||
nsCOMPtr<nsIDOMWindowInternal> rootWindow;
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(ourGlobal);
|
||||
PRBool isAlreadySuppressed = PR_FALSE;
|
||||
if(ourWindow) {
|
||||
ourWindow->GetRootFocusController(getter_AddRefs(focusController));
|
||||
if (focusController)
|
||||
if (focusController) {
|
||||
focusController->GetSuppressFocus(&isAlreadySuppressed);
|
||||
focusController->SetSuppressFocus(PR_TRUE, "NS_GOTFOCUS ESM Suppression");
|
||||
}
|
||||
}
|
||||
|
||||
gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
|
||||
if (!mCurrentFocus && gLastFocusedContent) {
|
||||
// must send it to the element that is losing focus,
|
||||
// since SendFocusBlur wont be called
|
||||
gLastFocusedContent->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
gLastFocusedContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIPresContext> oldPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(oldPresContext));
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event;
|
||||
event.eventStructType = NS_EVENT;
|
||||
event.message = NS_BLUR_CONTENT;
|
||||
nsCOMPtr<nsIEventStateManager> esm;
|
||||
oldPresContext->GetEventStateManager(getter_AddRefs(esm));
|
||||
esm->SetFocusedContent(gLastFocusedContent);
|
||||
gLastFocusedContent->HandleDOMEvent(oldPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
esm->SetFocusedContent(nsnull);
|
||||
NS_IF_RELEASE(gLastFocusedContent);
|
||||
if (!isAlreadySuppressed) {
|
||||
gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
|
||||
if (!mCurrentFocus && gLastFocusedContent) {
|
||||
// must send it to the element that is losing focus,
|
||||
// since SendFocusBlur wont be called
|
||||
gLastFocusedContent->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
gLastFocusedContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIPresContext> oldPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(oldPresContext));
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event;
|
||||
event.eventStructType = NS_EVENT;
|
||||
event.message = NS_BLUR_CONTENT;
|
||||
nsCOMPtr<nsIEventStateManager> esm;
|
||||
oldPresContext->GetEventStateManager(getter_AddRefs(esm));
|
||||
esm->SetFocusedContent(gLastFocusedContent);
|
||||
gLastFocusedContent->HandleDOMEvent(oldPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
esm->SetFocusedContent(nsnull);
|
||||
NS_IF_RELEASE(gLastFocusedContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (focusController) {
|
||||
focusController->SetSuppressFocus(PR_FALSE, "NS_GOTFOCUS ESM Suppression");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user