Closed Bug 695444 Opened 13 years ago Closed 13 years ago

Form history

Categories

(Firefox for Android Graveyard :: General, defect, P3)

ARM
Android
defect

Tracking

(firefox11 fixed, fennec11+)

VERIFIED FIXED
Tracking Status
firefox11 --- fixed
fennec 11+ ---

People

(Reporter: elan, Assigned: sriram)

References

Details

(Whiteboard: [QA+])

Attachments

(2 files, 5 obsolete files)

* UI popup needed for auto-file
Priority: -- → P3
OS: Mac OS X → Android
Hardware: x86 → ARM
Whiteboard: [QA+]
I started to look into this today, but I got a little overwhelmed/confused by trying to figure out what XUL fennec was doing and what changes we would need to make to get this to work on native fennec.

Mark, do you have a general idea of what needs to be done here? I think I could get rolling once I have some more guidance.
Margaret, the biggest issue with form history on mobile has always been the UI. We don't want to use the autocomplete popup that desktop uses. We ended up making our own "touch friendly" XUL arrowbox UI.

In XUL Fennec, you should see the Form Assistant (spread across some chrome JS and forms.js content script) trying to determine if history is available for a textbox and if so, displaying the history in a popup list.

Looking at the core FormHistory component, I see we need to instaniate the service to loadFrameScript. We do this for e10s and non-e10s:
http://mxr.mozilla.org/mozilla-central/source/toolkit/components/satchel/nsFormHistory.js#139

The frame script hooks up a listener, so we can save data when forms are submitted.

The UI used for desktop Firefox comes from a <panel id="PopupAutoComplete"/> in browser.xul that is eventually attached to a <browser> when created. Then a FormFillController is created and attached:
http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/browser.xml#508

Since mobile doesn't use the panel approach and Java UI in particular won't use XUL, we handle things differently. We basically wait for a text field to become focused, then we use the nsIFormAutoComplete service to manually build a list of "suggestions" and show those in a popup UI:
http://mxr.mozilla.org/mozilla-central/source/mobile/chrome/content/common-ui.js#811

We update the list on "keypress" (doesn't work well with IME) and "text" (works well with IME). I guess we could use some kind of list widget to show the list.

First things first, let's see if we can:
* Get the service started so we save data on submit
* Track accessing autocomplete-able textboxes (see forms.js)
* Get a list of suggestions for a textbox, updated as well type

Once we have this, we can work with UX to get a way to display the list. Sound OK?
(In reply to Mark Finkle (:mfinkle) from comment #2)
> Once we have this, we can work with UX to get a way to display the list.
> Sound OK?

Sounds like a plan! Thanks for the detailed comment.
Assignee: nobody → margaret.leibovic
Attached patch wip (obsolete) — Splinter Review
This patch does the basic first steps outlined in comment 2. I just tested with the google search box, but the dump statement shows we're getting autocomplete results like we should.

I just took the bare minimum from forms.js and common-ui.js to make this work. I figure we can add more functionality back in one piece at a time.
Attachment #571481 - Flags: feedback?(mark.finkle)
Comment on attachment 571481 [details] [diff] [review]
wip

> var FormAssistant = {
>+  init: function() {
>+    addEventListener("text", this, false);

BrowserApp.deck.addEventListener(...)

just to be more explicit

Looks good. I think we also need to handle the case of when a textbox gets focus. We usually "show" the suggestions, just to minimize user typing if suggestions exist.
Attachment #571481 - Flags: feedback?(mark.finkle) → feedback+
example of what stock browser on gingerbread does for UI
That example (of the native browser) is kind of minimum good UX, but it would do.
No longer blocks: 704879
Assigning to Sriram, since he's graciously taken over my work on this :)
Assignee: margaret.leibovic → sriram
Attached patch WIP (obsolete) — Splinter Review
This WIP has the logic for showing the autocomplete list -- positioned relative to the textbox.
The width adjusts based on the size of the textbox
  - if the textbox extends outside the screen, the list uses a "fill_parent" mode
  - if not, the list's width is shrunk to the size of the textbox

The height is constant now (100dp) which needs some cleanup.
If the list might be hidden by the keyboard, the list is tried to be show above the textbox. In case it can't be shown about the textbox, it default to be hidden box the keyboard. -- This could be fixed by playing with height more.

There needs some cleanup in showing. I need to take a look at it to optimize few bits there.

Todo:
1. Fixing the height
2. Sending event back to Gecko
3. Updating textbox with the string from Java
4. Cleaning up browser.js
Attachment #579419 - Flags: feedback?(mark.finkle)
Attached patch WIP v2 (obsolete) — Splinter Review
I'm still seeing a few issues with the element value not being set correctly in the "FormAssist:AutoComplete" observer in FormAssistant, but this looks like it's most of the way there.
Attachment #571481 - Attachment is obsolete: true
Attachment #579419 - Attachment is obsolete: true
Attachment #579419 - Flags: feedback?(mark.finkle)
Attachment #579504 - Flags: feedback?(mark.finkle)
Attached patch WIP v3 (obsolete) — Splinter Review
Added some optimization to AutoCompletePopup.java. If it is already shown, the width and height are not calculated again for every event received from Gecko.

Also added a bit of animation ;)
Attachment #579504 - Attachment is obsolete: true
Attachment #579504 - Flags: feedback?(mark.finkle)
Attachment #579524 - Flags: review?
Attachment #579524 - Flags: feedback?(mark.finkle)
Attached patch patch (obsolete) — Splinter Review
This patch uses .blur() to remove focus from the input box before trying to set its value, and it appears to solve our problem.

A few minor changes from the last WIP:
-I renamed showPopup to show to be consistent with hide
-I got rid of our own isShowing method, since isShown is already a View method
Attachment #579524 - Attachment is obsolete: true
Attachment #579524 - Flags: review?
Attachment #579524 - Flags: feedback?(mark.finkle)
Attachment #579938 - Flags: review?(mark.finkle)
Comment on attachment 579938 [details] [diff] [review]
patch

I am running with this patch for a bit and will review soon.
Comment on attachment 579938 [details] [diff] [review]
patch

This seems to work OK for a first pass. I think we can look into a few things as followups:

* I can see the popup list flicker as I type. I mean it will briefly appear then disappear because there is no match based on what is in the editbox
* Bluring might not be the best solution. We should ask around to see if anyone (alexp or lucasr) have ideas for other ways to fix setting the value.

Sorry for taking too long on this
Attachment #579938 - Flags: review?(mark.finkle) → review+
Attachment #579938 - Attachment is obsolete: true
Blocks: 710835
Blocks: 710837
Flags: in-litmus?(martijn.martijn)
Depends on: 711096
Depends on: 711177
Depends on: 711181
Depends on: 711185
Depends on: 711194
Depends on: 711198
No longer depends on: 711194
No longer blocks: 710837
Depends on: 710837
No longer blocks: 710835
Depends on: 710835
Depends on: 711216
Depends on: 711218
Depends on: 711219
Depends on: 711227
No longer depends on: 711218
No longer depends on: 711219
Depends on: 713027
tracking-fennec: --- → 11+
Depends on: 717619
Verified as the form autocomplete feature is working now.
Status: RESOLVED → VERIFIED
Depends on: 717679
Depends on: 718684
Flags: in-litmus?(martijn.martijn)
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: