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 174977 5ff9dcd0fadd43a0784bb67a51f4780311813c7e
parent 174976 f8682f72bc3661f636dedd9f2a2f5bf057885e03
child 174978 ac213f3a5bf9a341395aa1dd3c2fec41cb4db646
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ, bajaj
bugs961612
milestone28.0a2
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.