aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyFind.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-05-11 02:07:03 +0800
committerChristian Persch <chpe@src.gnome.org>2006-05-11 02:07:03 +0800
commit24b71aa8ac7de8dd140092705bb7cc439f6b3309 (patch)
tree65631a3c5c3b28414788e1f9ef060962b95de9a1 /embed/mozilla/EphyFind.cpp
parentc3a7867c638dd105405fa2078b2de828a318b909 (diff)
downloadgsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.gz
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.bz2
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.lz
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.xz
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.tar.zst
gsoc2013-epiphany-24b71aa8ac7de8dd140092705bb7cc439f6b3309.zip
Drop support for gecko 1.7.
2006-05-10 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * data/glade/prefs-dialog.glade: * embed/ephy-favicon-cache.c: (ephy_favicon_cache_get): * embed/mozilla/AutoJSContextStack.cpp: * embed/mozilla/ContentHandler.cpp: * embed/mozilla/ContentHandler.h: * embed/mozilla/EphyAboutModule.cpp: * embed/mozilla/EphyAboutModule.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/EphyContentPolicy.cpp: * embed/mozilla/EphyContentPolicy.h: * embed/mozilla/EphyDirectoryProvider.cpp: * embed/mozilla/EphyFind.cpp: * embed/mozilla/EphyFind.h: * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/EphyHeaderSniffer.h: * embed/mozilla/EphyHistoryListener.cpp: * embed/mozilla/EphyHistoryListener.h: * embed/mozilla/EphyPromptService.cpp: * embed/mozilla/EphySidebar.cpp: * embed/mozilla/EphySidebar.h: * embed/mozilla/EphySingle.cpp: * embed/mozilla/EphySingle.h: * embed/mozilla/EphyUtils.cpp: * embed/mozilla/EphyUtils.h: * embed/mozilla/EventContext.cpp: * embed/mozilla/EventContext.h: * embed/mozilla/FilePicker.cpp: * embed/mozilla/FilePicker.h: * embed/mozilla/GlobalHistory.cpp: * embed/mozilla/GlobalHistory.h: * embed/mozilla/GtkNSSClientAuthDialogs.cpp: * embed/mozilla/GtkNSSDialogs.cpp: * embed/mozilla/GtkNSSKeyPairDialogs.cpp: * embed/mozilla/GtkNSSSecurityWarningDialogs.cpp: * embed/mozilla/GtkNSSSecurityWarningDialogs.h: * embed/mozilla/Makefile.am: * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozDownload.h: * embed/mozilla/MozRegisterComponents.cpp: * embed/mozilla/MozRegisterComponents.h: * embed/mozilla/MozillaPrivate.cpp: * embed/mozilla/MozillaPrivate.h: * embed/mozilla/PrintingPromptService.cpp: * embed/mozilla/PrintingPromptService.h: * embed/mozilla/mozilla-download.cpp: * embed/mozilla/mozilla-download.h: * embed/mozilla/mozilla-embed-event.cpp: * embed/mozilla/mozilla-embed-event.h: * embed/mozilla/mozilla-embed-find.cpp: * embed/mozilla/mozilla-embed-find.h: * embed/mozilla/mozilla-embed-persist.cpp: * embed/mozilla/mozilla-embed-persist.h: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-embed.cpp: * embed/mozilla/mozilla-embed.h: * embed/mozilla/mozilla-notifiers.cpp: * embed/mozilla/mozilla-notifiers.h: * embed/mozilla/mozilla-x509-cert.cpp: * embed/mozilla/mozilla-x509-cert.h: * lib/ephy-gui.c: * lib/ephy-gui.h: * lib/ephy-langs.c: * m4/gecko.m4: * src/ephy-window.c: (sync_tab_security): * src/prefs-dialog.c: (prefs_dialog_init): Drop support for gecko 1.7.
Diffstat (limited to 'embed/mozilla/EphyFind.cpp')
-rw-r--r--embed/mozilla/EphyFind.cpp125
1 files changed, 24 insertions, 101 deletions
diff --git a/embed/mozilla/EphyFind.cpp b/embed/mozilla/EphyFind.cpp
index c1625cc8c..ba2b653fc 100644
--- a/embed/mozilla/EphyFind.cpp
+++ b/embed/mozilla/EphyFind.cpp
@@ -19,62 +19,50 @@
*/
#include "mozilla-config.h"
-
#include "config.h"
-#include "EphyFind.h"
-
-#include "ephy-debug.h"
+#include <glib.h>
-#undef MOZILLA_INTERNAL_API
-#include <nsEmbedString.h>
-#define MOZILLA_INTERNAL_API 1
+#include <nsStringAPI.h>
#include <gtkmozembed.h>
#include <gtkmozembed_internal.h>
+#include <nsComponentManagerUtils.h>
#include <nsCOMPtr.h>
-#include <nsIServiceManager.h>
-#include <nsIInterfaceRequestorUtils.h>
-#include <nsIDOMWindow.h>
-#include <nsIWebBrowser.h>
-#include <nsIWebBrowserFocus.h>
-#include <nsIDOMNode.h>
-#include <nsIDOMElement.h>
-#include <nsIDOMDocument.h>
-#include <nsIDOMDocumentView.h>
+#include <nsIDocShell.h>
+#include <nsIDocShellTreeItem.h>
#include <nsIDOMAbstractView.h>
#include <nsIDOMDocumentEvent.h>
+#include <nsIDOMDocument.h>
+#include <nsIDOMDocumentView.h>
+#include <nsIDOMElement.h>
#include <nsIDOMEvent.h>
-#include <nsIDOMKeyEvent.h>
#include <nsIDOMEventTarget.h>
#include <nsIDOMHTMLAnchorElement.h>
-
-#ifdef HAVE_TYPEAHEADFIND
+#include <nsIDOMKeyEvent.h>
+#include <nsIDOMNode.h>
+#include <nsIDOMWindow.h>
+#include <nsIInterfaceRequestorUtils.h>
+#include <nsISelectionController.h>
+#include <nsISelectionDisplay.h>
#include <nsISimpleEnumerator.h>
-#include <nsIDocShell.h>
-#include <nsIDocShellTreeItem.h>
#include <nsITypeAheadFind.h>
-#include <nsISelectionDisplay.h>
-#include <nsISelectionController.h>
-#else
-#include <nsIWebBrowserFind.h>
-#include <nsMemory.h>
-#endif
+#include <nsIWebBrowserFocus.h>
+#include <nsIWebBrowser.h>
+#include <nsServiceManagerUtils.h>
-#include <glib.h>
+#include "ephy-debug.h"
+
+#include "EphyFind.h"
-#ifdef HAVE_TYPEAHEADFIND
#define NS_TYPEAHEADFIND_CONTRACTID "@mozilla.org/typeaheadfind;1"
-#endif /* HAVE_TYPEAHEADFIND */
static const PRUnichar kKeyEvents[] = { 'K', 'e', 'y', 'E', 'v', 'e', 'n', 't', 's', '\0' };
static const PRUnichar kKeyPress[] = { 'k', 'e', 'y', 'p', 'r', 'e', 's', 's', '\0' };
EphyFind::EphyFind ()
: mCurrentEmbed(nsnull)
-#ifdef HAVE_TYPEAHEADFIND
, mAttention(PR_FALSE)
-#endif
{
LOG ("EphyFind ctor [%p]", this);
}
@@ -100,7 +88,6 @@ EphyFind::SetEmbed (EphyEmbed *aEmbed)
getter_AddRefs (mWebBrowser));
NS_ENSURE_TRUE (mWebBrowser, rv);
-#ifdef HAVE_TYPEAHEADFIND
nsCOMPtr<nsIDocShell> docShell (do_GetInterface (mWebBrowser, &rv));
NS_ENSURE_SUCCESS (rv, rv);
@@ -114,22 +101,6 @@ EphyFind::SetEmbed (EphyEmbed *aEmbed)
rv = mFinder->SetDocShell (docShell);
}
NS_ENSURE_SUCCESS (rv, rv);
-#else
- PRUnichar *string = nsnull;
- if (mFinder) {
- mFinder->GetSearchString (&string);
- }
-
- mFinder = do_GetInterface (mWebBrowser, &rv);
- NS_ENSURE_SUCCESS (rv, rv);
-
- mFinder->SetWrapFind (PR_TRUE);
-
- if (string) {
- mFinder->SetSearchString (string);
- nsMemory::Free (string);
- }
-#endif /* HAVE_TYPEAHEADFIND */
mCurrentEmbed = aEmbed;
@@ -142,24 +113,13 @@ EphyFind::SetFindProperties (const char *aSearchString,
{
if (!mFinder) return;
-#ifdef HAVE_TYPEAHEADFIND
mFinder->SetCaseSensitive (aCaseSensitive);
/* search string is set on ::Find */
-#else
- mFinder->SetMatchCase (aCaseSensitive);
-
- nsEmbedString uSearchString;
- NS_CStringToUTF16 (nsEmbedCString (aSearchString ? aSearchString : ""),
- NS_CSTRING_ENCODING_UTF8, uSearchString);
-
- mFinder->SetSearchString (uSearchString.get ());
-#endif /* TYPEAHEADFIND */
}
void
EphyFind::SetSelectionAttention (PRBool aAttention)
{
-#ifdef HAVE_TYPEAHEADFIND
if (aAttention == mAttention) return;
mAttention = aAttention;
@@ -198,7 +158,6 @@ EphyFind::SetSelectionAttention (PRBool aAttention)
controller->SetDisplaySelection (display);
}
-#endif
}
EphyEmbedFindResult
@@ -207,11 +166,10 @@ EphyFind::Find (const char *aSearchString,
{
if (!mFinder) return EPHY_EMBED_FIND_NOTFOUND;
- nsEmbedString uSearchString;
- NS_CStringToUTF16 (nsEmbedCString (aSearchString ? aSearchString : ""),
+ nsString uSearchString;
+ NS_CStringToUTF16 (nsCString (aSearchString ? aSearchString : ""),
NS_CSTRING_ENCODING_UTF8, uSearchString);
-#ifdef HAVE_TYPEAHEADFIND
SetSelectionAttention (PR_TRUE);
nsresult rv;
@@ -219,17 +177,6 @@ EphyFind::Find (const char *aSearchString,
rv = mFinder->Find (uSearchString, aLinksOnly, &found);
return (EphyEmbedFindResult) found;
-#else
- mFinder->SetSearchString (uSearchString.get ());
- mFinder->SetFindBackwards (PR_FALSE);
-
- nsresult rv;
- PRBool didFind = PR_FALSE;
- rv = mFinder->FindNext (&didFind);
-
- return NS_SUCCEEDED (rv) && didFind ? EPHY_EMBED_FIND_FOUND :
- EPHY_EMBED_FIND_NOTFOUND;
-#endif /* HAVE_TYPEAHEADFIND */
}
EphyEmbedFindResult
@@ -237,7 +184,6 @@ EphyFind::FindAgain (PRBool aForward)
{
if (!mFinder) return EPHY_EMBED_FIND_NOTFOUND;
-#ifdef HAVE_TYPEAHEADFIND
SetSelectionAttention (PR_TRUE);
nsresult rv;
@@ -249,16 +195,6 @@ EphyFind::FindAgain (PRBool aForward)
}
return (EphyEmbedFindResult) found;
-#else
- mFinder->SetFindBackwards (!aForward);
-
- nsresult rv;
- PRBool didFind = PR_FALSE;
- rv = mFinder->FindNext (&didFind);
-
- return NS_SUCCEEDED (rv) && didFind ? EPHY_EMBED_FIND_FOUND :
- EPHY_EMBED_FIND_NOTFOUND;
-#endif /* HAVE_TYPEAHEADFIND */
}
PRBool
@@ -266,21 +202,8 @@ EphyFind::ActivateLink (GdkModifierType aMask)
{
nsresult rv;
nsCOMPtr<nsIDOMElement> link;
-#if defined(HAVE_TYPEAHEADFIND) && defined(HAVE_GECKO_1_8)
rv = mFinder->GetFoundLink (getter_AddRefs (link));
if (NS_FAILED (rv) || !link) return FALSE;
-#else
- nsCOMPtr<nsIWebBrowserFocus> focus (do_QueryInterface (mWebBrowser));
- NS_ENSURE_TRUE (focus, FALSE);
-
- rv = focus->GetFocusedElement (getter_AddRefs (link));
- NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && link, FALSE);
-
- /* ensure this is really a link so we don't accidentally submit if we're on a button or so! */
- /* FIXME: does that work with xlink links? */
- nsCOMPtr<nsIDOMHTMLAnchorElement> anchor (do_QueryInterface (link));
- if (!anchor) return FALSE;
-#endif /* HAVE_TYPEAHEADFIND && HAVE_GECKO_1_8 */
nsCOMPtr<nsIDOMDocument> doc;
rv = link->GetOwnerDocument (getter_AddRefs (doc));
@@ -297,13 +220,13 @@ EphyFind::ActivateLink (GdkModifierType aMask)
NS_ENSURE_TRUE (docEvent, FALSE);
nsCOMPtr<nsIDOMEvent> event;
- rv = docEvent->CreateEvent (nsEmbedString(kKeyEvents), getter_AddRefs (event));
+ rv = docEvent->CreateEvent (nsString(kKeyEvents), getter_AddRefs (event));
NS_ENSURE_SUCCESS (rv, FALSE);
nsCOMPtr<nsIDOMKeyEvent> keyEvent (do_QueryInterface (event));
NS_ENSURE_TRUE (keyEvent, FALSE);
- rv = keyEvent->InitKeyEvent (nsEmbedString (kKeyPress),
+ rv = keyEvent->InitKeyEvent (nsString (kKeyPress),
PR_TRUE /* bubble */,
PR_TRUE /* cancelable */,
abstractView,