Closed Bug 653990 Opened 13 years ago Closed 13 years ago

preventDefault on touchmove does not completely prevent panning

Categories

(Firefox for Android Graveyard :: Panning/Zooming, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
Firefox 6

People

(Reporter: mbrubeck, Assigned: mbrubeck)

References

Details

(Keywords: compat)

Attachments

(2 files, 1 obsolete file)

Steps to reproduce (on Fennec nightly):
1. Open http://limpet.net/w3/touchevents/preventDefault.html
2. Hide the urlbar and sidebars.
3. Start a vertical drag gesture in the box that says "prevent move"

Expected results: The page does not pan.

Actual results: The page pans slightly, then stops.

This happens because the first pan is applied before the touchmove event is processed.
Attached patch patch (obsolete) — Splinter Review
Wait until the first touchmove event is processed before re-enabling panning.
Attachment #529344 - Flags: review?(wjohnston)
This fixes two errors I found in related code:

* Missed one s/contentCanCaptureMouse/contentMightCaptureMouse/ which means that contentMightCaptureMouse is always set to "undefined" in the parent process. (Regression from bug 650339.)

* "json is not defined" exception in TouchEventHandler.receiveMessage in the case where mayHaveTouchEventListener is false, which means that the Browser:CaptureEvents message is not actually sent in this case.  (Error introduced in bug 653899.)

There's also an s/ContentTouchHandler/this/ which is not an error, just code cleanup.
Attachment #529351 - Flags: review?(wjohnston)
Attachment #529351 - Flags: review?(wjohnston) → review+
I'm still looking at the first patch. The patch looks fine, but I feel like we currently have to many similar variables here. contentMouseCapture, contentMightCaptureMouse, canCancelPan, and now preventPanning.

I'm going to play with combining them as much as possible into one multi-state variable.
Comment on attachment 529351 [details] [diff] [review]
misc bustage fixes (checked in)

http://hg.mozilla.org/mozilla-central/rev/081668165af3
Attachment #529351 - Attachment description: misc bustage fixes → misc bustage fixes (checked in)
Attached patch patch v2Splinter Review
Updated to apply against master, and fixed a bug that broke the "touchend" event.

(In reply to comment #3)
> I'm still looking at the first patch. The patch looks fine, but I feel like we
> currently have to many similar variables here. contentMouseCapture,
> contentMightCaptureMouse, canCancelPan, and now preventPanning.
> 
> I'm going to play with combining them as much as possible into one multi-state
> variable.

Yeah, it seems like we might be better off explicitly modelling this as a state machine.  We might want to do that as a followup bug, though -- right now, this patch has a noticeable impact on pages like http://www.quirksmode.org/m/tests/drag.html where dragging the element left or right causes the toolbars to move onscreen.
Attachment #529344 - Attachment is obsolete: true
Attachment #529344 - Flags: review?(wjohnston)
Attachment #529517 - Flags: review?(wjohnston)
(In reply to comment #3)
> I'm still looking at the first patch. The patch looks fine, but I feel like we
> currently have to many similar variables here. contentMouseCapture,
> contentMightCaptureMouse, canCancelPan, and now preventPanning.
> 
> I'm going to play with combining them as much as possible into one multi-state
> variable.

I definitely agree that we have too many state variables. That's expected, imo, when building a new feature. I also agree with Matt that we can file a bug for followup work.

Now that touch-events are stablizing, we should look for any cleanup and refactoring work.
Comment on attachment 529517 [details] [diff] [review]
patch v2

Sounds like a plan.
Attachment #529517 - Flags: review?(wjohnston) → review+
http://hg.mozilla.org/mozilla-central/rev/67bd71d5eae6
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 6
Verified fixed on build: Mozilla /5.0 (Android;Linux armv7l;rv:6.0a1) Gecko/20110504
Firefox/6.0a1 Fennec/6.0a1 
Device: LG Optimus 2X
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: