Bug 692183 - Fix client coordinates for touchevents. r=mbrubeck
authorWes Johnston <wjohnston@mozilla.com>
Thu, 06 Oct 2011 11:23:14 -0700
changeset 78255 e53f415e6cc7897fd6ba49594337c4c88a542c8f
parent 78254 13115601c9ece72a126037c94301363aeeb7b501
child 78256 cfda40f4a5c815bb8954002fdf59dbe89dc34dab
push id2453
push userwjohnston@mozilla.com
push dateThu, 06 Oct 2011 18:23:49 +0000
treeherdermozilla-inbound@e53f415e6cc7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs692183
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 692183 - Fix client coordinates for touchevents. r=mbrubeck
mobile/chrome/content/content.js
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -1353,18 +1353,19 @@ var TouchEventHandler = {
     }
   },
 
   sendEvent: function(aName, aData, aElement) {
     if (!Services.prefs.getBoolPref("dom.w3c_touch_events.enabled"))
       return true;
 
     let evt = content.document.createEvent("touchevent");
+    let scrollOffset = ContentScroll.getScrollOffset(aElement.ownerDocument.defaultView);
     let point = content.document.createTouch(content, aElement, 0,
-                                             aData.x, aData.y, aData.x, aData.y, aData.x, aData.y,
+                                             aData.x, aData.y, aData.x, aData.y, aData.x - scrollOffset.x, aData.y - scrollOffset.y,
                                              1, 1, 0, 0);
     let touches = content.document.createTouchList(point);
     if (aName == "touchend") {
       let empty = content.document.createTouchList();
       evt.initTouchEvent(aName, true, true, content, 0, true, true, true, true, empty, empty, touches);      
     } else {
       evt.initTouchEvent(aName, true, true, content, 0, true, true, true, true, touches, touches, touches);
     }