Consolidate gesture detection and event handling code for nsEventStateManager and BrowserElementScrolling




5 years ago
a year ago


(Reporter: cpeterson, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [technical-debt][tech-p2])



5 years ago
Android, B2G, and Metro have separate implementations of gesture detection, event handling, and APZC. We should try to consolidate this code and teach nsEventStateManager about gestures, if necessary.

mbrubeck says: "[For Metro] We plan to re-use B2G's AsyncPanZoomController if possible, which should let us share code for panning and zooming gestures.  We haven't looked into this in detail yet; I think it will depend on getting OMTC working on Metro."

cjones says: "There are really two things here, APZC and gesture detection. Bug 745136 is probably the closest to a tracking bug. ... We need to unify event handling done by BrowserElementScrolling/browser.js/TabChild/nsEventStateManager/widget/fennec frontend."
Whiteboard: [technical-debt]
I think the ideal end result of this work should be that, either a gesture is handled by an APZC, or it's handled by EventStateManager.

I'm not too familiar with ESM, but I think we need to teach it to
 - handle touch events "natively", to the same degree as mouse events
 - infer "tap" and "drag" gestures from raw series of touch events
 - understand externally-delivered "tap" and "doubletap" gestures (sent from APZC).  This code may exist already.
 - infer "fling" gestures from raw touch-event series and implement the induced animations

I suspect this would not be easy, but it would completely obsolete BrowserElementPanning.js, the TabChild mouse-event inference, and whatever hacks fennec/metro use for synchronously-scrolled subframes.  It would also fix whatever bugs there most likely are in BrowserElementPanning pseudo-class creation.

Ideally, ESM and APZC should share the same C++ gesture-detection code.

This "refactoring" is also the only way we have to implement the pointer-events spec generically across gecko products.  So I consider this a major technical issue.
Blocks: 844910
Whiteboard: [technical-debt] → [technical-debt][tech-p2]
Oh, probably obvious, but ESM also needs to be able to synthesize mouse events from touch events when appropriate.

Comment 3

5 years ago
ESM sounds too late place to handle gestures. ESM is called when presshell has already done
all the hit testing etc.
Gesture detection pretty much completely happens in APZ these days. I'm going to close this bug.
Last Resolved: a year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.