aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyFind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'embed/mozilla/EphyFind.cpp')
-rw-r--r--embed/mozilla/EphyFind.cpp44
1 files changed, 35 insertions, 9 deletions
diff --git a/embed/mozilla/EphyFind.cpp b/embed/mozilla/EphyFind.cpp
index ba2b653fc..cfc394e7e 100644
--- a/embed/mozilla/EphyFind.cpp
+++ b/embed/mozilla/EphyFind.cpp
@@ -30,7 +30,6 @@
#include <nsComponentManagerUtils.h>
#include <nsCOMPtr.h>
#include <nsIDocShell.h>
-#include <nsIDocShellTreeItem.h>
#include <nsIDOMAbstractView.h>
#include <nsIDOMDocumentEvent.h>
#include <nsIDOMDocument.h>
@@ -45,12 +44,16 @@
#include <nsIInterfaceRequestorUtils.h>
#include <nsISelectionController.h>
#include <nsISelectionDisplay.h>
-#include <nsISimpleEnumerator.h>
#include <nsITypeAheadFind.h>
#include <nsIWebBrowserFocus.h>
#include <nsIWebBrowser.h>
#include <nsServiceManagerUtils.h>
+#ifndef HAVE_GECKO_1_9
+#include <nsIDocShellTreeItem.h>
+#include <nsISimpleEnumerator.h>
+#endif
+
#include "ephy-debug.h"
#include "EphyFind.h"
@@ -63,6 +66,7 @@ static const PRUnichar kKeyPress[] = { 'k', 'e', 'y', 'p', 'r', 'e', 's', 's', '
EphyFind::EphyFind ()
: mCurrentEmbed(nsnull)
, mAttention(PR_FALSE)
+, mHasFocus(PR_FALSE) /* FIXME!! */
{
LOG ("EphyFind ctor [%p]", this);
}
@@ -96,7 +100,11 @@ EphyFind::SetEmbed (EphyEmbed *aEmbed)
NS_ENSURE_SUCCESS (rv, rv);
rv = mFinder->Init (docShell);
+#ifdef HAVE_GECKO_1_9
+// mFinder->SetSelectionModeAndRepaint (nsISelectionController::SELECTION_ON);
+#else
mFinder->SetFocusLinks (PR_TRUE);
+#endif
} else {
rv = mFinder->SetDocShell (docShell);
}
@@ -124,6 +132,18 @@ EphyFind::SetSelectionAttention (PRBool aAttention)
mAttention = aAttention;
+ PRInt16 display;
+ if (aAttention) {
+ display = nsISelectionController::SELECTION_ATTENTION;
+ } else {
+ display = nsISelectionController::SELECTION_ON;
+ }
+
+#ifdef HAVE_GECKO_1_9
+ if (mFinder) {
+ mFinder->SetSelectionModeAndRepaint (display);
+ }
+#else
nsresult rv;
nsCOMPtr<nsIDocShell> shell (do_GetInterface (mWebBrowser, &rv));
/* It's okay for this to fail, if the tab is closing, or if
@@ -137,13 +157,6 @@ EphyFind::SetSelectionAttention (PRBool aAttention)
getter_AddRefs (enumerator));
NS_ENSURE_SUCCESS (rv, );
- PRInt16 display;
- if (aAttention) {
- display = nsISelectionController::SELECTION_ATTENTION;
- } else {
- display = nsISelectionController::SELECTION_ON;
- }
-
PRBool hasMore = PR_FALSE;
while (NS_SUCCEEDED (enumerator->HasMoreElements (&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> element;
@@ -158,6 +171,7 @@ EphyFind::SetSelectionAttention (PRBool aAttention)
controller->SetDisplaySelection (display);
}
+#endif /* HAVE_GECKO_1_9 */
}
EphyEmbedFindResult
@@ -174,7 +188,11 @@ EphyFind::Find (const char *aSearchString,
nsresult rv;
PRUint16 found = nsITypeAheadFind::FIND_NOTFOUND;
+#ifdef HAVE_GECKO_1_9
+ rv = mFinder->Find (uSearchString, aLinksOnly, mHasFocus, &found);
+#else
rv = mFinder->Find (uSearchString, aLinksOnly, &found);
+#endif
return (EphyEmbedFindResult) found;
}
@@ -189,9 +207,17 @@ EphyFind::FindAgain (PRBool aForward)
nsresult rv;
PRUint16 found = nsITypeAheadFind::FIND_NOTFOUND;
if (aForward) {
+#ifdef HAVE_GECKO_1_9
+ rv = mFinder->FindNext (mHasFocus, &found);
+#else
rv = mFinder->FindNext (&found);
+#endif
} else {
+#ifdef HAVE_GECKO_1_9
+ rv = mFinder->FindPrevious (mHasFocus, &found);
+#else
rv = mFinder->FindPrevious (&found);
+#endif
}
return (EphyEmbedFindResult) found;