Bug 525997: adjust row highlighting behaviour [r=mark.finkle]
authorVivien Nicolas <21@vingtetun.org>
Tue, 10 Nov 2009 10:28:36 -0500
changeset 1082 d36fe965dd06c1381dc44461d1f6a0b6bf476871
parent 1081 6da60192232841d4d6a090a577585c70d790dac8
child 1083 04f60748d2073a2919db5d9c1c426ebfc94b256c
push id950
push usermfinkle@mozilla.com
push dateTue, 10 Nov 2009 15:45:32 +0000
reviewersmark.finkle
bugs525997
Bug 525997: adjust row highlighting behaviour [r=mark.finkle]
chrome/content/InputHandler.js
--- a/chrome/content/InputHandler.js
+++ b/chrome/content/InputHandler.js
@@ -58,16 +58,19 @@ const kKineticUpdateInterval = 25;
 const kDecelerationRate = .10;
 
 // How sensitive kinetic scroll is to mouse movement
 const kSpeedSensitivity = .8;
 
 // How relevant x earlier milliseconds is to determining the speed.
 const kTimeRelevance = .01;
 
+// Same as NS_EVENT_STATE_ACTIVE from nsIEventStateManager.h
+const kStateActive = 0x00000001;
+
 /**
  * InputHandler
  *
  * The input handler is an arbiter between the Fennec chrome window inputs and any
  * registered input modules.  It keeps an array of input module objects.  Incoming
  * input events are wrapped in an EventInfo object and passed down to the input modules
  * in the order of the modules array.  Every registed module thus gets called with
  * an EventInfo for each event that the InputHandler is registered to listen for.
@@ -835,16 +838,17 @@ MouseModule.prototype = {
 
 /**
  * DragData handles processing drags on the screen, handling both
  * locking of movement on one axis, and click detection.
  */
 function DragData(owner, dragRadius) {
   this._owner = owner;
   this._dragRadius = dragRadius;
+  this._domUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
   this.reset();
 };
 
 DragData.prototype = {
   reset: function reset() {
     this.dragging = false;
     this.sX = null;
     this.sY = null;
@@ -872,16 +876,22 @@ DragData.prototype = {
     }
   },
 
   setDragPosition: function setDragPosition(sX, sY) {
     // Check if drag is now a pan.
     if (!this._isPan) {
       let distanceSquared = (Math.pow(sX - this._originX, 2) + Math.pow(sY - this._originY, 2));
       this._isPan = (distanceSquared > Math.pow(this._dragRadius, 2));
+      if (this._isPan) {
+        // dismiss the active state of the pan element
+        let target = document.documentElement;
+        let state = this._domUtils.getContentState(target);
+        this._domUtils.setContentState(target, state & kStateActive);
+      }
     }
 
     // If now a pan, mark previous position where panning was.
     if (this._isPan) {
       let absX = Math.abs(this._originX - sX);
       let absY = Math.abs(this._originY - sY);
 
       // After the first lock, see if locking decision should be reverted.