Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 114044
Collapse All | Expand All

(-)extensions/typeaheadfind/Makefile.in (-1 / +1 lines)
Lines 31-37 Link Here
31
31
32
include $(DEPTH)/config/autoconf.mk
32
include $(DEPTH)/config/autoconf.mk
33
33
34
MODULE		= typeaheadfind
34
MODULE		= typeaheadfindsea
35
DIRS		= public src resources
35
DIRS		= public src resources
36
36
37
include $(topsrcdir)/config/rules.mk
37
include $(topsrcdir)/config/rules.mk
(-)extensions/typeaheadfind/public/Makefile.in (-3 / +3 lines)
Lines 31-41 Link Here
31
31
32
include $(DEPTH)/config/autoconf.mk
32
include $(DEPTH)/config/autoconf.mk
33
33
34
MODULE=typeaheadfind
34
MODULE=typeaheadfindsea
35
XPIDL_MODULE=typeaheadfind
35
XPIDL_MODULE=typeaheadfindsea
36
GRE_MODULE	= 1
36
GRE_MODULE	= 1
37
37
38
XPIDLSRCS= ./nsITypeAheadFind.idl \
38
XPIDLSRCS= ./nsITypeAheadFindSea.idl \
39
  $(NULL)
39
  $(NULL)
40
40
41
41
(-)extensions/typeaheadfind/public/nsITypeAheadFind.idl (-90 lines)
Lines 1-90 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Netscape Public License
6
 * Version 1.1 (the "License"); you may not use this file except in
7
 * compliance with the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/NPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is mozilla.org code.
16
 *
17
 * The Initial Developer of the Original Code is 
18
 * Netscape Communications Corporation.
19
 * Portions created by the Initial Developer are Copyright (C) 1998
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 * Original Author: Aaron Leventhal (aaronl@netscape.com)
24
 * Contributors:    
25
 *
26
 *
27
 * Alternatively, the contents of this file may be used under the terms of
28
 * either the GNU General Public License Version 2 or later (the "GPL"), or
29
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30
 * in which case the provisions of the GPL or the LGPL are applicable instead
31
 * of those above. If you wish to allow use of your version of this file only
32
 * under the terms of either the GPL or the LGPL, and not to allow others to
33
 * use your version of this file under the terms of the NPL, indicate your
34
 * decision by deleting the provisions above and replace them with the notice
35
 * and other provisions required by the GPL or the LGPL. If you do not delete
36
 * the provisions above, a recipient may use your version of this file under
37
 * the terms of any one of the NPL, the GPL or the LGPL.
38
 *
39
 * ***** END LICENSE BLOCK ***** */
