[Pkg-mozext-commits] [firegestures] 10/13: Imported Upstream version 1.9~b2

David Prévot taffit at moszumanska.debian.org
Thu Jan 1 18:34:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository firegestures.

commit 81a172f51e7c92608d25cc1b69b480dca96aaa27
Merge: eb5c28b 0fd9312
Author: David Prévot <david at tilapin.org>
Date:   Thu Jan 1 11:10:18 2015 -0400

    Imported Upstream version 1.9~b2

 chrome/content/firegestures/browser.js |  29 ++++++--------
 chrome/content/firegestures/remote.js  |  37 +++++++++++-------
 components/FireGestures.xpt            | Bin 1449 -> 1476 bytes
 components/xdGestureHandler.js         |  69 +++++++++++++--------------------
 install.rdf                            |   6 +--
 5 files changed, 63 insertions(+), 78 deletions(-)

diff --cc chrome/content/firegestures/browser.js
index 108cf68,5e79d8f..6ae8f14
mode 100755,100644..100755
--- a/chrome/content/firegestures/browser.js
+++ b/chrome/content/firegestures/browser.js
@@@ -280,16 -317,21 +283,18 @@@ var FireGestures = 
  				document.getElementById(aCommand).doCommand();
  				break;
  			case "FireGestures:ScrollTop": 
- 				this._performScrollAction("cmd_scrollTop");
- 				break;
  			case "FireGestures:ScrollBottom": 
- 				this._performScrollAction("cmd_scrollBottom");
- 				break;
  			case "FireGestures:ScrollPageUp": 
- 				this._performScrollAction("cmd_scrollPageUp");
- 				break;
  			case "FireGestures:ScrollPageDown": 
- 				this._performScrollAction("cmd_scrollPageDown");
 -				// replace command name to cmd_scrollTop/Bottom/PageUp/PageDown
+ 				aCommand = aCommand.replace("FireGestures:Scroll", "cmd_scroll");
 -				// this effects only for mouse gesture with left-button on inner frame
+ 				this.sourceNode.ownerDocument.defaultView.focus();
 -				// [e10s]
+ 				if (this.isRemote) {
+ 					this.sendAsyncMessage("FireGestures:DoCommand", { cmd: aCommand });
+ 					return;
+ 				}
+ 				var docShell = gBrowser.mCurrentBrowser.docShell;
+ 				if (docShell.isCommandEnabled(aCommand))
+ 					docShell.doCommand(aCommand);
  				break;
  			case "FireGestures:ShowOnlyThisFrame": 
  				var doc = this.sourceNode.ownerDocument;
diff --cc chrome/content/firegestures/remote.js
index 2bb0753,a8985d3..2a50985
mode 100755,100644..100755
--- a/chrome/content/firegestures/remote.js
+++ b/chrome/content/firegestures/remote.js
@@@ -47,13 -58,40 +45,33 @@@ let FireGesturesRemote = 
  		this._startY = aData.y;
  		let { doc: doc, elt: elt } = this._elementFromPoint(aData.x, aData.y);
  		if (aData.button == 0) {
- 		}
- 		else if (aData.button == 1) {
 -			// cancel starting gesture on form elements
+ 			let localName = elt.localName;
+ 			if (["input", "textarea", "select", "option", "textbox", "menulist"].indexOf(localName) >= 0) {
 -				log("*** cancel starting gesture on form element (" + localName + ")");	// #debug
+ 				sendSyncMessage("FireGesturesRemote:Response", { name: "cancelMouseGesture" }, {});
+ 				return;
+ 			}
 -			// ready for cancel mouse gesture if gesture starts on scrollbar
+ 			let win = doc.defaultView;
+ 			win.removeEventListener("scroll", this, false);
+ 			win.addEventListener("scroll", this, false);
 -			// cancel selecting ranges
+ 			let sel = win.getSelection();
+ 			if (sel.isCollapsed)
+ 				win.setTimeout(function() { sel.removeAllRanges(); }, 10);
  		}
 -		// tell parent browser the source node and some info
  		sendSyncMessage("FireGesturesRemote:Response", { name: "sourceNode" }, { elt: elt });
  	},
  
