Closed Bug 721076 Opened 12 years ago Closed 12 years ago

Prevent default on touch events should prevent long taps and double taps

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(firefox11 fixed, firefox12 fixed, firefox13 verified, fennec+)

RESOLVED FIXED
Firefox 13
Tracking Status
firefox11 --- fixed
firefox12 --- fixed
firefox13 --- verified
fennec + ---

People

(Reporter: wesj, Assigned: wesj)

References

Details

Attachments

(2 files)

If you enable multitouch in Android, you'll find out that tapping on things like links results in longtap far to often, and clicks not very often. I think there's a bug in (my) code that isn't sending ACTION_UP motion events to the Java handlers correctly, but I'm not sure exactly where or why at this point.
I think this is also the root cause of issues with the current pan location jumping ahead sometimes. i.e. you lift you finger but the panzoomcontroller gets no action up. When you put your finger down again it thinks you have jumped to some new location.
Blocks: 603008
tracking-fennec: --- → +
I think this may be fixed by the patch in bug 721079 or the one in bug 721484. I am still seeing LongTaps fire on elements even when preventDefault is called though. Bug 721597 deals with long tap, but the bug being seen is really a result of us firing mouse events. Changing summary to be a bit more specific.
Summary: ACTION_UP is not handled correctly in Java with touch events enabled → Prevent default on touch events should prevent long taps and double taps
Attached patch Patch 1/2Splinter Review
Aha! Two parts here.

Sometimes we are trying to dispatch an event where there are no changedTouches. This probably means Android is detecting some change on a property that isn't in the spec (not sure what...). We return early, but we don't set that status bit, leading to us occasionally releasing panning.

This ensures we always return the same status (after touch start and the first touch move have established it).
Assignee: nobody → wjohnston
Attachment #593311 - Flags: review?(bugs)
Attached patch Patch 2/2Splinter Review
The second part is also stupidity on my part. We aren't setting up the initial value for allowDefaultActions early enough here, instead waiting for it to be set in a runnable. That means that the initial touchdown event is leaking through sometimes, and when the GestureListener gets nothing else, it eventually fires a longtap.
Attachment #593312 - Flags: review?(bugmail.mozilla)
Comment on attachment 593312 [details] [diff] [review]
Patch 2/2

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

Now that I'm re-reading this code to figure it out what the patch does, it seems much harder to follow. We should try to make it clearer at some point, although I'm not sure exactly yet how.

r+ on the patch, look ok.
Attachment #593312 - Flags: review?(bugmail.mozilla) → review+
As I was leaving last night I realized that, I don't know that double tap zoom has any hope of working on touchevents enabled pages that DON'T call prevent default. At least, there's a scenario where the user taps down and up, doesn't call prevent default. We don't send setPreventPanning(false) back from Gecko because we only do that on touchmove events. The user then taps down again and we clear the queue.

I think maybe I should move the timer code up so that it starts on touch down, try to ensure that it runs longer than the double tap timeout, and don't clear the queue unless setPreventDefault(true) happens.... Although that may result in the queue never clearing on pages that do preventDefault... Have to think/play with it a bit more I guess.

(In reply to Wesley Johnston (:wesj) from comment #4)
> Created attachment 593312 [details] [diff] [review]
> Patch 2/2
> 
> The second part is also stupidity on my part. We aren't setting up the
> initial value for allowDefaultActions early enough here, instead waiting for
> it to be set in a runnable. That means that the initial touchdown event is
> leaking through sometimes, and when the GestureListener gets nothing else,
> it eventually fires a longtap.
Comment on attachment 593311 [details] [diff] [review]
Patch 1/2

I hope there will be some Fennec specific tests for this all.
Attachment #593311 - Flags: review?(bugs) → review+
Comment on attachment 593312 [details] [diff] [review]
Patch 2/2

Regression caused by (bug #): Required for touch events
User impact if declined: No multitouch
Testing completed (on m-c, etc.): Landed on mc 2/1/12
Risk to taking this patch (and alternatives if risky): Low risk. Mobile only fixes to broken code.
String changes made by this patch: None.
Attachment #593312 - Flags: approval-mozilla-aurora?
Comment on attachment 593311 [details] [diff] [review]
Patch 1/2

Regression caused by (bug #): Required for touch events
User impact if declined: No multitouch
Testing completed (on m-c, etc.): Landed on mc 2/1/12
Risk to taking this patch (and alternatives if risky): Low risk. Mobile only fixes to broken code.
String changes made by this patch: None.
Attachment #593311 - Flags: approval-mozilla-aurora?
Comment on attachment 593311 [details] [diff] [review]
Patch 1/2

If/When we move this to Aurora, we would likely also want it on beta.
Attachment #593311 - Flags: approval-mozilla-beta?
Comment on attachment 593312 [details] [diff] [review]
Patch 2/2

If/When we move this to Aurora, we would likely also want it on beta.
Attachment #593312 - Flags: approval-mozilla-beta?
Comment on attachment 593311 [details] [diff] [review]
Patch 1/2

[Triage Comment]
Mobile only - approved for Aurora 12 and Beta 11.
Attachment #593311 - Flags: approval-mozilla-beta?
Attachment #593311 - Flags: approval-mozilla-beta+
Attachment #593311 - Flags: approval-mozilla-aurora?
Attachment #593311 - Flags: approval-mozilla-aurora+
Attachment #593312 - Flags: approval-mozilla-beta?
Attachment #593312 - Flags: approval-mozilla-beta+
Attachment #593312 - Flags: approval-mozilla-aurora?
Attachment #593312 - Flags: approval-mozilla-aurora+
https://hg.mozilla.org/mozilla-central/rev/8c027f9fc627
https://hg.mozilla.org/mozilla-central/rev/57c1a8889bac
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 13
Verified fixed on:

Firefox 13.0a1 (2012-03-06)
20120306031101
http://hg.mozilla.org/mozilla-central/rev/7d0d1108a14e

--
Device: HTC Desire
OS: Android 2.2
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: