Bug 486562: remove unused widgetStack handleEvents code, r=bcombee/vlad
authorGavin Sharp <gavin@mozilla.com>
Sun, 05 Apr 2009 03:22:58 -0400
changeset 65154 35edef680c52863702744fa5df1603967e968cc2
parent 65153 84d970d8d3cbdb7be7f3570f2125c5d36a17206a
child 65155 34932ce7c9801e201b48aa4fd27cf06eb0ed46fb
push idunknown
push userunknown
push dateunknown
reviewersbcombee, vlad
bugs486562
Bug 486562: remove unused widgetStack handleEvents code, r=bcombee/vlad
mobile/chrome/content/WidgetStack.js
--- a/mobile/chrome/content/WidgetStack.js
+++ b/mobile/chrome/content/WidgetStack.js
@@ -390,28 +390,16 @@ WidgetStack.prototype = {
 
     if (this._viewport) {
       this._viewportBounds = new wsRect(0, 0, this._viewport.rect.width, this._viewport.rect.height);
     } else {
       this._viewportBounds = new wsRect(0, 0, 0, 0);
     }
   },
 
-  // handleEvents: if this is called, WS will install its own event handlers
-  // on the stack element for mouse clicks and motion.  Otherwise, the application
-  // must call dragStart/dragMove/dragStop as appropriate.
-  handleEvents: function () {
-    let self = this;
-
-    let e = window;
-    e.addEventListener("mousedown", function (ev) { return self._onMouseDown(ev); }, true);
-    e.addEventListener("mouseup", function (ev) { return self._onMouseUp(ev); }, true);
-    e.addEventListener("mousemove", function (ev) { return self._onMouseMove(ev); }, true);
-  },
-
   // moveWidgetBy: move the widget with the given id by x,y.  Should
   // not be used on vp-relative or otherwise frozen widgets (using it
   // on the x coordinate for x-ignore widgets and similarily for y is
   // ok, as long as the other coordinate remains 0.)
   moveWidgetBy: function (wid, x, y) {
     let state = this._getState(wid);
 
     state.rect.x += x;
@@ -813,71 +801,20 @@ WidgetStack.prototype = {
 
   _getState: function (wid) {
     let w = this._widgetState[wid]; 
     if (!w)
       throw "Unknown widget id '" + wid + "'; widget not in stack";
     return w; 
   },
 
-  _onMouseDown: function (ev) {
-    log("(mousedown)");
-    this.dragStart(ev.screenX, ev.screenY);
-
-    // we haven't yet recognized a drag; whatever happens make
-    // sure we start one after 50ms.
-    this._dragState.dragging = false;
-
-    let self = this;
-    this._dragState.dragStartTimeout = setTimeout(function () {
-                                                    self._dragState.dragStartTimeout = -1;
-                                                    self._delayedDragStart();
-                                                    self._dragUpdate();
-                                                  }, 50);
-  },
-
-  _onMouseUp: function (ev) {
-    log("(mouseup)");
-    if (!this._dragState)
-      return;
-
-    if (this._dragState.dragStartTimeout != -1)
-      clearTimeout(this._dragState.dragStartTimeout);
-
-    this.dragStop();
-  },
-
-  _onMouseMove: function (ev) {
-    if (!this._dragging)
-      return;
-
-    this._dragCoordsFromClient(ev.screenX, ev.screenY);
-
-    if (!this._dragging && this._dragState.outerDistSquared > 100)
-      this._delayedDragStart();
-
-    this.dragMove(ev.screenX, ev.screenY);
-  },
-
   get _dragging() {
     return this._dragState && this._dragState.dragging;
   },
 
-  // dragStart: a drag was started, either by distance or by time.
-  _delayedDragStart: function () {
-    log("(dragStart)");
-    if (this._dragging)
-      return;
-
-    if (this._dragState.dragStartTimeout != -1)
-      clearTimeout(this._dragState.dragStartTimeout);
-
-    this._dragState.dragging = true;
-  },
-
   _viewportUpdate: function _viewportUpdate() {
     if (!this._viewport)
       return;
 
     this._viewportUpdateTimeout = -1;
 
     let vws = this._viewport;
     let vwib = vws.viewportInnerBounds;
@@ -926,17 +863,16 @@ WidgetStack.prototype = {
     this._dragState.curTime = t ? t : Date.now();
     this._dragState.outerCurX = cx;
     this._dragState.outerCurY = cy;
 
     let dx = this._dragState.outerCurX - this._dragState.outerStartX;
     let dy = this._dragState.outerCurY - this._dragState.outerStartY;
     this._dragState.outerDX = dx;
     this._dragState.outerDY = dy;
-    this._dragState.outerDistSquared = dx*dx + dy*dy;
   },
 
   _panHandleBarriers: function (dx, dy) {
     // XXX unless the barriers are sorted by position, this will break
     // with multiple barriers that are near enough to eachother that a
     // drag could cross more than one.
 
     let vr = this._viewingRect;