Bug 961612 - [AccessFu] Don't scale mouse events specially on Android. r=MarcoZ, a=bajaj
authorMax Li <maxli@maxli.ca>
Sun, 19 Jan 2014 23:22:51 -0800
changeset 167977 7f439322cb45670fa8e132897f04bb4fd16b71d3
parent 167976 b0f192de43938e73e08c9a192f07d10c3549b982
child 167978 cd615489ee57b9a09a5993408cbc5873bd4b63e4
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ, bajaj
bugs961612
milestone27.0
Bug 961612 - [AccessFu] Don't scale mouse events specially on Android. r=MarcoZ, a=bajaj
accessible/src/jsat/TouchAdapter.jsm
--- a/accessible/src/jsat/TouchAdapter.jsm
+++ b/accessible/src/jsat/TouchAdapter.jsm
@@ -329,53 +329,39 @@ this.TouchAdapter = {
 };
 
 /***
  * A TouchPoint represents a single touch from the moment of contact until it is
  * lifted from the surface. It is capable of compiling gestures from the scope
  * of one single touch.
  */
 function TouchPoint(aTouch, aTime, aDPI) {
-  this.startX = this.x = aTouch.screenX * this.scaleFactor;
-  this.startY = this.y = aTouch.screenY * this.scaleFactor;
+  this.startX = this.x = aTouch.screenX;
+  this.startY = this.y = aTouch.screenY;
   this.startTime = aTime;
   this.distanceTraveled = 0;
   this.dpi = aDPI;
   this.done = false;
 }
 
 TouchPoint.prototype = {
   update: function TouchPoint_update(aTouch, aTime) {
     let lastX = this.x;
     let lastY = this.y;
-    this.x = aTouch.screenX * this.scaleFactor;
-    this.y = aTouch.screenY * this.scaleFactor;
+    this.x = aTouch.screenX;
+    this.y = aTouch.screenY;
     this.time = aTime;
 
     this.distanceTraveled += this.getDistanceToCoord(lastX, lastY);
   },
 
   getDistanceToCoord: function TouchPoint_getDistanceToCoord(aX, aY) {
     return Math.sqrt(Math.pow(this.x - aX, 2) + Math.pow(this.y - aY, 2));
   },
 
-  get scaleFactor() {
-    if (!this._scaleFactor) {
-      // Android events come with the x, y coordinates affected by the widget
-      // scaling; we restore it to normal here.
-      if (Utils.MozBuildApp == 'mobile/android') {
-        this._scaleFactor = Utils.win.devicePixelRatio;
-      } else {
-        this._scaleFactor = 1;
-      }
-    }
-
-    return this._scaleFactor;
-  },
-
   finish: function TouchPoint_finish() {
     this.done = true;
   },
 
   /**
    * Compile a gesture from an individual touch point. This is used by the
    * TouchAdapter to compound multiple single gestures in to higher level
    * gestures.