40
41
#include "nsISupports.idl"
42
#include "domstubs.idl"
43
#include "nsISupportsPrimitives.idl"
44
45
%{ C++
46
  #include "nsIDOMEvent.h"
47
48
  #define NS_TYPEAHEADFIND_CID \
49
    {0x46590685, 0xbc00, 0x4aac, {0xab, 0xed, 0x2c, 0x10, 0xa5, 0xb9, 0x45, 0xa4}}
50
51
  #define NS_TYPEAHEADFIND_CONTRACTID "@mozilla.org/typeaheadfind;1"
52
%}
53
54
interface nsIDOMEvent;
55
56
[scriptable, uuid(AD1C62CC-72F4-4c5b-BE78-503854F9E0D8)]
57
interface nsITypeAheadFind : nsISupports
58
{
59
  /** Is type ahead find mode currently on? */
60
  readonly attribute boolean isActive;
61
62
  /** Manually start type ahead find mode */
63
  void startNewFind(in nsIDOMWindow aWindow, in boolean aLinksOnly);
64
65
  /** Manually cancel type ahead find mode */
66
  void cancelFind();
67
68
  /**
69
    * Will find as you type start automatically if the user
70
    * types with the focus on page content other than a textfield or select?
71
    * If autostart is off, the startNewFind() method can be used to enact
72
    * type ahead find, as well as cmd_findTypeLinks or cmd_findTypeText.
73
    */
74
  void setAutoStart(in nsIDOMWindow aWindow, in boolean aIsAutoStartOn);
75
  boolean getAutoStart(in nsIDOMWindow aWindow);  
76
77
  /**
78
    * Find next recurrence if typeaheadfind was the last used find, 
79
    * as opposed to regular find. Returns false in nsISupportsPRBool if we
80
    * don't handle the request.
81
    */
82
  void findNext(in boolean aReverse, in nsISupportsInterfacePointer aCallerWindowSupports);
83
84
  /*
85
   * Go back and remove one character from find string
86
   * Returns true if backspace used
87
   */
88
  boolean backOneChar();
89
};
90
(-)extensions/typeaheadfind/public/nsITypeAheadFindSea.idl (+90 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Netscape Public License
6
 * Version 1.1 (the "License"); you may not use this file except in
7
 * compliance with the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/NPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is mozilla.org code.
16
 *
17
 * The Initial Developer of the Original Code is 
18
 * Netscape Communications Corporation.
19
 * Portions created by the Initial Developer are Copyright (C) 1998
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 * Original Author: Aaron Leventhal (aaronl@netscape.com)
24
 * Contributors:    
25
 *
26
 *
27
 * Alternatively, the contents of this file may be used under the terms of
28
 * either the GNU General Public License Version 2 or later (the "GPL"), or
29
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30
 * in which case the provisions of the GPL or the LGPL are applicable instead
31
 * of those above. If you wish to allow use of your version of this file only
32
 * under the terms of either the GPL or the LGPL, and not to allow others to
33
 * use your version of this file under the terms of the NPL, indicate your
34
 * decision by deleting the provisions above and replace them with the notice
35
 * and other provisions required by the GPL or the LGPL. If you do not delete
36
 * the provisions above, a recipient may use your version of this file under
37
 * the terms of any one of the NPL, the GPL or the LGPL.
38
 *
39
 * ***** END LICENSE BLOCK ***** */
40
41
#include "nsISupports.idl"
42
#include "domstubs.idl"
43
#include "nsISupportsPrimitives.idl"
44
45
%{ C++
46
  #include "nsIDOMEvent.h"
47
48
  #define NS_TYPEAHEADFINDSEA_CID \
49
    {0x46590685, 0xbc00, 0x4aac, {0xab, 0xed, 0x2c, 0x10, 0xa5, 0xb9, 0x45, 0xa4}}
50
51
  #define NS_TYPEAHEADFINDSEA_CONTRACTID "@mozilla.org/typeaheadfindsea;1"
52
%}
53
54
interface nsIDOMEvent;
55
56
[scriptable, uuid(AD1C62CC-72F4-4c5b-BE78-503854F9E0D8)]
57
interface nsITypeAheadFindSea : nsISupports
58
{
59
  /** Is type ahead find mode currently on? */
60
  readonly attribute boolean isActive;
61
62
  /** Manually start type ahead find mode */
63
  void startNewFind(in nsIDOMWindow aWindow, in boolean aLinksOnly);
64
65
  /** Manually cancel type ahead find mode */
66
  void cancelFind();
67
68
  /**
69
    * Will find as you type start automatically if the user
70
    * types with the focus on page content other than a textfield or select?
71
    * If autostart is off, the startNewFind() method can be used to enact
72
    * type ahead find, as well as cmd_findTypeLinks or cmd_findTypeText.
73
    */
74
  void setAutoStart(in nsIDOMWindow aWindow, in boolean aIsAutoStartOn);
75
  boolean getAutoStart(in nsIDOMWindow aWindow);  
76
77
  /**
78
    * Find next recurrence if typeaheadfindsea was the last used find, 
79
    * as opposed to regular find. Returns false in nsISupportsPRBool if we
80
    * don't handle the request.
81
    */
82
  void findNext(in boolean aReverse, in nsISupportsInterfacePointer aCallerWindowSupports);
83
84
  /*
85
   * Go back and remove one character from find string
86
   * Returns true if backspace used
87
   */
88
  boolean backOneChar();
89
};
90
(-)extensions/typeaheadfind/resources/content/prefs/typeaheadfind.js (-4 / +4 lines)
Lines 36-42 Link Here
36
 *
36
 *
37
 * ***** END LICENSE BLOCK ***** */
37
 * ***** END LICENSE BLOCK ***** */
38
38
39
pref("accessibility.typeaheadfind", true);
39
pref("accessibility.typeaheadfindsea", true);
40
pref("accessibility.typeaheadfind.linksonly", true);
40
pref("accessibility.typeaheadfindsea.linksonly", true);
41
pref("accessibility.typeaheadfind.startlinksonly", false);
41
pref("accessibility.typeaheadfindsea.startlinksonly", false);
42
pref("accessibility.typeaheadfind.timeout", 5000);
42
pref("accessibility.typeaheadfindsea.timeout", 5000);
(-)extensions/typeaheadfind/resources/jar.mn (-1 / +1 lines)
Lines 1-5 Link Here
1
en-US.jar:
1
en-US.jar:
2
    locale/en-US/global/typeaheadfind.properties  (locale/en-US/typeaheadfind.properties)
2
    locale/en-US/global/typeaheadfindsea.properties  (locale/en-US/typeaheadfindsea.properties)
3
3
4
toolkit.jar:
4
toolkit.jar:
5
    content/global/notfound.wav                   (content/notfound.wav)
5
    content/global/notfound.wav                   (content/notfound.wav)
(-)extensions/typeaheadfind/resources/locale/en-US/typeaheadfind.properties (-13 lines)
Lines 1-13 Link Here
1
openparen     = (
2
closeparen    = )
3
textfound     = Text found: "
4
textnotfound  = Text not found: "
5
linkfound     = Link found: "
6
linknotfound  = Link not found: "
7
closequote    = "
8
stopfind      = Find stopped.
9
starttextfind = Starting -- find text as you type
10
startlinkfind = Starting -- find links as you type
11
repeated      = repeated
12
nextmatch     = - next match
13
prevmatch     = - previous match
(-)extensions/typeaheadfind/resources/locale/en-US/typeaheadfindsea.properties (+13 lines)
Line 0 Link Here
1
openparen     = (
2
closeparen    = )
3
textfound     = Text found: "
4
textnotfound  = Text not found: "
5
linkfound     = Link found: "
6
linknotfound  = Link not found: "
7
closequote    = "
8
stopfind      = Find stopped.
9
starttextfind = Starting -- find text as you type
10
startlinkfind = Starting -- find links as you type
11
repeated      = repeated
12
nextmatch     = - next match
13
prevmatch     = - previous match
(-)extensions/typeaheadfind/src/Makefile.in (-5 / +5 lines)
Lines 31-44 Link Here
31
31
32
include $(DEPTH)/config/autoconf.mk
32
include $(DEPTH)/config/autoconf.mk
33
33
34
MODULE = typeaheadfind
34
MODULE = typeaheadfindsea
35
LIBRARY_NAME = typeaheadfind
35
LIBRARY_NAME = typeaheadfindsea
36
ifneq ($(OS_ARCH),WINNT)
36
ifneq ($(OS_ARCH),WINNT)
37
SHORT_LIBNAME = typahead
37
SHORT_LIBNAME = typaheadsea
38
endif
38
endif
39
GRE_MODULE	= 1
39
GRE_MODULE	= 1
40
40
41
PACKAGE_FILE = typeaheadfind.pkg
41
PACKAGE_FILE = typeaheadfindsea.pkg
42
42
43
REQUIRES	= appcomps \
43
REQUIRES	= appcomps \
44
		  embedcomponents \
44
		  embedcomponents \
Lines 66-72 Link Here
66
66
67
EXPORT_LIBRARY = 1
67
EXPORT_LIBRARY = 1
68
IS_COMPONENT = 1
68
IS_COMPONENT = 1
69
MODULE_NAME	= nsTypeAheadFind
69
MODULE_NAME	= nsTypeAheadFindSea
70
70
71
CPPSRCS =   \
71
CPPSRCS =   \
72
  nsTypeAheadFind.cpp	   \
72
  nsTypeAheadFind.cpp	   \
(-)extensions/typeaheadfind/src/nsTypeAheadFind.cpp (-83 / +83 lines)
Lines 117-124 Link Here
117
////////////////////////////////////////////////////////////////////////
117
////////////////////////////////////////////////////////////////////////
118
118
119
119
120
NS_INTERFACE_MAP_BEGIN(nsTypeAheadFind)
120
NS_INTERFACE_MAP_BEGIN(nsTypeAheadFindSea)
121
  NS_INTERFACE_MAP_ENTRY(nsITypeAheadFind)
121
  NS_INTERFACE_MAP_ENTRY(nsITypeAheadFindSea)
122
  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
122
  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
123
  NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
123
  NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
124
  NS_INTERFACE_MAP_ENTRY(nsIScrollPositionListener)
124
  NS_INTERFACE_MAP_ENTRY(nsIScrollPositionListener)
Lines 131-138 Link Here
131
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMKeyListener)
131
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMKeyListener)
132
NS_INTERFACE_MAP_END
132
NS_INTERFACE_MAP_END
133
133
134
NS_IMPL_ADDREF(nsTypeAheadFind)
134
NS_IMPL_ADDREF(nsTypeAheadFindSea)
135
NS_IMPL_RELEASE(nsTypeAheadFind)
135
NS_IMPL_RELEASE(nsTypeAheadFindSea)
136
136
137
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
137
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
138
static NS_DEFINE_CID(kStringBundleServiceCID,  NS_STRINGBUNDLESERVICE_CID);
138
static NS_DEFINE_CID(kStringBundleServiceCID,  NS_STRINGBUNDLESERVICE_CID);
Lines 141-151 Link Here
141
141
142
#define NS_FIND_CONTRACTID "@mozilla.org/embedcomp/rangefind;1"
142
#define NS_FIND_CONTRACTID "@mozilla.org/embedcomp/rangefind;1"
143
143
144
nsTypeAheadFind* nsTypeAheadFind::sInstance = nsnull;
144
nsTypeAheadFindSea* nsTypeAheadFindSea::sInstance = nsnull;
145
PRInt32 nsTypeAheadFind::sAccelKey = -1;  // magic value of -1 when unitialized
145
PRInt32 nsTypeAheadFindSea::sAccelKey = -1;  // magic value of -1 when unitialized
146
146
147
147
148
nsTypeAheadFind::nsTypeAheadFind():
148
nsTypeAheadFindSea::nsTypeAheadFindSea():
149
  mIsFindAllowedInWindow(PR_FALSE), mAutoStartPref(PR_FALSE),
149
  mIsFindAllowedInWindow(PR_FALSE), mAutoStartPref(PR_FALSE),
150
  mLinksOnlyPref(PR_FALSE), mStartLinksOnlyPref(PR_FALSE),
150
  mLinksOnlyPref(PR_FALSE), mStartLinksOnlyPref(PR_FALSE),
151
  mLinksOnly(PR_FALSE), mIsTypeAheadOn(PR_FALSE), mCaretBrowsingOn(PR_FALSE),
151
  mLinksOnly(PR_FALSE), mIsTypeAheadOn(PR_FALSE), mCaretBrowsingOn(PR_FALSE),
Lines 164-188 Link Here
164
  static PRInt32 gInstanceCount;
164
  static PRInt32 gInstanceCount;
165
  ++gInstanceCount;
165
  ++gInstanceCount;
166
  NS_ASSERTION(gInstanceCount == 1,
166
  NS_ASSERTION(gInstanceCount == 1,
167
    "There should be only 1 instance of nsTypeAheadFind!");
167
    "There should be only 1 instance of nsTypeAheadFindSea!");