+ 	handleEvent: function(event) {
+ 		switch (event.type) {
+ 			case "scroll": 
+ 				let win = event.target.defaultView;
+ 				win.removeEventListener("scroll", this, false);
+ 				sendSyncMessage("FireGesturesRemote:Response", { name: "cancelMouseGesture" }, {});
 -				log("*** cancel starting gesture on scrollbar");	// #debug
+ 				break;
+ 			default: 
+ 		}
+ 	},
+ 
  
 -	/* ::::: Keypress Gesture ::::: */
  
  	_linkURLs: null,
  	_linkElts: null,
@@@ -103,18 -144,8 +121,7 @@@
  	},
  
  
 -	/* ::::: Commands ::::: */
  
- 	_displayContextMenu: function FGR__displayContextMenu(aData) {
- 		let { doc: doc, elt: elt, x: x, y: y } = this._elementFromPoint(aData.x, aData.y);
- 		let evt = doc.createEvent("MouseEvents");
- 		evt.initMouseEvent(
- 			"contextmenu", true, true, doc.defaultView, 0,
- 			aData.x, aData.y, x, y,
- 			false, false, false, false, 2, null
- 		);
- 		elt.dispatchEvent(evt);
- 	},
- 
  	_doCommand: function FGR__doCommand(aData) {
  		if (docShell.isCommandEnabled(aData.cmd))
  			docShell.doCommand(aData.cmd);
diff --cc components/xdGestureHandler.js
index a5097e4,0d5cf59..ecb4b7d
mode 100755,100644..100755
--- a/components/xdGestureHandler.js
+++ b/components/xdGestureHandler.js
@@@ -153,19 -192,23 +153,18 @@@ xdGestureHandler.prototype = 
  				if (!this._gestureObserver.canStartGesture(event))
  					break;
  				if (event.button == 0) {
- 					var targetName = event.target.localName.toUpperCase();
- 					if (targetName == "INPUT" || targetName == "TEXTAREA") {
- 						break;
- 					}
- 					targetName = event.originalTarget.localName;
- 					if (targetName == "scrollbarbutton" || targetName == "slider" || targetName == "thumb") {
- 						break;
- 					}
- 					if (this._triggerButton == 0 && targetName == "select") {
- 						break;
+ 					if (this._triggerButton == 0) {
 -						// suppress starting gesture with left-button on HTML/XUL form elements
+ 						var localName = event.target.localName;
+ 						if (["input", "textarea", "select", "option", "textbox", "menulist"].indexOf(localName) >= 0) {
 -							log("*** suppress starting gesture on form element (" + localName + ")");	// #debug
+ 							break;
+ 						}
 -						// suppress starting gesture with left-button on scrollbar
+ 						var localName = event.originalTarget.localName;
+ 						if (["scrollbarbutton", "slider", "thumb"].indexOf(localName) >= 0) {
 -							log("*** suppress starting gesture on scrollbar (" + localName + ")");	// #debug
+ 							break;
+ 						}
  					}
  					this._isMouseDownL = true;
 -					this._isMouseDownM = false;	// fixed invalid state of _isMouseDownM after autoscrolling
 -					// any gestures with left-button - start
 +					this._isMouseDownM = false;
  					if (this._triggerButton == 0 && !this._isMouseDownM && !this._isMouseDownR && !this._altKey(event)) {
  						this._state = STATE_GESTURE;
  						this._startGesture(event);
@@@ -185,9 -232,11 +184,8 @@@
  					}
  				}
  				else if (event.button == 2) {
- 					var targetName = event.target.localName.toUpperCase();
- 					if (targetName == "OBJECT" || targetName == "EMBED") {
 -					// this fixes the problem: when showing context menu of a Flash movie, 
 -					// _isMouseDownR becomes true and then rocker-left will be fired with a left-click
+ 					var localName = event.target.localName;
+ 					if (localName == "object" || localName == "embed") {
 -						log("*** ignore right-click on flash movie (" + localName + ")");	// #debug
  						break;
  					}
  					this._isMouseDownR = true;
@@@ -212,7 -264,13 +210,11 @@@
  							this._state = STATE_KEYPRESS;
  							this._invokeExtraGesture(event, type);
  						}
 -						// mouse gesture
  						this._progressGesture(event);
 -						// cancel auto-scroll if trigger button is middle
+ 						if (this._triggerButton == 1 && this._isMouseDownM && 
+ 						    this._drawArea.mCurrentBrowser._autoScrollPopup) {
+ 							this._drawArea.mCurrentBrowser._autoScrollPopup.hidePopup();
+ 						}
  					}
  				}
  				else if (this._state == STATE_WHEEL || this._state == STATE_ROCKER) {
@@@ -240,10 -307,19 +242,15 @@@
  							this._invokeExtraGesture(event, "keypress-shift");
  						this._invokeExtraGesture(event, "keypress-stop");
  					}
 -					// any gestures - stop
  					this._stopGesture(event);
 -					// [Linux][Mac] display context menu artificially
  					if (this._shouldFireContext) {
  						this._shouldFireContext = false;
- 						this._displayContextMenu(event);
+ 						this._enableContextMenu(true);
 -						// synthesize contextmenu event by nsIDOMWindowUtils
+ 						var win = this._drawArea.ownerDocument.defaultView;
+ 						var x = event.screenX - win.document.documentElement.boxObject.screenX;
+ 						var y = event.screenY - win.document.documentElement.boxObject.screenY;
+ 						win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).
+ 						    sendMouseEvent("contextmenu", x, y, 2, 1, null);
 -						log("*** synthesize contextmenu event (" + x + ", " + y + ")");	// #debug
  					}
  				}
  				break;
