Fix for space bar scrolling page when in text fields. r=hyatt

git-svn-id: svn://10.0.0.236/trunk@67987 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
saari%netscape.com 2000-05-03 00:49:37 +00:00
parent fa6348d77a
commit a7256ab15f
2 changed files with 50 additions and 0 deletions

View File

@ -330,7 +330,32 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
blurevent.message = NS_BLUR_CONTENT;
if(gLastFocusedPresContext) {
nsCOMPtr<nsIDOMXULCommandDispatcher> commandDispatcher;
nsCOMPtr<nsIScriptGlobalObject> ourGlobal;
gLastFocusedDocument->GetScriptGlobalObject(getter_AddRefs(ourGlobal));
nsCOMPtr<nsIDOMWindow> rootWindow;
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(ourGlobal);
if(ourWindow) {
ourWindow->GetPrivateRoot(getter_AddRefs(rootWindow));
if(rootWindow) {
nsCOMPtr<nsIDOMDocument> rootDocument;
rootWindow->GetDocument(getter_AddRefs(rootDocument));
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(rootDocument);
if(xulDoc) {
xulDoc->GetCommandDispatcher(getter_AddRefs(commandDispatcher));
if (commandDispatcher) {
commandDispatcher->SetSuppressFocus(PR_TRUE);
}
}
}
}
gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
if (commandDispatcher) {
commandDispatcher->SetSuppressFocus(PR_FALSE);
}
}
}

View File

@ -330,7 +330,32 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
blurevent.message = NS_BLUR_CONTENT;
if(gLastFocusedPresContext) {
nsCOMPtr<nsIDOMXULCommandDispatcher> commandDispatcher;
nsCOMPtr<nsIScriptGlobalObject> ourGlobal;
gLastFocusedDocument->GetScriptGlobalObject(getter_AddRefs(ourGlobal));
nsCOMPtr<nsIDOMWindow> rootWindow;
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(ourGlobal);
if(ourWindow) {
ourWindow->GetPrivateRoot(getter_AddRefs(rootWindow));
if(rootWindow) {
nsCOMPtr<nsIDOMDocument> rootDocument;
rootWindow->GetDocument(getter_AddRefs(rootDocument));
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(rootDocument);
if(xulDoc) {
xulDoc->GetCommandDispatcher(getter_AddRefs(commandDispatcher));
if (commandDispatcher) {
commandDispatcher->SetSuppressFocus(PR_TRUE);
}
}
}
}
gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext, &blurevent, nsnull, NS_EVENT_FLAG_INIT, &blurstatus);
if (commandDispatcher) {
commandDispatcher->SetSuppressFocus(PR_FALSE);
}
}
}