diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-01-13 19:46:24 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-01-13 19:46:24 +0800 |
commit | fe6b3046a330f10f339099fbbd23587d5da928f6 (patch) | |
tree | 866d88ccffc0fe98fa1228479a70a5646dae8d22 /embed/mozilla | |
parent | 3d42f2eccf6cdc5b4c8645fcbc97f66b46d7c70c (diff) | |
download | gsoc2013-epiphany-fe6b3046a330f10f339099fbbd23587d5da928f6.tar gsoc2013-epiphany-fe6b3046a330f10f339099fbbd23587d5da928f6.tar.gz gsoc2013-epiphany-fe6b3046a330f10f339099fbbd23587d5da928f6.tar.bz2 gsoc2013-epiphany-fe6b3046a330f10f339099fbbd23587d5da928f6.tar.lz gsoc2013-epiphany-fe6b3046a330f10f339099fbbd23587d5da928f6.tar.xz gsoc2013-epiphany-fe6b3046a330f10f339099fbbd23587d5da928f6.tar.zst gsoc2013-epiphany-fe6b3046a330f10f339099fbbd23587d5da928f6.zip |
Don't require a HTML document to activate typeaheadfind. Bug #326813.
2006-01-13 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EventContext.cpp:
Don't require a HTML document to activate typeaheadfind.
Bug #326813.
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EventContext.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
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; } |