diff options
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EphyWrapper.cpp | 55 | ||||
-rw-r--r-- | embed/mozilla/EphyWrapper.h | 8 | ||||
-rw-r--r-- | embed/mozilla/Makefile.am | 1 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 65 |
4 files changed, 56 insertions, 73 deletions
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp index 1252f7ece..fc306898b 100644 --- a/embed/mozilla/EphyWrapper.cpp +++ b/embed/mozilla/EphyWrapper.cpp @@ -68,8 +68,6 @@ #include "nsIDeviceContext.h" #include "nsIPresContext.h" #include "ContentHandler.h" -#include "nsITypeAheadFind.h" -#include "nsSupportsPrimitives.h" #include "EphyEventListener.h" EphyWrapper::EphyWrapper () @@ -499,50 +497,25 @@ nsresult EphyWrapper::GetSHUrlAtIndex (PRInt32 index, nsCString &url) return NS_OK; } -nsresult EphyWrapper::Find (const PRUnichar *search_string, - PRBool interactive, - PRBool matchcase, PRBool search_backwards, - PRBool search_wrap_around, - PRBool search_for_entire_word, - PRBool search_in_frames, - PRBool *didFind) +nsresult EphyWrapper::FindSetProperties (const PRUnichar *search_string, + PRBool case_sensitive, + PRBool wrap_around) { - if (!interactive) - { - nsresult rv; - nsCOMPtr<nsITypeAheadFind> tAFinder - (do_GetService(NS_TYPEAHEADFIND_CONTRACTID, &rv)); - if (NS_SUCCEEDED(rv)) - { - nsCOMPtr<nsIDOMWindow> aFocusedWindow; - rv = GetFocusedDOMWindow(getter_AddRefs(aFocusedWindow)); - if (NS_SUCCEEDED(rv)) - { - nsSupportsInterfacePointerImpl windowPtr; - windowPtr.SetData(aFocusedWindow); - - tAFinder->FindNext(search_backwards, &windowPtr); - - nsCOMPtr<nsISupports> retValue; - rv = windowPtr.GetData(getter_AddRefs(retValue)); - if (NS_SUCCEEDED(rv) && !retValue) - { - *didFind = PR_TRUE; - return NS_OK; - } - } - } + nsCOMPtr<nsIWebBrowserFind> finder (do_GetInterface(mWebBrowser)); + + finder->SetSearchString (search_string); + finder->SetMatchCase (case_sensitive); - } + return NS_OK; +} +nsresult EphyWrapper::Find (PRBool backwards, + PRBool *didFind) +{ nsCOMPtr<nsIWebBrowserFind> finder (do_GetInterface(mWebBrowser)); - finder->SetSearchString (search_string); - finder->SetFindBackwards (search_backwards); - finder->SetWrapFind (search_wrap_around); - finder->SetEntireWord (search_for_entire_word); - finder->SetMatchCase (matchcase); - finder->SetSearchFrames (search_in_frames); + finder->SetFindBackwards (backwards); + return finder->FindNext(didFind); } diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h index dd9d1c228..a210cdbfd 100644 --- a/embed/mozilla/EphyWrapper.h +++ b/embed/mozilla/EphyWrapper.h @@ -54,10 +54,10 @@ public: nsresult PrintPreviewNumPages (int *numPages); nsresult PrintPreviewNavigate(PRInt16 navType, PRInt32 pageNum); - nsresult Find (const PRUnichar *search_string, - PRBool matchcase, PRBool interactive, - PRBool search_backwards, PRBool search_wrap_around, - PRBool search_for_entire_word, PRBool search_in_frames, + nsresult FindSetProperties (const PRUnichar *search_string, + PRBool case_sensitive, + PRBool wrap_around); + nsresult Find (PRBool bacwards, PRBool *didFind); nsresult GetMainDocumentUrl (nsCString &url); diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index 851c1bdb5..8c462963c 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -22,7 +22,6 @@ INCLUDES = \ -I$(MOZILLA_INCLUDE_ROOT)/pref \ -I$(MOZILLA_INCLUDE_ROOT)/progressDlg \ -I$(MOZILLA_INCLUDE_ROOT)/shistory \ - -I$(MOZILLA_INCLUDE_ROOT)/typeaheadfind \ -I$(MOZILLA_INCLUDE_ROOT)/unicharutil \ -I$(MOZILLA_INCLUDE_ROOT)/uriloader \ -I$(MOZILLA_INCLUDE_ROOT)/wallet \ diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index b0fbda45b..fa78a245b 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -145,10 +145,6 @@ impl_get_security_level (EphyEmbed *embed, EmbedSecurityLevel *level, char **description); static gresult -impl_find (EphyEmbed *embed, - EmbedFindInfo *info); - -static gresult impl_set_encoding (EphyEmbed *embed, const char *encoding); @@ -295,6 +291,42 @@ mozilla_embed_get_type (void) return mozilla_embed_type; } +static gresult +impl_find_next (EphyEmbed *embed, + gboolean backwards) +{ + nsresult result = NS_OK; + EphyWrapper *wrapper; + + wrapper = MOZILLA_EMBED(embed)->priv->wrapper; + g_return_val_if_fail (wrapper != NULL, G_FAILED); + + PRBool didFind; + + result = wrapper->Find (backwards, &didFind); + + return didFind ? G_OK : G_FAILED; +} + +static gresult +impl_find_set_properties (EphyEmbed *embed, + char *search_string, + gboolean case_sensitive, + gboolean wrap_around) +{ + nsresult result = NS_OK; + EphyWrapper *wrapper; + + wrapper = MOZILLA_EMBED(embed)->priv->wrapper; + g_return_val_if_fail (wrapper != NULL, G_FAILED); + + result = wrapper->FindSetProperties + ((NS_ConvertUTF8toUCS2(search_string)).get(), + case_sensitive, wrap_around); + + return result ? G_OK : G_FAILED; +} + static void ephy_embed_init (EphyEmbedClass *embed_class) { @@ -330,7 +362,8 @@ ephy_embed_init (EphyEmbedClass *embed_class) embed_class->shistory_go_nth = impl_shistory_go_nth; embed_class->shistory_copy = impl_shistory_copy; embed_class->get_security_level = impl_get_security_level; - embed_class->find = impl_find; + embed_class->find_next = impl_find_next; + embed_class->find_set_properties = impl_find_set_properties; embed_class->set_encoding = impl_set_encoding; embed_class->select_all = impl_select_all; embed_class->print = impl_print; @@ -1140,28 +1173,6 @@ impl_print_preview_navigate (EphyEmbed *embed, } static gresult -impl_find (EphyEmbed *embed, - EmbedFindInfo *info) -{ - nsresult result = NS_OK; - EphyWrapper *wrapper; - - wrapper = MOZILLA_EMBED(embed)->priv->wrapper; - g_return_val_if_fail (wrapper != NULL, G_FAILED); - - PRBool didFind; - - result = wrapper->Find ((NS_ConvertUTF8toUCS2(info->search_string)).get(), - info->interactive, - info->match_case, - info->backwards, info->wrap, - info->entire_word, info->search_frames, - &didFind); - - return didFind ? G_OK : G_FAILED; -} - -static gresult impl_set_encoding (EphyEmbed *embed, const char *encoding) { |