Closed Bug 1240286 Opened 8 years ago Closed 8 years ago

Deleting text with backspace causes the action bar to glitch

Categories

(Firefox for Android Graveyard :: Text Selection, defect)

46 Branch
defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
Firefox 47
Tracking Status
firefox47 --- fixed

People

(Reporter: kats, Assigned: capella)

Details

Attachments

(1 file, 2 obsolete files)

When I'm editing text in a text field or textarea with the action bar visible and hit backspace, the action bar glitches. Normally it shows the "check" icon on the left and "select all"/"paste" on the right. During the backspace it briefly switches to have a few more icons and then immediately switches back. The extra icons like "copy", "cut", and the three-dot menu button. If I hold down the backspace key this happens for every character deleted and is very distracting. I can post a video if needed. This is not a recent regression, it's been happening for a couple of weeks at least but I kept forgetting to file a bug.

Nightly on Nexus 4, using default keyboard.
Quick changes between selection state (CaretMode == None/Cursor/Selection) while the ActionBar is visible, causes this. Sounds like we could add a deferredAction timer to coalesce these, similar to what we use currently to smooth UI jank around fast selection close->re-open transitions [0].


[0] http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/SelectionHandler.js?rev=5a814b26505b,&mark=1150,1175#1140
Attached patch bug1240286.diff (obsolete) — Splinter Review
The basic issue is we're generating eSetSelection events is nsWindow to position us at start of IME text replacement logic. This is being heard by the selectionChanged observer in AccessibleCaretManager and passed to the ActionBarHandler.

For the the testcase at [0], observed in [1], and using the STR:
   1) tap into the input field immediately before the final string |problem|
   2) tap backspace twice.

Each backspace "selects" a char then replaces it with nothing, via: [2]. The AccessibleCaret state transitions from:

   CaretMode::Cursor -> Selection -> Cursor -> Selection -> Cursor

The ActionBarHandler notices, and tries to display different UI actions based on those changing states, and jank ensues. Instead of covering the jank, we should probably add a new selectionChange reason code that AccessibleCaretManager just ignores in the first place.

Note for kats, this shouldn't regress Bug 1230617.


[0] https://www.dropbox.com/s/v3fsmm837m5gicq/testActionBar_bug1240286.html?dl=0
[1] https://www.dropbox.com/s/jet0qiuuftjclbr/bug1240286_backspace.mp4?dl=0

[2] http://mxr.mozilla.org/mozilla-central/source/widget/android/nsWindow.cpp?rev=88a086706e1e&mark=2879-2884#2851
Attachment #8711466 - Flags: review?(nchen)
Comment on attachment 8711466 [details] [diff] [review]
bug1240286.diff

Review of attachment 8711466 [details] [diff] [review]:
-----------------------------------------------------------------

r+ for nsWindow.cpp change, but you need another reviewer for nsISelectionListener.idl and AccessibleCaretManager.cpp.
Attachment #8711466 - Flags: review?(nchen) → review+
Comment on attachment 8711466 [details] [diff] [review]
bug1240286.diff

Review of attachment 8711466 [details] [diff] [review]:
-----------------------------------------------------------------

The AccessibleCaret part looks good to me. You might want to update the uuid in nsISelectionListener.idl like you did in Bug 1215959 before asking smaug for reviewing the dom code.
Attached patch bug1240286.diff (obsolete) — Splinter Review
Carryover r+ from jchen, assumed from TYLin

r? to smaug as suggested ...

I updated the uuid in the .idl, though I think already, or soon, this won't be required anymore:

   https://groups.google.com/forum/#!msg/mozilla.dev.platform/n6qBpyxoI6I/4qxwFvBOAgAJ
Assignee: nobody → markcapella
Attachment #8711466 - Attachment is obsolete: true
Attachment #8712545 - Flags: review?(bugs)
Attached patch bug1240286.diffSplinter Review
smaug had asked why I couldn't use the same selection IME_REASON code, and the answer was basically that I wanted OnImeReplaceText() to always ignore eSetSelection events.

My worry was re-using that reason code might invoke [0], which has the potential to open/display carets that weren't already visible.

Walking back my train of thought, I realized that with the fix of Bug 1230617, and some testing for verification, we no longer needed that bit and it should have been removed.

Having done that, IME_REASON becomes generically "always ignore", and can be safely re-used for this bug, greatly simplifying things.

I've tested on my N7 and my GS3/CM12.1, with both the stock Google keyboard and the SwiftKey keyboard, with auto-correction ON and OFF. Additionally on my GS3 I tested with the Android (AOSP) keyboard with auto-correction set to OFF and to AGGRESSIVE.

I observe that this fixes this bug, and does not regress the previous one, in all cases.


[0] http://mxr.mozilla.org/mozilla-central/source/layout/base/AccessibleCaretManager.cpp?rev=1b65eca00113&mark=121-125#106
Attachment #8712545 - Attachment is obsolete: true
Attachment #8712545 - Flags: review?(bugs)
Attachment #8713807 - Flags: review?(bugs)
Attachment #8713807 - Flags: review?(bugs) → review+
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/343d3e913f20
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 47
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: