Last Comment Bug 345526 - make suiterunner FAYT work with toolkit typeaheadfind
: make suiterunner FAYT work with toolkit typeaheadfind
Status: VERIFIED FIXED
: fixed-seamonkey2.0
Product: SeaMonkey
Classification: Client Software
Component: UI Design (show other bugs)
: Trunk
: All All
: -- normal with 4 votes (vote)
: seamonkey2.0a2
Assigned To: neil@parkwaycc.co.uk
:
Mentors:
: 464465 (view as bug list)
Depends on: 395688 344243 461938 466994
Blocks: 467004 470175
  Show dependency treegraph
 
Reported: 2006-07-21 13:29 PDT by Robert Kaiser (not working on stability any more)
Modified: 2009-09-18 06:17 PDT (History)
26 users (show)
kairo: wanted‑seamonkey2.0+
mnyromyr: blocking‑seamonkey2.0a2+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
WIP2 (11.04 KB, patch)
2008-11-07 16:47 PST, neil@parkwaycc.co.uk
kairo: review-
Details | Diff | Review
WIP3 (11.89 KB, patch)
2008-11-08 11:39 PST, neil@parkwaycc.co.uk
kairo: review+
Details | Diff | Review
Alternative approach (15.10 KB, patch)
2008-11-16 07:47 PST, neil@parkwaycc.co.uk
kairo: review+
jag-mozilla: superreview+
Details | Diff | Review
Final patch (18.11 KB, patch)
2008-11-25 07:08 PST, neil@parkwaycc.co.uk
mnyromyr: review+
neil: superreview+
Details | Diff | Review
For push (18.43 KB, patch)
2008-11-25 13:42 PST, neil@parkwaycc.co.uk
neil: review+
neil: superreview+
Details | Diff | Review
Package nsTypeAheadFind.js (872 bytes, patch)
2008-11-26 12:45 PST, Frank Wein [:mcsmurf]
neil: review+
neil: approval‑seamonkey2.0a2+
Details | Diff | Review

Description Robert Kaiser (not working on stability any more) 2006-07-21 13:29:18 PDT
The recent patch in bug 344243 includes the necessary changes to change suiterunner from building extensions/typeaheadfind to building toolkit/components/typeaheadfind instead.

SeaMonkey does not call FAYT any more with that change though, we need to make sure we are able to enable that feature through toolkit again.

I tried to dig into that, but I'm coming into regions where my knowledge ends: it looks to me that we're relying on nsTypeAheadController <http://lxr.mozilla.org/mozilla/source/extensions/typeaheadfind/src/nsTypeAheadFind.cpp#2821> for doing FAYT, but that does not exist in toolkit's nsTypeAheadFind - but as I don't really know the C/C++ stuff, that's where my investigations come to a halt :(
Comment 1 Robert Kaiser (not working on stability any more) 2006-11-01 11:48:33 PST
Updating this bug with a bit of changed information, see also bug comment #23 and following.

suiterunner is now building both the old suitetypeaheadfind from extensions and the new typeaheadfind from toolkit, but those are two completely independent sets of code now.
We should probably do a version of that feature that provides everything we need in suite but based on the toolkit one, so we can share some code and don't need to maintain forked versions of the same code.
Comment 2 Robert Kaiser (not working on stability any more) 2007-09-10 10:38:33 PDT
I just filed bug 395688 which could help us in this area.
Comment 3 Serge Gautherie (:sgautherie) 2008-06-10 10:00:13 PDT
Filter "spam" on "guifeatures-nobody-20080610".
Comment 4 neil@parkwaycc.co.uk 2008-11-07 16:47:51 PST
Created attachment 347001 [details] [diff] [review]
WIP2

WIP1 was in bug 461938 of course.
Comment 5 Stefan [:stefanh] 2008-11-08 06:31:01 PST
Comment on attachment 347001 [details] [diff] [review]
WIP2

I tested this in browser and in the mailnews start page - for some reason I cant type any text in msgcompose atm. This looks like it's working quite well. Compared to the previous version the shortcuts works as well ;)