@@@ -330,36 -436,11 +337,7 @@@
  		return this._suppressAlt ? event.altKey : false;
  	},
  
- 	_displayContextMenu: function FGH__displayContextMenu(event) {
- 		if ("nsContextMenu" in this._drawArea.ownerDocument.defaultView) {
- 			with (this._drawArea.ownerDocument.defaultView) {
- 				if (!nsContextMenu.prototype._setTargetInternal) {
- 					nsContextMenu.prototype._setTargetInternal = nsContextMenu.prototype.setTarget;
- 					nsContextMenu.prototype.setTarget = function(aNode, aRangeParent, aRangeOffset) {
- 						this._setTargetInternal(aNode, aRangeParent, this._rangeOffset);
- 					};
- 				}
- 				nsContextMenu.prototype._rangeOffset = event.rangeOffset;
- 			}
- 		}
- 		this._enableContextMenu(true);
- 		if (this._isRemote) {
- 			this._gestureObserver.sendAsyncMessage("FireGestures:ContextMenu", {
- 				x: event.screenX - this._drawArea.mCurrentBrowser.boxObject.screenX, 
- 				y: event.screenY - this._drawArea.mCurrentBrowser.boxObject.screenY, 
- 			});
- 			return;
- 		}
- 		var evt = event.originalTarget.ownerDocument.createEvent("MouseEvents");
- 		evt.initMouseEvent(
- 			"contextmenu", true, true, event.originalTarget.ownerDocument.defaultView, 0,
- 			event.screenX, event.screenY, event.clientX, event.clientY,
- 			false, false, false, false, 2, null
- 		);
- 		event.originalTarget.dispatchEvent(evt);
- 	},
- 
  	_enableContextMenu: function FGH__enableContextMenu(aEnable) {
 -		// If 'dom.event.contextmenu.enabled' is false,
 -		// there is a problem that context menu is not suppressed
 -		// by preventDefault and stopPropagation for DOM contextmenu event.
 -		// So, we should set hidden="true" attribute temporarily.
  		var elt = this._drawArea.ownerDocument.getElementById("contentAreaContextMenu");
  		if (!elt)
  			elt = this._drawArea.ownerDocument.getElementById("viewSourceContextMenu");
@@@ -518,7 -630,15 +496,12 @@@
  		this._stopGesture();
  	},
  
+ 	cancelMouseGesture: function FGH_cancelMouseGesture() {
+ 		this._directionChain = "";
+ 		this._stopGesture();
+ 	},
+ 
  
 -	/* ::::: MOUSE TRAIL ::::: */
  
  	_trailDot: null,
  	_trailArea: null,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firegestures.git



More information about the Pkg-mozext-commits mailing list