From 72f93103b9a052d013c2b8d2fbf180f51e2d0489 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Thu, 6 Jul 2006 19:00:32 +0000 Subject: Guess what? Another mozilla API change! 2006-07-06 Christian Persch * embed/mozilla/EphyFind.cpp: * embed/mozilla/EphyFind.h: Guess what? Another mozilla API change! --- embed/mozilla/EphyFind.cpp | 44 +++++++++++++++++++++++++++++++++++--------- embed/mozilla/EphyFind.h | 3 ++- 2 files changed, 37 insertions(+), 10 deletions(-) (limited to 'embed') 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 #include #include -#include #include #include #include @@ -45,12 +44,16 @@ #include #include #include -#include #include #include #include #include +#ifndef HAVE_GECKO_1_9 +#include +#include +#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 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 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; diff --git a/embed/mozilla/EphyFind.h b/embed/mozilla/EphyFind.h index b7084d8ff..f1d695966 100644 --- a/embed/mozilla/EphyFind.h +++ b/embed/mozilla/EphyFind.h @@ -53,7 +53,8 @@ class EphyFind nsCOMPtr mWebBrowser; nsCOMPtr mFinder; - PRBool mAttention; + PRPackedBool mAttention; + PRPackedBool mHasFocus; }; #endif /* !TYPEAHEADFIND_H */ -- cgit v1.2.3