Some notes:
- accessibility.typeaheadfind.autostart works
- There was an oddity when I started to test. When I first tried and set the above pref to false, it looked like accessibility.typeaheadfind.linksonly was ignored, it was like it always was set to false (even if it wasn't) and only the "/" key worked. This doesn't happen now, though. For some reason both keys invokes the right fayt now.

- accessibility.typeaheadfind.soundURL pref doesn't really work, there's something odd going on there, I don't seem to get the default sound when nothing is found.   At the best a get some sound, but nothing that resembles the default sound (works fine in Firefox, though). I don't really think this should stop anything here, though.  Maybe we miss something in the backend?
Comment 6 neil@parkwaycc.co.uk 2008-11-08 07:01:56 PST
(In reply to comment #5)
> (From update of attachment 347001 [details] [diff] [review])
> I tested this in browser and in the mailnews start page - for some reason I
> cant type any text in msgcompose atm.
Ah yes, I still need to test for editable regions (including composer).

> - accessibility.typeaheadfind.soundURL pref doesn't really work, there's
> something odd going on there, I don't seem to get the default sound when
> nothing is found.   At the best a get some sound, but nothing that resembles
> the default sound (works fine in Firefox, though).
Note that Firefox defaults to "beep", rather than "default".
Comment 7 Stefan [:stefanh] 2008-11-08 07:38:14 PST
(In reply to comment #6)
> (In reply to comment #5)
> > (From update of attachment 347001 [details] [diff] [review] [details])
> > I tested this in browser and in the mailnews start page - for some reason I
> > cant type any text in msgcompose atm.
> Ah yes, I still need to test for editable regions (including composer).
> 
> > - accessibility.typeaheadfind.soundURL pref doesn't really work, there's
> > something odd going on there, I don't seem to get the default sound when
> > nothing is found.   At the best a get some sound, but nothing that resembles
> > the default sound (works fine in Firefox, though).
> Note that Firefox defaults to "beep", rather than "default".

You want the "beep", works fine with that. One oddity is that it seems that I need to restart sm in order to make a change in the pref work. But that could be a system thing.
Comment 8 Stefan [:stefanh] 2008-11-08 07:45:31 PST
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > (From update of attachment 347001 [details] [diff] [review] [details] [details])
> > > I tested this in browser and in the mailnews start page - for some reason I
> > > cant type any text in msgcompose atm.
> > Ah yes, I still need to test for editable regions (including composer).
> > 
> > > - accessibility.typeaheadfind.soundURL pref doesn't really work, there's
> > > something odd going on there, I don't seem to get the default sound when
> > > nothing is found.   At the best a get some sound, but nothing that resembles
> > > the default sound (works fine in Firefox, though).
> > Note that Firefox defaults to "beep", rather than "default".
> 
> You want the "beep", works fine with that. One oddity is that it seems that I
> need to restart sm in order to make a change in the pref work. But that could
> be a system thing.

Same thing in Firefox (restart), so nothing you should worry about here I guess. Note that the "default" sound do output a sound, but it's kind of bizarre and doesn't follow the system prefs. "beep" follows the system settings, though.
Comment 9 Robert Kaiser (not working on stability any more) 2008-11-08 07:46:48 PST
Comment on attachment 347001 [details] [diff] [review]
WIP2

I can confirm this patch breaks entering any text anywhere in messengercompose (I tested typing address, subject and content, nothing resulting in any entered character) but entering in webforms or urlbar in browser works.

I did get this in error console a few times from messengercompose:
Error: this.mXULBrowserWindow is null
Source File: chrome://communicator/content/utilityOverlay.js
Line: 1001

Without the patch, everything works. This prevents me from testing the patch in dogfood situations, so r- for this WIP.
Comment 10 neil@parkwaycc.co.uk 2008-11-08 09:07:53 PST
(In reply to comment #8)
> Note that the "default" sound do output a sound, but it's kind of
> bizarre and doesn't follow the system prefs.
My bad, bug 193923 changed it for Windows and I didn't realise that it had always been beep on the Mac.

(In reply to comment #9)
> (From update of attachment 347001 [details] [diff] [review])
> I can confirm this patch breaks entering any text anywhere in messengercompose
> (I tested typing address, subject and content, nothing resulting in any entered
> character) but entering in webforms or urlbar in browser works.
I can type in the address and subject, but I realise content is broken.

> I did get this in error console a few times from messengercompose:
> Error: this.mXULBrowserWindow is null
> Source File: chrome://communicator/content/utilityOverlay.js
> Line: 1001
Right, I know what causes this and I need to ignore it.
Comment 11 neil@parkwaycc.co.uk 2008-11-08 11:39:59 PST
Created attachment 347079 [details] [diff] [review]
WIP3

This one should be good for most testing, though it might leak!
Comment 12 Robert Kaiser (not working on stability any more) 2008-11-08 13:24:28 PST
Comment on attachment 347079 [details] [diff] [review]
WIP3

r=me on the functionality - I don't pretend to understand the code, so I didn't really read through it, and I didn't test for leaks or anything like that, but it does what I need it to do for the moment (i.e. FAYT in browser and not killing any functionality I rely on elsewhere).
Please hand to someone who really understands this for actual code review.
I also hope this is a good base on which we can build on for pref-switchable FAYTbar and replacing the find dialog with a findbar (all in further steps/followups).
Comment 13 Philip Chee 2008-11-13 03:10:38 PST
*** Bug 464465 has been marked as a duplicate of this bug. ***
Comment 14 Mark Banner (:standard8) 2008-11-14 13:40:13 PST
Comment on attachment 347001 [details] [diff] [review]
WIP2

I've not really got time to dig into this patch to do a review justice.
Comment 15 neil@parkwaycc.co.uk 2008-11-16 07:47:18 PST
Created attachment 348435 [details] [diff] [review]
Alternative approach
Comment 16 Philip Chee 2008-11-16 10:31:05 PST
> diff -r 47a9189abb80 suite/browser/nsTypeAheadFind.js
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/suite/browser/nsTypeAheadFind.js	Sun Nov 16 15:44:23 2008 +0000
> @@ -0,0 +1,316 @@
> +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

No licence boilerplate?
Comment 17 jag (Peter Annema) 2008-11-16 17:57:46 PST
I like the alternative approach, but I would use

  findTypeController.prototype = {
    ...
  }

as you did for |typeAheadFind|.

Why did you split the controller off, though?

Do you intend to keep the try/catch in |isCommandEnabled()|?

For readability there might be some value in hoisting some of the interface names up to global (or at least function level) consts, or use |C.i.|.
Comment 18 Philip Chee 2008-11-16 20:22:11 PST
I d.i.s.a.g.r.e.e.w.i.t.h.t.h.e.u.s.e.o.f. C.i. a.n.d f.r.i.e.n.d.s.
Comment 19 neil@parkwaycc.co.uk 2008-11-17 01:25:32 PST
(In reply to comment #17)
> Why did you split the controller off, though?
Each controller needs to know which window it's attached to.

> Do you intend to keep the try/catch in |isCommandEnabled()|?
Oops, I forgot to debug the reason that I put it in there...

> For readability there might be some value in hoisting some of the interface
> names up to global (or at least function level) consts, or use |C.i.|.
Sure, but there were only about 5 that I actually use more than once.
Comment 20 neil@parkwaycc.co.uk 2008-11-17 02:13:14 PST
(In reply to comment #19)
> (In reply to comment #17)
> > Do you intend to keep the try/catch in |isCommandEnabled()|?
> Oops, I forgot to debug the reason that I put it in there...
Someone updates the command during a focus event, so there's no focus yet...
Comment 21 neil@parkwaycc.co.uk 2008-11-17 02:28:53 PST
Well, there is focus, but if an element is receiving focus then the window hasn't been set yet when the update happens.
Comment 22 Robert Kaiser (not working on stability any more) 2008-11-17 09:05:44 PST
The latest patch doesn't apply cleanly on current trunk because somebody changed the "DIRS" in the browser/Makefile.in context to "PARALLEL_DIRS" :p
Comment 23 Philip Chee 2008-11-17 09:13:13 PST
I think the Fairy Dust may be backed out if Thunderbird can't be built with "PARALLEL_DIRS"
Comment 24 Robert Kaiser (not working on stability any more) 2008-11-18 10:35:48 PST
Comment on attachment 348435 [details] [diff] [review]
Alternative approach

r=me for how it works in the build (no code review), just one nit: shouldn't we reset the position to start the find to the start of the document when we start a new find?
Comment 25 neil@parkwaycc.co.uk 2008-11-18 11:45:31 PST
No, the idea is to find from where the selection, caret or focus is, or as near on screen from one of them as possible. Ironically that's the very code that bug 461212 busted which made bug 461938 and thus this bug necessary.
Comment 26 Robert Kaiser (not working on stability any more) 2008-11-24 07:41:26 PST
Can we get real code review on whatever patch Neil and probable reviewers prefer? We should not ship a2 without any FAYT and the freeze is upcoming (tomorrow)...
Comment 27 jag (Peter Annema) 2008-11-25 02:43:36 PST
Comment on attachment 348435 [details] [diff] [review]
Alternative approach

sr=jag on this one.

Remove the dump(), and use the .prototype = { ... } style for findTypeController.
Comment 28 neil@parkwaycc.co.uk 2008-11-25 07:08:14 PST
Created attachment 349961 [details] [diff] [review]
Final patch

* Fixed findTypeController.isCommandEnabled
* Switched prototype style as requested by jag
* Added lots of comments (including licence block)
* Minor clean up (code reordering to make it easier to comment)
Comment 29 Karsten Düsterloh 2008-11-25 12:12:03 PST
Comment on attachment 349961 [details] [diff] [review]
Final patch

Just some nits:

>+  switch (pref.getIntPref("browser.backspace_action")) {
>+  case 0:
>+    BrowserBack();
>+    break;
>+  case 1:
>+    goDoCommand("cmd_scrollPageUp");
>+    break;

Cases and their code lack one level of indentation.

>+    if (aEvent.keyCode || aEvent.charCode <= " ".charCodeAt(0))

You do like charCodeAt, do you? ;-)
Better just ...

>+    switch (aEvent.charCode) {
>+      // Start finding text as you type
>+      case "/".charCodeAt(0):
>+        aEvent.preventDefault();
>+        this.startFind(window, false);
>+        break;
>+
>+      // Start finding links as you type
>+      case "'".charCodeAt(0):
>+        aEvent.preventDefault();
>+        this.startFind(window, true);
>+        break;

... make the charCodeAt values const members of typeAheadFind.prototype and use those.

>+  showStatusMatch: function(aResult, aExtra) {
>+    // Set the status text from a find result
>+    // link|text "..." [not] found [next|previous match] [(href)]
>+    if (aExtra)
>+      aExtra = " " + this.mBundle.GetStringFromName(aExtra);
>+    var url = "";
>+    var string = this.mLinks ? "link" : "text";
>+    if (aResult == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND)
>+      string += "not";
>+    else if (this.mFind.foundLink && this.mFind.foundLink.href)
>+      url = "  " + this.mBundle.GetStringFromName("openparen") +
>+                   this.mFind.foundLink.href +
>+                   this.mBundle.GetStringFromName("closeparen");
>+    string += "found";
>+    this.showStatus(this.mBundle.GetStringFromName(string) +
>+                    this.mSearchString +
>+                    this.mBundle.GetStringFromName("closequote") +
>+                    aExtra + url);
>+  },

This looks rather messy to me from a L10N point of view. Shouldn't this be one L10N string with placeholders to be filled in, because $language could have weird ideas about word order and such? KaiRo?

>+      // Ignore control characters.
>+      if (aEvent.keyCode || aEvent.charCode < " ".charCodeAt(0))

See above.

r=me with that.
Comment 30 neil@parkwaycc.co.uk 2008-11-25 13:28:04 PST
(In reply to comment #29)
>(From update of attachment 349961 [details] [diff] [review])
>>+  switch (pref.getIntPref("browser.backspace_action")) {
>>+  case 0:
>>+    BrowserBack();
>>+    break;
>>+  case 1:
>>+    goDoCommand("cmd_scrollPageUp");
>>+    break;
>Cases and their code lack one level of indentation.
Ironically all I did was unindent this because it used to be an inner block ;-)

> ... make the charCodeAt values const members of typeAheadFind.prototype
kSpace, kApos, kSlash?

>This looks rather messy to me from a L10N point of view.
Sure, but the patch itself is L10N neutral because the old code did this.
Comment 31 neil@parkwaycc.co.uk 2008-11-25 13:42:56 PST
Created attachment 350050 [details] [diff] [review]
For push
Comment 32 neil@parkwaycc.co.uk 2008-11-25 16:23:30 PST
Pushed changeset 7ed6a4b1c9db to comm-central.
Comment 33 Justin Wood (:Callek) 2008-11-26 10:17:27 PST
(In reply to comment #30)
> (In reply to comment #29)
> >This looks rather messy to me from a L10N point of view.
> Sure, but the patch itself is L10N neutral because the old code did this.

Can we get a followup bug on file for this, and mark it as a dependancy?
Comment 34 Frank Wein [:mcsmurf] 2008-11-26 12:45:22 PST
Created attachment 350206 [details] [diff] [review]
Package nsTypeAheadFind.js

Adds the new file to the installer/zip file.
Comment 35 Frank Wein [:mcsmurf] 2008-11-26 13:01:31 PST
Comment on attachment 350206 [details] [diff] [review]
Package nsTypeAheadFind.js

Checked in, changeset dced3f5e4c42.
Comment 36 Tony Mechelynck [:tonymec] 2008-11-26 14:07:44 PST
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20081126 SeaMonkey/2.0a2pre - Build ID: 20081126132932

Verified for Linux on this tinderbox-build: the / key triggers FAYT again.
:-) :-) :-) Hip, hip, hip, HURRAH! :-) :-) :-)
Comment 37 Serge Gautherie (:sgautherie) 2008-11-27 04:51:49 PST
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1b3pre) Gecko/20081127 SeaMonkey/2.0a2pre] (nightly) (W2Ksp4)

V.Fixed
Comment 38 Robert Kaiser (not working on stability any more) 2008-11-27 08:56:14 PST
(In reply to comment #33)
> (In reply to comment #30)
> > (In reply to comment #29)
> > >This looks rather messy to me from a L10N point of view.
> > Sure, but the patch itself is L10N neutral because the old code did this.
> 
> Can we get a followup bug on file for this, and mark it as a dependancy?

Filed as bug 467004.
Comment 39 doctor__j 2008-12-17 22:29:44 PST
Bug 470175 was filed to address the timeout problem of "Find as you type".
Comment 40 Robert Kaiser (not working on stability any more) 2009-09-18 06:17:55 PDT
Adding fixed-seamonkey2.0 to make it go away from "unfixed wanted" query

Note You need to log in before you can comment on or make changes to this bug.