Bug 692183 - Fix client coordinates for touchevents. r=mbrubeck a=asa
authorWes Johnston <wjohnston@mozilla.com>
Thu, 06 Oct 2011 11:23:14 -0700
changeset 79089 fafffd7c801e721a67f9a017d1fe90a02a4138fb
parent 79088 f41ea62c6d4c416e3d1718e5aaafb21e935717b5
child 79090 851dcf5a6ad1d55215f59456255e34612fb36373
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck, asa
bugs692183
milestone9.0a2
Bug 692183 - Fix client coordinates for touchevents. r=mbrubeck a=asa
mobile/chrome/content/content.js
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -1355,18 +1355,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);
     }