Status

()

Firefox for Android
General
P3
normal
VERIFIED FIXED
6 years ago
a year ago

People

(Reporter: elan, Assigned: sriram)

Tracking

(Depends on: 1 bug)

unspecified
ARM
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox11 fixed, fennec11+)

Details

(Whiteboard: [QA+])

Attachments

(2 attachments, 5 obsolete attachments)

(Reporter)

Description

6 years ago
* UI popup needed for auto-file
Priority: -- → P3

Updated

6 years ago
OS: Mac OS X → Android
Hardware: x86 → ARM
Whiteboard: [QA+]

Comment 1

6 years ago
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?

Comment 3

6 years ago
(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

Comment 4

6 years ago
Created attachment 571481 [details] [diff] [review]
wip

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+
Created attachment 572028 [details]
stock browser on gingerbread

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.
Blocks: 704879
No longer blocks: 704879

Comment 8

6 years ago
Assigning to Sriram, since he's graciously taken over my work on this :)
Assignee: margaret.leibovic → sriram
(Assignee)

Comment 9

6 years ago
Created attachment 579419 [details] [diff] [review]
WIP

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)

Comment 10

6 years ago
Created attachment 579504 [details] [diff] [review]
WIP v2

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)
(Assignee)

Comment 11

6 years ago
Created attachment 579524 [details] [diff] [review]
WIP v3

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)

Comment 12

6 years ago
Created attachment 579938 [details] [diff] [review]
patch

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+

Comment 15

6 years ago
Created attachment 581737 [details] [diff] [review]
patch to land (un-bitrotted)
Attachment #579938 - Attachment is obsolete: true
http://hg.mozilla.org/mozilla-central/rev/b7bafe0967a9
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED

Updated

6 years ago
Blocks: 710835

Updated

6 years ago
Blocks: 710837

Updated

6 years ago
Flags: in-litmus?(martijn.martijn)

Updated

6 years ago
Depends on: 711096

Updated

6 years ago
Depends on: 711177

Updated

6 years ago
Depends on: 711181

Updated

6 years ago
Depends on: 711185

Updated

6 years ago
Depends on: 711194

Updated

6 years ago
Depends on: 711198

Updated

6 years ago
No longer depends on: 711194

Updated

6 years ago
No longer blocks: 710837
Depends on: 710837

Updated

6 years ago
No longer blocks: 710835
Depends on: 710835

Updated

6 years ago
Depends on: 711216

Updated

6 years ago
Depends on: 711218

Updated

6 years ago
Depends on: 711219

Updated

6 years ago
Depends on: 711227

Updated

6 years ago
No longer depends on: 711218

Updated

6 years ago
No longer depends on: 711219

Updated

6 years ago
Depends on: 713027
tracking-fennec: --- → 11+
status-firefox11: --- → fixed

Updated

6 years ago
Depends on: 717619
Verified as the form autocomplete feature is working now.
Status: RESOLVED → VERIFIED

Updated

6 years ago
Depends on: 717679

Updated

6 years ago
Depends on: 718684

Updated

3 years ago
Flags: in-litmus?(martijn.martijn)
You need to log in before you can comment on or make changes to this bug.