Closed Bug 745381 Opened 12 years ago Closed 12 years ago

We send a lot of touch events during panning of http://people.mozilla.org/~jrosevear/color-test.html

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(blocking-fennec1.0 +)

RESOLVED FIXED
Firefox 14
Tracking Status
blocking-fennec1.0 --- +

People

(Reporter: jrmuizel, Assigned: wesj)

References

Details

(Whiteboard: [mtd][inbound])

Attachments

(2 files)

This means we end up calling GetFrameForPoint which can be expensive on complex pages.
One really easy optimization here, we don't actually need to refind target's for touch events. They're always dispatched to the original target. We can probably just skip GetFrameForPoint for anything but touchstart events.
Also something to consider: https://bugzilla.mozilla.org/show_bug.cgi?id=743736#c4
OS: Linux → Android
Hardware: x86_64 → All
There's also a bug(?) in:

http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsGfxScrollFrame.cpp#2169

which causes us to use the entire displayport when building a list for hit testing in Fennec (note that should be true for mouse events as well, since I assume elementFromPoint and nodesFromRect take this same code path).
Brian - Is this optimization the same as bug 743736? If not, let's impl it. If it is, let's dupe it.
Assignee: nobody → bnicholson
blocking-fennec1.0: ? → +
(In reply to Wesley Johnston (:wesj) from comment #3)
> There's also a bug(?) in:
> 
> http://mxr.mozilla.org/mozilla-central/source/layout/generic/
> nsGfxScrollFrame.cpp#2169
> 
> which causes us to use the entire displayport when building a list for hit
> testing in Fennec (note that should be true for mouse events as well, since
> I assume elementFromPoint and nodesFromRect take this same code path).

Should this be a separate bug?
Yep. Filed bug 745936.
Attached patch PatchSplinter Review
Sorry to steal this back. I'm digging through all this code anyway. Easy fix.

I'm not sure this will fix this bug. We still send tons of touch events. Just faster. Fingers jitter on the screen, and in addition we send them if your pressure or the radius of the touch changes.

If this isn't enough, we could try smoothing some of that data and only sending events from java if there is a significant delta between the last one. But I wanted to avoid that and give pages access to as close to the raw data as we can (our data is already filtered by android to some extent).
Assignee: bnicholson → wjohnston
Attachment #615513 - Flags: review?(bugs)
This patch is a bigger hammer to fix this nail; it will just not send the touch events at all if the page isn't listening for them. From what I can tell, the dom-touch-listener-added will always get called if a page registered a touch listener, so this should always be correct. It may be the case that the page unregisters its touch listeners and there we will keep firing events. (Also if this patch lands then bug 744518 should be marked as WONTFIX because that will render this patch moot by adding a touchstart listener on every page, effectively).
Attachment #615557 - Flags: review?(wjohnston)
Comment on attachment 615513 [details] [diff] [review]
Patch

So where do we get the right target?
For anything that's not a touch move, we are caching the target (on a per touch basis) and redispatching to it here:

http://mxr.mozilla.org/mozilla-beta/source/layout/base/nsPresShell.cpp#6725

This code (the code we're skipping around with this patch) currently fails for touchmove/touchend/touchcancel because the refpoint for those points is (0,0) (inherited from nsEvent). We special cased TOUCH_DOWN slightly above this so that it returns the "correct" refpoint.
Attachment #615513 - Flags: review?(bugs) → review+
After much hg fail, pushed with the wrong bug number (argh. I'm done with inbound for the day I think):

https://hg.mozilla.org/integration/mozilla-inbound/rev/d07b72d4865d
Marking mtd for the inbound people. I still need to look at kat's patch here. Truthfully, I don't want to do that, and would like to see where we are after this before we take a bigger hammer to it.

If we want to clear the blocker, we can move that to a different bug?
Whiteboard: [mtd][inbound]
Feel free to r- the patch and if we need it later we can file a new bug and grab the patch from here.
(In reply to Kartikaya Gupta (:kats) from comment #13)
> Feel free to r- the patch and if we need it later we can file a new bug and
> grab the patch from here.

Let's file a new bug and move the patch, especially if the risks are different.
https://hg.mozilla.org/mozilla-central/rev/d07b72d4865d
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 14
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: