touch event coordinate system doesn't correspond to element clientwidth/height

VERIFIED DUPLICATE of bug 771575

Status

()

Firefox for Android
Toolbar
VERIFIED DUPLICATE of bug 771575
5 years ago
5 years ago

People

(Reporter: Mitchell Skinner, Unassigned)

Tracking

15 Branch
ARM
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
Created attachment 659639 [details]
test case

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1
Build ID: 20120905151427

Steps to reproduce:

View the attached test case on a Nexus S (with Android 4.1.1).

Touch near the bottom-right corner of the screen.


Actual results:

Touch coordinates (event.touches[0].clientX/Y) are different from what they should be.

With the attached test case (which contains a meta viewport element), touching at the bottom right corner of the screen gives me values like this:

container width: 480, container height: 690, client X: 315, client Y: 459

(clientX/Y values are approximate, they vary from touch to touch)
if I comment out the meta viewport, I get values like:
container width: 480, container height: 690, client X: 954, client Y: 1354


Expected results:

Touch coordinates should correspond to the page element sizes/positions.  If the element receiving events has top left at (0, 0), then touches near the bottom right corner of the element should have coordinates close to the width/height of the element.

With the stock android browser, with the meta viewport element, bottom-right-corner touches give me values like:

container width: 320, container height: 456, client X: 312, client Y: 451

and without the meta viewport element, I get values like:

container width:  980, container height: 1397, client X: 954, client Y: 1380
(Reporter)

Updated

5 years ago
OS: Linux → Android
Hardware: x86_64 → ARM
Attachment #659639 - Attachment mime type: text/plain → text/html
This works for me on aurora and nightly builds. I believe it was fixed by bug 771575. I'll request that be uplifted to beta as well, but in the meantime there is a workaround described at https://bugzilla.mozilla.org/show_bug.cgi?id=771575#c3 (basically, use a setTimeout(0, ...) before grabbing the width and height) that may work for you.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 771575
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.