Closed Bug 789870 Opened 12 years ago Closed 12 years ago

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

Categories

(Firefox for Android Graveyard :: Toolbar, defect)

15 Branch
ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 771575

People

(Reporter: bugzilla, Unassigned)

Details

Attachments

(1 file)

Attached file 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
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
Closed: 12 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
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: