Bug 190495. Find As You Type shouldn't start in about:config (XUL content). Also fixes bug 189193, Find As You Type shouldn't try link find in text only doc. r= caillon, sr=jst, a=asa

This commit is contained in:
aaronl%netscape.com 2003-01-29 03:34:20 +00:00
parent 063396801a
commit 0e8be78cd3

View File

@ -69,6 +69,7 @@
#include "nsIFrame.h"
#include "nsFrameTraversal.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIEventStateManager.h"
@ -1905,19 +1906,6 @@ nsTypeAheadFind::GetAutoStart(nsIDOMWindow *aDOMWin, PRBool *aIsAutoStartOn)
nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(ifreq));
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(webNav));
NS_ENSURE_TRUE(treeItem, NS_OK);
// Don't listen for events on chrome windows
PRInt32 itemType = nsIDocShellTreeItem::typeChrome;
if (treeItem) {
treeItem->GetItemType(&itemType);
}
if (itemType == nsIDocShellTreeItem::typeChrome) {
return NS_OK;
}
// Check for editor or message pane
nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(treeItem));
if (editorDocShell) {
PRBool isEditable;
@ -1933,6 +1921,19 @@ nsTypeAheadFind::GetAutoStart(nsIDOMWindow *aDOMWin, PRBool *aIsAutoStartOn)
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
NS_ENSURE_TRUE(doc, NS_OK);
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(doc));
if (xulDoc) {
return NS_OK; // Avoid any xul docs, whether in chrome or content
}
if (mLinksOnlyPref) {
nsAutoString contentType;
doc->GetContentType(contentType);
if (contentType.Equals(NS_LITERAL_STRING("text/plain"))) {
return NS_OK; // No auto link search in plain text pages
}
}
nsCOMPtr<nsIDocument> parentDoc;
doc->GetParentDocument(getter_AddRefs(parentDoc));
if (parentDoc) {