aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--embed/mozilla/EventContext.cpp40
2 files changed, 29 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 409edc92c..6db1abe6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2006-01-13 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/EventContext.cpp:
+
+ Don't require a HTML document to activate typeaheadfind.
+ Bug #326813.
+
+2006-01-13 Christian Persch <chpe@cvs.gnome.org>
+
A embed/mozilla/EphyPromptService.cpp:
A embed/mozilla/EphyPromptService.h:
* embed/mozilla/Makefile.am:
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index cb202d7b8..dd71234f5 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -1042,10 +1042,7 @@ EventContext::CheckKeyPress (nsIDOMKeyEvent *aEvent)
rv = aEvent->GetTarget (getter_AddRefs (target));
NS_ENSURE_SUCCESS (rv, retval);
- nsCOMPtr<nsIDOMHTMLElement> element (do_QueryInterface (target, &rv));
- NS_ENSURE_SUCCESS (rv, retval);
-
- nsCOMPtr<nsIDOMHTMLInputElement> inputElement (do_QueryInterface (element));
+ nsCOMPtr<nsIDOMHTMLInputElement> inputElement (do_QueryInterface (target));
if (inputElement)
{
nsEmbedString type;
@@ -1063,27 +1060,34 @@ EventContext::CheckKeyPress (nsIDOMKeyEvent *aEvent)
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement;
nsCOMPtr<nsIDOMHTMLIsIndexElement> indexElement;
- if ((textArea = do_QueryInterface (element)) ||
- (selectElement = do_QueryInterface (element)) ||
- (indexElement = do_QueryInterface (element))) return retval;
+ if ((textArea = do_QueryInterface (target)) ||
+ (selectElement = do_QueryInterface (target)) ||
+ (indexElement = do_QueryInterface (target))) return retval;
/* check for design mode */
+ nsCOMPtr<nsIDOMNode> node (do_QueryInterface (target, &rv));
+ NS_ENSURE_SUCCESS (rv, PR_FALSE);
+
nsCOMPtr<nsIDOMDocument> doc;
- rv = element->GetOwnerDocument (getter_AddRefs (doc));
+ rv = node->GetOwnerDocument (getter_AddRefs (doc));
NS_ENSURE_SUCCESS (rv, retval);
- nsCOMPtr<nsIDOMNSHTMLDocument> htmlDoc (do_QueryInterface (doc, &rv));
- /* FIXME: return PR_TRUE here ? */
- if (NS_FAILED (rv)) return retval; /* it's okay not to be a HTML document */
-
- nsEmbedString uDesign;
- rv = htmlDoc->GetDesignMode (uDesign);
- NS_ENSURE_SUCCESS (rv, retval);
+ nsCOMPtr<nsIDOMNSHTMLDocument> htmlDoc (do_QueryInterface (doc));
+ if (htmlDoc)
+ {
+ nsEmbedString uDesign;
+ rv = htmlDoc->GetDesignMode (uDesign);
+ NS_ENSURE_SUCCESS (rv, retval);
- nsEmbedCString design;
- NS_UTF16ToCString (uDesign, NS_CSTRING_ENCODING_UTF8, design);
+ nsEmbedCString design;
+ NS_UTF16ToCString (uDesign, NS_CSTRING_ENCODING_UTF8, design);
- retval = g_ascii_strcasecmp (design.get(), "on") != 0;
+ retval = g_ascii_strcasecmp (design.get(), "on") != 0;
+ }
+ else
+ {
+ retval = PR_TRUE;
+ }
return retval;
}