168
#endif
168
#endif
169
}
169
}
170
170
171
171
172
nsTypeAheadFind::~nsTypeAheadFind()
172
nsTypeAheadFindSea::~nsTypeAheadFindSea()
173
{
173
{
174
  RemoveDocListeners();
174
  RemoveDocListeners();
175
  mTimer = nsnull;
175
  mTimer = nsnull;
176
176
177
  nsCOMPtr<nsIPrefBranchInternal> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
177
  nsCOMPtr<nsIPrefBranchInternal> prefInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
178
  if (prefInternal) {
178
  if (prefInternal) {
179
    prefInternal->RemoveObserver("accessibility.typeaheadfind", this);
179
    prefInternal->RemoveObserver("accessibility.typeaheadfindsea", this);
180
    prefInternal->RemoveObserver("accessibility.browsewithcaret", this);
180
    prefInternal->RemoveObserver("accessibility.browsewithcaret", this);
181
  }
181
  }
182
}
182
}
183
183
184
nsresult
184
nsresult
185
nsTypeAheadFind::Init()
185
nsTypeAheadFindSea::Init()
186
{
186
{
187
  nsresult rv = NS_NewISupportsArray(getter_AddRefs(mManualFindWindows));
187
  nsresult rv = NS_NewISupportsArray(getter_AddRefs(mManualFindWindows));
188
  NS_ENSURE_SUCCESS(rv, rv);
188
  NS_ENSURE_SUCCESS(rv, rv);
Lines 199-205 Link Here
199
  }
199
  }
200
200
201
  // ----------- Listen to prefs ------------------
201
  // ----------- Listen to prefs ------------------
202
  rv = prefInternal->AddObserver("accessibility.typeaheadfind", this, PR_FALSE);
202
  rv = prefInternal->AddObserver("accessibility.typeaheadfindsea", this, PR_FALSE);
203
  NS_ENSURE_SUCCESS(rv, rv);
203
  NS_ENSURE_SUCCESS(rv, rv);
204
204
205
  rv = prefInternal->AddObserver("accessibility.browsewithcaret", this, PR_FALSE);
205
  rv = prefInternal->AddObserver("accessibility.browsewithcaret", this, PR_FALSE);
Lines 220-230 Link Here
220
  return rv;
220
  return rv;
221
}
221
}
222
222
223
nsTypeAheadFind *
223
nsTypeAheadFindSea *
224
nsTypeAheadFind::GetInstance()
224
nsTypeAheadFindSea::GetInstance()
225
{
225
{
226
  if (!sInstance) {
226
  if (!sInstance) {
227
    sInstance = new nsTypeAheadFind();
227
    sInstance = new nsTypeAheadFindSea();
228
    if (!sInstance)
228
    if (!sInstance)
229
      return nsnull;
229
      return nsnull;
230
230
Lines 244-257 Link Here
244
244
245
245
246
void
246
void
247
nsTypeAheadFind::ReleaseInstance()
247
nsTypeAheadFindSea::ReleaseInstance()
248
{
248
{
249
  NS_IF_RELEASE(sInstance);
249
  NS_IF_RELEASE(sInstance);
250
}
250
}
251
251
252
252
253
void 
253
void 
254
nsTypeAheadFind::Shutdown()
254
nsTypeAheadFindSea::Shutdown()
255
{
255
{
256
  // Application shutdown 
256
  // Application shutdown 
257
  mTimer = nsnull;
257
  mTimer = nsnull;
Lines 267-280 Link Here
267
// ------- Pref Callbacks (2) ---------------
267
// ------- Pref Callbacks (2) ---------------
268
268
269
nsresult
269
nsresult
270
nsTypeAheadFind::PrefsReset()
270
nsTypeAheadFindSea::PrefsReset()
271
{
271
{
272
  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
272
  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
273
  NS_ENSURE_TRUE(prefBranch, NS_ERROR_FAILURE);
273
  NS_ENSURE_TRUE(prefBranch, NS_ERROR_FAILURE);
274
274
275
  PRBool wasTypeAheadOn = mIsTypeAheadOn;
275
  PRBool wasTypeAheadOn = mIsTypeAheadOn;
276
276
277
  prefBranch->GetBoolPref("accessibility.typeaheadfind", &mIsTypeAheadOn);
277
  prefBranch->GetBoolPref("accessibility.typeaheadfindsea", &mIsTypeAheadOn);
278
278
279
  if (mIsTypeAheadOn != wasTypeAheadOn) {
279
  if (mIsTypeAheadOn != wasTypeAheadOn) {
280
    if (!mIsTypeAheadOn) {
280
    if (!mIsTypeAheadOn) {
Lines 294-300 Link Here
294
        do_GetService(kStringBundleServiceCID);
294
        do_GetService(kStringBundleServiceCID);
295
295
296
      if (stringBundleService)
296
      if (stringBundleService)
297
        stringBundleService->CreateBundle(TYPEAHEADFIND_BUNDLE_URL,
297
        stringBundleService->CreateBundle(TYPEAHEADFINDSEA_BUNDLE_URL,
298
                                          getter_AddRefs(mStringBundle));
298
                                          getter_AddRefs(mStringBundle));
299
299
300
      // Observe find again commands. We'll handle them if we were the last find
300
      // Observe find again commands. We'll handle them if we were the last find
Lines 309-342 Link Here
309
  }
309
  }
310
310
311
  PRBool oldAutoStartPref = mAutoStartPref;
311
  PRBool oldAutoStartPref = mAutoStartPref;
312
  prefBranch->GetBoolPref("accessibility.typeaheadfind.autostart",
312
  prefBranch->GetBoolPref("accessibility.typeaheadfindsea.autostart",
313
                           &mAutoStartPref);
313
                           &mAutoStartPref);
314
  if (mAutoStartPref != oldAutoStartPref) {
314
  if (mAutoStartPref != oldAutoStartPref) {
315
    ResetGlobalAutoStart(mAutoStartPref);
315
    ResetGlobalAutoStart(mAutoStartPref);
316
  }
316
  }
317
 
317
 
318
  prefBranch->GetBoolPref("accessibility.typeaheadfind.linksonly",
318
  prefBranch->GetBoolPref("accessibility.typeaheadfindsea.linksonly",
319
                          &mLinksOnlyPref);
319
                          &mLinksOnlyPref);
320
320
321
  prefBranch->GetBoolPref("accessibility.typeaheadfind.startlinksonly",
321
  prefBranch->GetBoolPref("accessibility.typeaheadfindsea.startlinksonly",
322
                          &mStartLinksOnlyPref);
322
                          &mStartLinksOnlyPref);
323
323
324
  PRBool isSoundEnabled = PR_TRUE;
324
  PRBool isSoundEnabled = PR_TRUE;
325
  prefBranch->GetBoolPref("accessibility.typeaheadfind.enablesound",
325
  prefBranch->GetBoolPref("accessibility.typeaheadfindsea.enablesound",
326
                           &isSoundEnabled);
326
                           &isSoundEnabled);
327
  nsXPIDLCString soundStr;
327
  nsXPIDLCString soundStr;
328
  if (isSoundEnabled) {
328
  if (isSoundEnabled) {
329
    prefBranch->GetCharPref("accessibility.typeaheadfind.soundURL",
329
    prefBranch->GetCharPref("accessibility.typeaheadfindsea.soundURL",
330
                             getter_Copies(soundStr));
330
                             getter_Copies(soundStr));
331
  }
331
  }
332
  mNotFoundSoundURL = soundStr;
332
  mNotFoundSoundURL = soundStr;
333
333
334
  PRBool isTimeoutEnabled;
334
  PRBool isTimeoutEnabled;
335
  prefBranch->GetBoolPref("accessibility.typeaheadfind.enabletimeout",
335
  prefBranch->GetBoolPref("accessibility.typeaheadfindsea.enabletimeout",
336
                          &isTimeoutEnabled);
336
                          &isTimeoutEnabled);
337
  PRInt32 timeoutLength = 0;
337
  PRInt32 timeoutLength = 0;
338
  if (isTimeoutEnabled) {
338
  if (isTimeoutEnabled) {
339
    prefBranch->GetIntPref("accessibility.typeaheadfind.timeout",
339
    prefBranch->GetIntPref("accessibility.typeaheadfindsea.timeout",
340
                           &timeoutLength);
340
                           &timeoutLength);
341
  }
341
  }
342
  mTimeoutLength = timeoutLength;
342
  mTimeoutLength = timeoutLength;
Lines 352-358 Link Here
352
// ------- nsITimer Methods (1) ---------------
352
// ------- nsITimer Methods (1) ---------------
353
353
354
NS_IMETHODIMP
354
NS_IMETHODIMP
355
nsTypeAheadFind::Notify(nsITimer *timer)
355
nsTypeAheadFindSea::Notify(nsITimer *timer)
356
{
356
{
357
  CancelFind();
357
  CancelFind();
358
  return NS_OK;
358
  return NS_OK;
Lines 361-367 Link Here
361
// ----------- nsIObserver Methods (1) -------------------
361
// ----------- nsIObserver Methods (1) -------------------
362
362
363
NS_IMETHODIMP
363
NS_IMETHODIMP
364
nsTypeAheadFind::Observe(nsISupports *aSubject, const char *aTopic,
364
nsTypeAheadFindSea::Observe(nsISupports *aSubject, const char *aTopic,
365
                         const PRUnichar *aData)
365
                         const PRUnichar *aData)
366
{
366
{
367
  PRBool isOpening;
367
  PRBool isOpening;
Lines 475-481 Link Here
475
475
476
476
477
nsresult
477
nsresult
478
nsTypeAheadFind::UseInWindow(nsIDOMWindow *aDOMWin)
478
nsTypeAheadFindSea::UseInWindow(nsIDOMWindow *aDOMWin)
479
{
479
{
480
  NS_ENSURE_ARG_POINTER(aDOMWin);
480
  NS_ENSURE_ARG_POINTER(aDOMWin);
481
481
Lines 528-534 Link Here
528
// ------- nsIDOMEventListener Methods (1) ---------------
528
// ------- nsIDOMEventListener Methods (1) ---------------
529
529
530
NS_IMETHODIMP
530
NS_IMETHODIMP
531
nsTypeAheadFind::HandleEvent(nsIDOMEvent* aEvent)
531
nsTypeAheadFindSea::HandleEvent(nsIDOMEvent* aEvent)
532
{
532
{
533
  nsAutoString eventType;
533
  nsAutoString eventType;
534
  aEvent->GetType(eventType);
534
  aEvent->GetType(eventType);
Lines 588-608 Link Here
588
// ------- nsIDOMKeyListener Methods (3) ---------------
588
// ------- nsIDOMKeyListener Methods (3) ---------------
589
589
590
NS_IMETHODIMP
590
NS_IMETHODIMP
591
nsTypeAheadFind::KeyDown(nsIDOMEvent* aEvent)
591
nsTypeAheadFindSea::KeyDown(nsIDOMEvent* aEvent)
592
{
592
{
593
  return NS_OK;
593
  return NS_OK;
594
}
594
}
595
595
596
596
597
NS_IMETHODIMP
597
NS_IMETHODIMP
598
nsTypeAheadFind::KeyUp(nsIDOMEvent* aEvent)
598
nsTypeAheadFindSea::KeyUp(nsIDOMEvent* aEvent)
599
{
599
{
600
  return NS_OK;
600
  return NS_OK;
601
}
601
}
602
602
603
603
604
NS_IMETHODIMP
604
NS_IMETHODIMP
605
nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
605
nsTypeAheadFindSea::KeyPress(nsIDOMEvent* aEvent)
606
{
606
{
607
  if (!mIsTypeAheadOn || mIsMenuBarActive || mIsMenuPopupActive) {
607
  if (!mIsTypeAheadOn || mIsMenuBarActive || mIsMenuPopupActive) {
608
    return NS_OK;
608
    return NS_OK;
Lines 732-738 Link Here
732
732
733
733
734
NS_IMETHODIMP
734
NS_IMETHODIMP
735
nsTypeAheadFind::BackOneChar(PRBool *aIsBackspaceUsed)
735
nsTypeAheadFindSea::BackOneChar(PRBool *aIsBackspaceUsed)
736
{
736
{
737
  if (!mFocusedDocSelection) {
737
  if (!mFocusedDocSelection) {
738
    *aIsBackspaceUsed = PR_FALSE;
738
    *aIsBackspaceUsed = PR_FALSE;
Lines 862-868 Link Here
862
862
863
863
864
nsresult
864
nsresult
865
nsTypeAheadFind::HandleChar(PRUnichar aChar)
865
nsTypeAheadFindSea::HandleChar(PRUnichar aChar)
866
{
866
{
867
  // Add a printable char to mTypeAheadBuffer, then search for buffer contents
867
  // Add a printable char to mTypeAheadBuffer, then search for buffer contents
868
868
Lines 1027-1033 Link Here
1027
1027
1028
1028
1029
void
1029
void
1030
nsTypeAheadFind::SaveFind()
1030
nsTypeAheadFindSea::SaveFind()
1031
{
1031
{
1032
  // Store find string for find-next
1032
  // Store find string for find-next
1033
  mFindNextBuffer = mTypeAheadBuffer;
1033
  mFindNextBuffer = mTypeAheadBuffer;
Lines 1048-1061 Link Here
1048
    mFindService->SetSearchString(mFindNextBuffer);
1048
    mFindService->SetSearchString(mFindNextBuffer);
1049
  }
1049
  }
1050
1050
1051
  // --- If accessibility.typeaheadfind.timeout is set,
1051
  // --- If accessibility.typeaheadfindsea.timeout is set,
1052
  //     cancel find after specified # milliseconds ---
1052
  //     cancel find after specified # milliseconds ---
1053
  StartTimeout();
1053
  StartTimeout();
1054
}
1054
}
1055
1055
1056
1056
1057
void
1057
void
1058
nsTypeAheadFind::PlayNotFoundSound()
1058
nsTypeAheadFindSea::PlayNotFoundSound()
1059
{
1059
{
1060
  if (mNotFoundSoundURL.IsEmpty())    // no sound
1060
  if (mNotFoundSoundURL.IsEmpty())    // no sound
1061
    return;
1061
    return;
Lines 1085-1091 Link Here
1085
1085
1086
1086
1087
NS_IMETHODIMP
1087
NS_IMETHODIMP
1088
nsTypeAheadFind::HandleText(nsIDOMEvent* aTextEvent)
1088
nsTypeAheadFindSea::HandleText(nsIDOMEvent* aTextEvent)
1089
{
1089
{
1090
  // This is called multiple times in the middle of an 
1090
  // This is called multiple times in the middle of an 
1091
  // IME composition
1091
  // IME composition
Lines 1133-1139 Link Here
1133
1133
1134
1134
1135
NS_IMETHODIMP
1135
NS_IMETHODIMP
1136
nsTypeAheadFind::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
1136
nsTypeAheadFindSea::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
1137
{
1137
{
1138
  // This is called once at the start of an IME composition
1138
  // This is called once at the start of an IME composition
1139
1139
Lines 1155-1161 Link Here
1155
1155
1156
1156
1157
NS_IMETHODIMP
1157
NS_IMETHODIMP
1158
nsTypeAheadFind::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
1158
nsTypeAheadFindSea::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
1159
{
1159
{
1160
  // This is called once at the end of an IME composition
1160
  // This is called once at the end of an IME composition
1161
1161
Lines 1186-1206 Link Here
1186
1186
1187
1187
1188
NS_IMETHODIMP
1188
NS_IMETHODIMP
1189
nsTypeAheadFind::HandleQueryComposition(nsIDOMEvent* aCompositionEvent)
1189
nsTypeAheadFindSea::HandleQueryComposition(nsIDOMEvent* aCompositionEvent)
1190
{
1190
{
1191
  return NS_OK;
1191
  return NS_OK;
1192
}
1192
}
1193
1193
1194
1194
1195
NS_IMETHODIMP
1195
NS_IMETHODIMP
1196
nsTypeAheadFind::HandleQueryReconversion(nsIDOMEvent* aCompositionEvent)
1196
nsTypeAheadFindSea::HandleQueryReconversion(nsIDOMEvent* aCompositionEvent)
1197
{
1197
{
1198
  return NS_OK;
1198
  return NS_OK;
1199
}
1199
}
1200
1200
1201
1201
1202
nsresult
1202
nsresult
1203
nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
1203
nsTypeAheadFindSea::FindItNow(nsIPresShell *aPresShell,
1204
                           PRBool aIsRepeatingSameChar, PRBool aIsLinksOnly,
1204
                           PRBool aIsRepeatingSameChar, PRBool aIsLinksOnly,
1205
                           PRBool aIsFirstVisiblePreferred)
1205
                           PRBool aIsFirstVisiblePreferred)
1206
{
1206
{
Lines 1225-1231 Link Here
1225
1225
1226
  nsCOMPtr<nsISupports> startingContainer = presContext->GetContainer();
1226
  nsCOMPtr<nsISupports> startingContainer = presContext->GetContainer();
1227
  nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(startingContainer));
1227
  nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(startingContainer));
1228
  NS_ASSERTION(treeItem, "Bug 175321 Crashes with Type Ahead Find [@ nsTypeAheadFind::FindItNow]");
1228
  NS_ASSERTION(treeItem, "Bug 175321 Crashes with Type Ahead Find [@ nsTypeAheadFindSea::FindItNow]");
1229
  if (!treeItem) {
1229
  if (!treeItem) {
1230
    return NS_ERROR_FAILURE;
1230
    return NS_ERROR_FAILURE;
1231
  }
1231
  }
Lines 1450-1456 Link Here
1450
1450
1451
1451
1452
nsresult
1452
nsresult
1453
nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer,
1453
nsTypeAheadFindSea::GetSearchContainers(nsISupports *aContainer,
1454
                                     PRBool aIsRepeatingSameChar,
1454
                                     PRBool aIsRepeatingSameChar,
1455
                                     PRBool aIsFirstVisiblePreferred,
1455
                                     PRBool aIsFirstVisiblePreferred,
1456
                                     PRBool aCanUseDocSelection,
1456
                                     PRBool aCanUseDocSelection,
Lines 1561-1567 Link Here
1561
1561
1562
1562
1563
void
1563
void
1564
nsTypeAheadFind::RangeStartsInsideLink(nsIDOMRange *aRange,
1564
nsTypeAheadFindSea::RangeStartsInsideLink(nsIDOMRange *aRange,
1565
                                       nsIPresShell *aPresShell,
1565
                                       nsIPresShell *aPresShell,
1566
                                       PRBool *aIsInsideLink,
1566
                                       PRBool *aIsInsideLink,
1567
                                       PRBool *aIsStartingLink)
1567
                                       PRBool *aIsStartingLink)
Lines 1673-1679 Link Here
1673
1673
1674
1674
1675
NS_IMETHODIMP
1675
NS_IMETHODIMP
1676
nsTypeAheadFind::ScrollPositionWillChange(nsIScrollableView *aView,
1676
nsTypeAheadFindSea::ScrollPositionWillChange(nsIScrollableView *aView,
1677
                                          nscoord aX, nscoord aY)
1677
                                          nscoord aX, nscoord aY)
1678
{
1678
{
1679
  return NS_OK;
1679
  return NS_OK;
Lines 1681-1687 Link Here
1681
1681
1682
1682
1683
NS_IMETHODIMP
1683
NS_IMETHODIMP
1684
nsTypeAheadFind::ScrollPositionDidChange(nsIScrollableView *aScrollableView,
1684
nsTypeAheadFindSea::ScrollPositionDidChange(nsIScrollableView *aScrollableView,
1685
                                         nscoord aX, nscoord aY)
1685
                                         nscoord aX, nscoord aY)
1686
{
1686
{
1687
  if (!mIsFindingText)
1687
  if (!mIsFindingText)
Lines 1692-1698 Link Here
1692
1692
1693
1693
1694
NS_IMETHODIMP
1694
NS_IMETHODIMP
1695
nsTypeAheadFind::NotifySelectionChanged(nsIDOMDocument *aDoc,
1695
nsTypeAheadFindSea::NotifySelectionChanged(nsIDOMDocument *aDoc,
1696
                                        nsISelection *aSel, short aReason)
1696
                                        nsISelection *aSel, short aReason)
1697
{
1697
{
1698
  if (!mIsFindingText) {
1698
  if (!mIsFindingText) {
Lines 1709-1718 Link Here
1709
}
1709
}
1710
1710
1711
1711
1712
// ---------------- nsITypeAheadFind --------------------
1712
// ---------------- nsITypeAheadFindSea --------------------
1713
1713
1714
NS_IMETHODIMP
1714
NS_IMETHODIMP
1715
nsTypeAheadFind::FindNext(PRBool aFindBackwards, nsISupportsInterfacePointer *aCallerWindowSupports)
1715
nsTypeAheadFindSea::FindNext(PRBool aFindBackwards, nsISupportsInterfacePointer *aCallerWindowSupports)
1716
{
1716
{
1717
  NS_ENSURE_TRUE(aCallerWindowSupports, NS_ERROR_FAILURE);
1717
  NS_ENSURE_TRUE(aCallerWindowSupports, NS_ERROR_FAILURE);
1718
1718
Lines 1724-1730 Link Here
1724
    return NS_OK;
1724
    return NS_OK;
1725
  }
1725
  }
1726
1726
1727
  // Compare the top level content pres shell of typeaheadfind
1727
  // Compare the top level content pres shell of typeaheadfindsea
1728
  // with the top level content pres shell window where find next is happening
1728
  // with the top level content pres shell window where find next is happening
1729
  // If they're different, exit so that webbrowswerfind can handle FindNext()
1729
  // If they're different, exit so that webbrowswerfind can handle FindNext()
1730
1730
Lines 1758-1764 Link Here
1758
  NS_ENSURE_TRUE(callerPresShell, NS_OK);
1758
  NS_ENSURE_TRUE(callerPresShell, NS_OK);
1759
1759
1760
  if (callerPresShell != typeAheadPresShell) {
1760
  if (callerPresShell != typeAheadPresShell) {
1761
    // This means typeaheadfind is active in a different window or doc
1761
    // This means typeaheadfindsea is active in a different window or doc
1762
    // So it's not appropriate to find next for the current window
1762
    // So it's not appropriate to find next for the current window
1763
    mFindNextBuffer.Truncate();
1763
    mFindNextBuffer.Truncate();
1764
    return NS_OK;
1764
    return NS_OK;
Lines 1776-1782 Link Here
1776
    webBrowserFind->GetSearchString(getter_Copies(webBrowserFindString));
1776
    webBrowserFind->GetSearchString(getter_Copies(webBrowserFindString));
1777
    if (!webBrowserFindString.Equals(mFindNextBuffer)) {
1777
    if (!webBrowserFindString.Equals(mFindNextBuffer)) {
1778
      // If they're not equal, then the find dialog was used last,
1778
      // If they're not equal, then the find dialog was used last,
1779
      // not typeaheadfind. Typeaheadfind applies to the last find,
1779
      // not typeaheadfindsea. Typeaheadfind applies to the last find,
1780
      // so we should let nsIWebBrowserFind::FindNext() do it.
1780
      // so we should let nsIWebBrowserFind::FindNext() do it.
1781
      mFindNextBuffer.Truncate();
1781
      mFindNextBuffer.Truncate();
1782
      return NS_OK;
1782
      return NS_OK;
Lines 1826-1832 Link Here
1826
1826
1827
1827
1828
NS_IMETHODIMP
1828
NS_IMETHODIMP
1829
nsTypeAheadFind::GetIsActive(PRBool *aIsActive)
1829
nsTypeAheadFindSea::GetIsActive(PRBool *aIsActive)
1830
{
1830
{
1831
  *aIsActive = mLinksOnlyManuallySet || !mTypeAheadBuffer.IsEmpty();
1831
  *aIsActive = mLinksOnlyManuallySet || !mTypeAheadBuffer.IsEmpty();
1832
1832
Lines 1839-1845 Link Here
1839
 */
1839
 */
1840
1840
1841
NS_IMETHODIMP
1841
NS_IMETHODIMP
1842
nsTypeAheadFind::StartNewFind(nsIDOMWindow *aWindow, PRBool aLinksOnly)
1842
nsTypeAheadFindSea::StartNewFind(nsIDOMWindow *aWindow, PRBool aLinksOnly)
1843
{
1843
{
1844
  if (!mFind || !mIsTypeAheadOn || !aWindow)
1844
  if (!mFind || !mIsTypeAheadOn || !aWindow)
1845
    return NS_ERROR_FAILURE;  // Type Ahead Find not correctly initialized
1845
    return NS_ERROR_FAILURE;  // Type Ahead Find not correctly initialized
Lines 1872-1878 Link Here
1872
}
1872
}
1873
1873
1874
void
1874
void
1875
nsTypeAheadFind::ResetGlobalAutoStart(PRBool aAutoStart)
1875
nsTypeAheadFindSea::ResetGlobalAutoStart(PRBool aAutoStart)
1876
{
1876
{
1877
  // Enumerate through the current top level windows
1877
  // Enumerate through the current top level windows
1878
  // and either attach or remove window listeners
1878
  // and either attach or remove window listeners
Lines 1910-1916 Link Here
1910
1910
1911
1911
1912
NS_IMETHODIMP
1912
NS_IMETHODIMP
1913
nsTypeAheadFind::SetAutoStart(nsIDOMWindow *aDOMWin, PRBool aAutoStartOn)
1913
nsTypeAheadFindSea::SetAutoStart(nsIDOMWindow *aDOMWin, PRBool aAutoStartOn)
1914
{
1914
{
1915
  if (!aDOMWin) {
1915
  if (!aDOMWin) {
1916
    return NS_ERROR_FAILURE;
1916
    return NS_ERROR_FAILURE;
Lines 1940-1946 Link Here
1940
1940
1941
1941
1942
NS_IMETHODIMP
1942
NS_IMETHODIMP
1943
nsTypeAheadFind::GetAutoStart(nsIDOMWindow *aDOMWin, PRBool *aIsAutoStartOn)
1943
nsTypeAheadFindSea::GetAutoStart(nsIDOMWindow *aDOMWin, PRBool *aIsAutoStartOn)
1944
{
1944
{
1945
  *aIsAutoStartOn = PR_FALSE;
1945
  *aIsAutoStartOn = PR_FALSE;
1946
1946
Lines 2008-2014 Link Here
2008
2008
2009
2009
2010
NS_IMETHODIMP
2010
NS_IMETHODIMP
2011
nsTypeAheadFind::CancelFind()
2011
nsTypeAheadFindSea::CancelFind()
2012
{
2012
{
2013
  // Stop current find if:
2013
  // Stop current find if:
2014
  //   1. Escape pressed
2014
  //   1. Escape pressed
Lines 2065-2071 Link Here
2065
// ------- Helper Methods ---------------
2065
// ------- Helper Methods ---------------
2066
2066
2067
void 
2067
void 
2068
nsTypeAheadFind::GetTopContentPresShell(nsIDocShellTreeItem *aDocShellTreeItem, 
2068
nsTypeAheadFindSea::GetTopContentPresShell(nsIDocShellTreeItem *aDocShellTreeItem, 
2069
                                        nsIPresShell **aPresShell)
2069
                                        nsIPresShell **aPresShell)
2070
{
2070
{
2071
  *aPresShell = nsnull;
2071
  *aPresShell = nsnull;
Lines 2081-2087 Link Here
2081
}
2081
}
2082
2082
2083
void 
2083
void 
2084
nsTypeAheadFind::GetStartWindow(nsIDOMWindow *aWindow, nsIDOMWindow **aStartWindow)
2084
nsTypeAheadFindSea::GetStartWindow(nsIDOMWindow *aWindow, nsIDOMWindow **aStartWindow)
2085
{
2085
{
2086
  // Return the root ancestor content window of aWindow
2086
  // Return the root ancestor content window of aWindow
2087
2087
Lines 2113-2119 Link Here
2113
}
2113
}
2114
2114
2115
nsresult
2115
nsresult
2116
nsTypeAheadFind::GetWebBrowserFind(nsIDOMWindow *aWin, 
2116
nsTypeAheadFindSea::GetWebBrowserFind(nsIDOMWindow *aWin, 
2117
                                   nsIWebBrowserFind **aWebBrowserFind)
2117
                                   nsIWebBrowserFind **aWebBrowserFind)
2118
{
2118
{
2119
  NS_ENSURE_ARG_POINTER(aWin);
2119
  NS_ENSURE_ARG_POINTER(aWin);
Lines 2138-2144 Link Here
2138
2138
2139
2139
2140
void
2140
void
2141
nsTypeAheadFind::StartTimeout()
2141
nsTypeAheadFindSea::StartTimeout()
2142
{
2142
{
2143
  if (mTimeoutLength) {
2143
  if (mTimeoutLength) {
2144
    if (!mTimer) {
2144
    if (!mTimer) {
Lines 2154-2160 Link Here
2154
}
2154
}
2155
2155
2156
void
2156
void
2157
nsTypeAheadFind::SetSelectionLook(nsIPresShell *aPresShell, 
2157
nsTypeAheadFindSea::SetSelectionLook(nsIPresShell *aPresShell, 
2158
                                  PRBool aChangeColor, 
2158
                                  PRBool aChangeColor, 
2159
                                  PRBool aEnabled)
2159
                                  PRBool aEnabled)
2160
{
2160
{
Lines 2162-2169 Link Here
2162
    return;
2162
    return;
2163
2163
2164
  // Show caret when type ahead find is on
2164
  // Show caret when type ahead find is on
2165
  // Also paint selection bright (typeaheadfind on) or normal
2165
  // Also paint selection bright (typeaheadfindsea on) or normal
2166
  // (typeaheadfind off)
2166
  // (typeaheadfindsea off)
2167
2167
2168
  if (aChangeColor) {
2168
  if (aChangeColor) {
2169
    mFocusedDocSelCon->SetDisplaySelection(nsISelectionController::SELECTION_ATTENTION);
2169
    mFocusedDocSelCon->SetDisplaySelection(nsISelectionController::SELECTION_ATTENTION);
Lines 2210-2216 Link Here
2210
2210
2211
2211
2212
void
2212
void
2213
nsTypeAheadFind::RemoveDocListeners()
2213
nsTypeAheadFindSea::RemoveDocListeners()
2214
{
2214
{
2215
  nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mFocusedWeakShell));
2215
  nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mFocusedWeakShell));
2216
  nsIViewManager* vm = nsnull;
2216
  nsIViewManager* vm = nsnull;
Lines 2244-2250 Link Here
2244
2244
2245
2245
2246
void
2246
void
2247
nsTypeAheadFind::AttachDocListeners(nsIPresShell *aPresShell)
2247
nsTypeAheadFindSea::AttachDocListeners(nsIPresShell *aPresShell)
2248
{
2248
{
2249
  if (!aPresShell) {
2249
  if (!aPresShell) {
2250
    return;
2250
    return;
Lines 2274-2280 Link Here
2274
2274
2275
2275
2276
void
2276
void
2277
nsTypeAheadFind::RemoveWindowListeners(nsIDOMWindow *aDOMWin)
2277
nsTypeAheadFindSea::RemoveWindowListeners(nsIDOMWindow *aDOMWin)
2278
{
2278
{
2279
  nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
2279
  nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
2280
  GetChromeEventHandler(aDOMWin, getter_AddRefs(chromeEventHandler));
2280
  GetChromeEventHandler(aDOMWin, getter_AddRefs(chromeEventHandler));
Lines 2331-2337 Link Here
2331
2331
2332
2332
2333
void
2333
void
2334
nsTypeAheadFind::AttachWindowListeners(nsIDOMWindow *aDOMWin)
2334
nsTypeAheadFindSea::AttachWindowListeners(nsIDOMWindow *aDOMWin)
2335
{
2335
{
2336
  nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
2336
  nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
2337
  GetChromeEventHandler(aDOMWin, getter_AddRefs(chromeEventHandler));
2337
  GetChromeEventHandler(aDOMWin, getter_AddRefs(chromeEventHandler));
Lines 2384-2390 Link Here
2384
2384
2385
2385
2386
void
2386
void
2387
nsTypeAheadFind::GetChromeEventHandler(nsIDOMWindow *aDOMWin,
2387
nsTypeAheadFindSea::GetChromeEventHandler(nsIDOMWindow *aDOMWin,
2388
                                       nsIDOMEventTarget **aChromeTarget)
2388
                                       nsIDOMEventTarget **aChromeTarget)
2389
{
2389
{
2390
  nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aDOMWin));
2390
  nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aDOMWin));
Lines 2400-2406 Link Here
2400
}
2400
}
2401
2401
2402
PRBool
2402
PRBool
2403
nsTypeAheadFind::IsTargetContentOkay(nsIContent *aContent)
2403
nsTypeAheadFindSea::IsTargetContentOkay(nsIContent *aContent)
2404
{
2404
{
2405
  if (!aContent) {
2405
  if (!aContent) {
2406
    return PR_FALSE;
2406
    return PR_FALSE;
Lines 2438-2444 Link Here
2438
2438
2439
2439
2440
nsresult
2440
nsresult
2441
nsTypeAheadFind::GetTargetIfTypeAheadOkay(nsIDOMEvent *aEvent, 
2441
nsTypeAheadFindSea::GetTargetIfTypeAheadOkay(nsIDOMEvent *aEvent, 
2442
                                          nsIContent **aTargetContent,
2442
                                          nsIContent **aTargetContent,
2443
                                          nsIPresShell **aTargetPresShell)
2443
                                          nsIPresShell **aTargetPresShell)
2444
{
2444
{
Lines 2524-2530 Link Here
2524
2524
2525
2525
2526
void
2526
void
2527
nsTypeAheadFind::GetSelection(nsIPresShell *aPresShell,
2527
nsTypeAheadFindSea::GetSelection(nsIPresShell *aPresShell,
2528
                              nsISelectionController **aSelCon,
2528
                              nsISelectionController **aSelCon,
2529
                              nsISelection **aDOMSel)
2529
                              nsISelection **aDOMSel)
2530
{
2530
{
Lines 2548-2554 Link Here
2548
2548
2549
2549
2550
PRBool
2550
PRBool
2551
nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
2551
nsTypeAheadFindSea::IsRangeVisible(nsIPresShell *aPresShell,
2552
                                nsIPresContext *aPresContext,
2552
                                nsIPresContext *aPresContext,
2553
                                nsIDOMRange *aRange, PRBool aMustBeInViewPort,
2553
                                nsIDOMRange *aRange, PRBool aMustBeInViewPort,
2554
                                PRBool aGetTopVisibleLeaf,
2554
                                PRBool aGetTopVisibleLeaf,
Lines 2703-2709 Link Here
2703
2703
2704
2704
2705
nsresult
2705
nsresult
2706
nsTypeAheadFind::GetTranslatedString(const nsAString& aKey,
2706
nsTypeAheadFindSea::GetTranslatedString(const nsAString& aKey,
2707
                                     nsAString& aStringOut)
2707
                                     nsAString& aStringOut)
2708
{
2708
{
2709
  nsXPIDLString xsValue;
2709
  nsXPIDLString xsValue;
Lines 2721-2727 Link Here
2721
2721
2722
2722
2723
void
2723
void
2724
nsTypeAheadFind::DisplayStatus(PRBool aSuccess, nsIContent *aFocusedContent,
2724
nsTypeAheadFindSea::DisplayStatus(PRBool aSuccess, nsIContent *aFocusedContent,
2725
                               PRBool aClearStatus, const PRUnichar *aText)
2725
                               PRBool aClearStatus, const PRUnichar *aText)
2726
{
2726
{
2727
  // pres shell -> pres context -> container -> tree item ->
2727
  // pres shell -> pres context -> container -> tree item ->
Lines 2869-2875 Link Here
2869
  // Make sure we're not focused on a text field, listbox
2869
  // Make sure we're not focused on a text field, listbox
2870
  // or other form control that needs typeahead keystrokes
2870
  // or other form control that needs typeahead keystrokes
2871
  if (focusedContent) {
2871
  if (focusedContent) {
2872
    *aResult = nsTypeAheadFind::IsTargetContentOkay(focusedContent);
2872
    *aResult = nsTypeAheadFindSea::IsTargetContentOkay(focusedContent);
2873
    return NS_OK;
2873
    return NS_OK;
2874
  }
2874
  }
2875
2875
Lines 2934-2941 Link Here
2934
  EnsureContentWindow(domWinInternal, getter_AddRefs(startContentWin));
2934
  EnsureContentWindow(domWinInternal, getter_AddRefs(startContentWin));
2935
  NS_ENSURE_TRUE(startContentWin, NS_ERROR_FAILURE);
2935
  NS_ENSURE_TRUE(startContentWin, NS_ERROR_FAILURE);
2936
2936
2937
  nsCOMPtr<nsITypeAheadFind> typeAhead = 
2937
  nsCOMPtr<nsITypeAheadFindSea> typeAhead = 
2938
    do_GetService(NS_TYPEAHEADFIND_CONTRACTID);
2938
    do_GetService(NS_TYPEAHEADFINDSEA_CONTRACTID);
2939
  NS_ENSURE_TRUE(typeAhead, NS_ERROR_FAILURE);
2939
  NS_ENSURE_TRUE(typeAhead, NS_ERROR_FAILURE);
2940
2940
2941
  return typeAhead->StartNewFind(startContentWin, isLinkSearch);
2941
  return typeAhead->StartNewFind(startContentWin, isLinkSearch);
(-)extensions/typeaheadfind/src/nsTypeAheadFind.h (-12 / +12 lines)
Lines 62-74 Link Here
62
#include "nsIDOMRange.h"
62
#include "nsIDOMRange.h"
63
#include "nsIDOMWindow.h"
63
#include "nsIDOMWindow.h"
64
#include "nsIDocShellTreeItem.h"
64
#include "nsIDocShellTreeItem.h"
65
#include "nsITypeAheadFind.h"
65
#include "nsITypeAheadFindSea.h"
66
#include "nsIStringBundle.h"
66
#include "nsIStringBundle.h"
67
#include "nsISupportsArray.h"
67
#include "nsISupportsArray.h"
68
#include "nsISound.h"
68
#include "nsISound.h"
69
69
70
#define TYPEAHEADFIND_BUNDLE_URL \
70
#define TYPEAHEADFINDSEA_BUNDLE_URL \
71
        "chrome://global/locale/typeaheadfind.properties"
71
        "chrome://global/locale/typeaheadfindsea.properties"
72
#define TYPEAHEADFIND_NOTFOUND_WAV_URL \
72
#define TYPEAHEADFIND_NOTFOUND_WAV_URL \
73
        "chrome://global/content/notfound.wav"
73
        "chrome://global/content/notfound.wav"
74
74
Lines 82-88 Link Here
82
82
83
const int kMaxBadCharsBeforeCancel = 3;
83
const int kMaxBadCharsBeforeCancel = 3;
84
84
85
class nsTypeAheadFind : public nsITypeAheadFind,
85
class nsTypeAheadFindSea : public nsITypeAheadFindSea,
86
                        public nsIDOMKeyListener,
86
                        public nsIDOMKeyListener,
87
                        public nsIDOMTextListener,
87
                        public nsIDOMTextListener,
88
                        public nsIDOMCompositionListener,
88
                        public nsIDOMCompositionListener,
Lines 93-105 Link Here
93
                        public nsSupportsWeakReference
93
                        public nsSupportsWeakReference
94
{
94
{
95
public:
95
public:
96
  nsTypeAheadFind();
96
  nsTypeAheadFindSea();
97
  virtual ~nsTypeAheadFind();
97
  virtual ~nsTypeAheadFindSea();
98
98
99
  NS_DEFINE_STATIC_CID_ACCESSOR(NS_TYPEAHEADFIND_CID);
99
  NS_DEFINE_STATIC_CID_ACCESSOR(NS_TYPEAHEADFINDSEA_CID);
100
100
101
  NS_DECL_ISUPPORTS
101
  NS_DECL_ISUPPORTS
102
  NS_DECL_NSITYPEAHEADFIND
102
  NS_DECL_NSITYPEAHEADFINDSEA
103
  NS_DECL_NSIOBSERVER
103
  NS_DECL_NSIOBSERVER
104
  NS_DECL_NSIDOMEVENTLISTENER
104
  NS_DECL_NSIDOMEVENTLISTENER
105
  NS_DECL_NSISELECTIONLISTENER
105
  NS_DECL_NSISELECTIONLISTENER
Lines 127-133 Link Here
127
  // ----- nsITimerCallback -----------------------------
127
  // ----- nsITimerCallback -----------------------------
128
  NS_DECL_NSITIMERCALLBACK
128
  NS_DECL_NSITIMERCALLBACK
129
129
130
  static nsTypeAheadFind *GetInstance();
130
  static nsTypeAheadFindSea *GetInstance();
131
  static void ReleaseInstance(void);
131
  static void ReleaseInstance(void);
132
  static PRBool IsTargetContentOkay(nsIContent *aContent);
132
  static PRBool IsTargetContentOkay(nsIContent *aContent);
133
133
Lines 185-191 Link Here
185
  nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
185
  nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
186
186
187
  // Used by GetInstance and ReleaseInstance
187
  // Used by GetInstance and ReleaseInstance
188
  static nsTypeAheadFind *sInstance;
188
  static nsTypeAheadFindSea *sInstance;
189
189
190
  // Current find state
190
  // Current find state
191
  nsString mTypeAheadBuffer;
191
  nsString mTypeAheadBuffer;
Lines 196-202 Link Here
196
196
197
  // PRBool's are used instead of PRPackedBool's where the address of the
197
  // PRBool's are used instead of PRPackedBool's where the address of the
198
  // boolean variable is getting passed into a method. For example:
198
  // boolean variable is getting passed into a method. For example:
199
  // GetBoolPref("accessibility.typeaheadfind.linksonly", &mLinksOnlyPref);
199
  // GetBoolPref("accessibility.typeaheadfindsea.linksonly", &mLinksOnlyPref);
200
  PRBool mIsFindAllowedInWindow;
200
  PRBool mIsFindAllowedInWindow;
201
  PRBool mAutoStartPref;
201
  PRBool mAutoStartPref;
202
  PRBool mLinksOnlyPref;
202
  PRBool mLinksOnlyPref;
Lines 251-257 Link Here
251
  nsCOMPtr<nsIDOMWindow> mFocusedWindow;
251
  nsCOMPtr<nsIDOMWindow> mFocusedWindow;
252
  nsCOMPtr<nsIWeakReference> mFocusedWeakShell;
252
  nsCOMPtr<nsIWeakReference> mFocusedWeakShell;
253
253
254
  // Windows where typeaheadfind doesn't auto start as the user types
254
  // Windows where typeaheadfindsea doesn't auto start as the user types
255
  nsCOMPtr<nsISupportsArray> mManualFindWindows;
255
  nsCOMPtr<nsISupportsArray> mManualFindWindows;
256
};
256
};
257
257
(-)extensions/typeaheadfind/src/nsTypeAheadFindRegistration.cpp (-13 / +13 lines)
Lines 55-61 Link Here
55
55
56
// This function is called at component registration time
56
// This function is called at component registration time
57
static NS_METHOD
57
static NS_METHOD
58
nsTypeAheadFindRegistrationProc(nsIComponentManager *aCompMgr, nsIFile *aPath,
58
nsTypeAheadFindSeaRegistrationProc(nsIComponentManager *aCompMgr, nsIFile *aPath,
59
                                const char *registryLocation,
59
                                const char *registryLocation,
60
                                const char *componentType,
60
                                const char *componentType,
61
                                const nsModuleComponentInfo *info)
61
                                const nsModuleComponentInfo *info)
Lines 64-70 Link Here
64
  // an application component. This makes sure that we're
64
  // an application component. This makes sure that we're
65
  // initialized on application startup.
65
  // initialized on application startup.
66
66
67
  // Register nsTypeAheadFind to be instantiated on startup.
67
  // Register nsTypeAheadFindSea to be instantiated on startup.
68
  // XXX This is needed on linux, but for some reason not needed on win32.
68
  // XXX This is needed on linux, but for some reason not needed on win32.
69
  nsresult rv;
69
  nsresult rv;
70
  nsCOMPtr<nsICategoryManager> categoryManager =
70
  nsCOMPtr<nsICategoryManager> categoryManager =
Lines 74-80 Link Here
74
    rv = categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY,
74
    rv = categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY,
75
                                           "Type Ahead Find", 
75
                                           "Type Ahead Find Sea", 
76
                                           "service,"
76
                                           "service,"
77
                                           NS_TYPEAHEADFIND_CONTRACTID,
77
                                           NS_TYPEAHEADFINDSEA_CONTRACTID,
78
                                           PR_TRUE, PR_TRUE, nsnull);
78
                                           PR_TRUE, PR_TRUE, nsnull);
79
  }
79
  }
80
80
Lines 82-103 Link Here
82
}
82
}
83
83
84
84
85
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsTypeAheadFind,
85
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsTypeAheadFindSea,
86
                                         nsTypeAheadFind::GetInstance)
86
                                         nsTypeAheadFindSea::GetInstance)
87
87
88
static void PR_CALLBACK
88
static void PR_CALLBACK
89
TypeAheadFindModuleDtor(nsIModule* self)
89
TypeAheadFindSeaModuleDtor(nsIModule* self)
90
{
90
{
91
  nsTypeAheadFind::ReleaseInstance();
91
  nsTypeAheadFindSea::ReleaseInstance();
92
}
92
}
93
93
94
static const nsModuleComponentInfo components[] =
94
static const nsModuleComponentInfo components[] =
95
{
95
{
96
  { "TypeAheadFind Component", NS_TYPEAHEADFIND_CID,
96
  { "TypeAheadFindSea Component", NS_TYPEAHEADFINDSEA_CID,
97
    NS_TYPEAHEADFIND_CONTRACTID, nsTypeAheadFindConstructor,
97
    NS_TYPEAHEADFINDSEA_CONTRACTID, nsTypeAheadFindSeaConstructor,
98
    nsTypeAheadFindRegistrationProc, nsnull  // Unregistration proc
98
    nsTypeAheadFindSeaRegistrationProc, nsnull  // Unregistration proc
99
  }
99
  }
100
};
100
};
101
101
102
NS_IMPL_NSGETMODULE_WITH_DTOR(nsTypeAheadFind, components,
102
NS_IMPL_NSGETMODULE_WITH_DTOR(nsTypeAheadFindSea, components,
103
                              TypeAheadFindModuleDtor)
103
                              TypeAheadFindSeaModuleDtor)
(-)extensions/typeaheadfind/src/typeaheadfind.pkg (-9 lines)
Lines 1-9 Link Here
1
# why not ship this with GRE/embedding, if we're building it?
2
3
[xpfe-browser browser]
4
#if SHARED_LIBRARY
5
dist/bin/components/@SHARED_LIBRARY@
6
#else
7
!staticcomp @LIBRARY@ @MODULE_NAME@
8
#endif
9
!xpt dist/bin/components/typeaheadfind.xpt
(-)extensions/typeaheadfind/src/typeaheadfindsea.pkg (+18 lines)
Line 0 Link Here
1
# why not ship this with GRE/embedding, if we're building it?
2
3
[xpfe-browser browser]
4
#if SHARED_LIBRARY
5
dist/bin/components/@SHARED_LIBRARY@
6
#else
7
!staticcomp @LIBRARY@ @MODULE_NAME@
8
#endif
9
!xpt dist/bin/components/typeaheadfindsea.xpt
Line 0 Link Here
1
# why not ship this with GRE/embedding, if we're building it?
2
3
[xpfe-browser browser]
4
#if SHARED_LIBRARY
5
dist/bin/components/@SHARED_LIBRARY@
6
#else
7
!staticcomp @LIBRARY@ @MODULE_NAME@
8
#endif
9
!xpt dist/bin/components/typeaheadfindsea.xpt

Return to bug 114044