[Pkg-mozext-commits] [firegestures] 02/07: [e10s] swipe gesture in remote
David Prévot
taffit at moszumanska.debian.org
Sun Jan 11 16:59:17 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 e6fb017fc46b445605a5af23f04f1d4482f303e3
Author: Gomita <gomita at xuldev.org>
Date: Sat Jan 3 11:10:50 2015 +0900
[e10s] swipe gesture in remote
---
chrome/content/firegestures/browser.js | 9 +++++----
chrome/content/firegestures/remote.js | 23 ++++++++++-------------
components/xdGestureHandler.js | 10 ++++++++++
3 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/chrome/content/firegestures/browser.js b/chrome/content/firegestures/browser.js
index 5e79d8f..e2645ab 100644
--- a/chrome/content/firegestures/browser.js
+++ b/chrome/content/firegestures/browser.js
@@ -76,10 +76,7 @@ var FireGestures = {
// receive message from remote browser
receiveMessage: function(aMsg) {
- // #debug-begin
- var val = aMsg.name + ":\n" + aMsg.data.toSource() + "\n" + (aMsg.objects.elt || aMsg.objects);
- Services.console.logStringMessage(val);
- // #debug-end
+ dump(aMsg.name + " " + aMsg.data.toSource() + " " + (aMsg.objects.elt || aMsg.objects.toSource()) + "\n"); // #debug
switch (aMsg.data.name) {
case "sourceNode":
// replace |sourceNode| of gesture handler by CPOW object
@@ -91,6 +88,10 @@ var FireGestures = {
case "cancelMouseGesture":
this._gestureHandler.cancelMouseGesture();
break;
+ case "swipe":
+ this.onMouseGesture(null, "swipe-" + aMsg.objects.direction);
+ this._gestureHandler.sourceNode = null;
+ break;
default:
}
},
diff --git a/chrome/content/firegestures/remote.js b/chrome/content/firegestures/remote.js
index 968203c..2e8379c 100644
--- a/chrome/content/firegestures/remote.js
+++ b/chrome/content/firegestures/remote.js
@@ -23,6 +23,7 @@ let FireGesturesRemote = {
addMessageListener("FireGestures:KeypressStart", this);
addMessageListener("FireGestures:KeypressProgress", this);
addMessageListener("FireGestures:KeypressStop", this);
+ addMessageListener("FireGestures:SwipeGesture", this);
addMessageListener("FireGestures:DoCommand", this);
addMessageListener("FireGestures:SendKeyEvent", this);
addMessageListener("FireGestures:CreateTrail", this);
@@ -37,6 +38,7 @@ let FireGesturesRemote = {
case "FireGestures:KeypressStart" : this._onKeypressStart(); break;
case "FireGestures:KeypressProgress": this._onKeypressProgress(aMsg.data); break;
case "FireGestures:KeypressStop" : this._onKeypressStop(); break;
+ case "FireGestures:SwipeGesture" : this._onSwipeGesture(aMsg.data); break;
case "FireGestures:DoCommand" : this._doCommand(aMsg.data); break;
case "FireGestures:SendKeyEvent": this._sendKeyEvent(aMsg.data); break;
case "FireGestures:CreateTrail" : this._createTrail(aMsg.data); break;
@@ -78,6 +80,13 @@ let FireGesturesRemote = {
sendSyncMessage("FireGesturesRemote:Response", { name: "sourceNode" }, { elt: elt });
},
+ _onSwipeGesture: function(aData) {
+ log("onSwipeGesture: " + aData.toSource()); // #debug
+ let { elt: elt } = this._elementFromPoint(aData.x, aData.y);
+ sendSyncMessage("FireGesturesRemote:Response", { name: "sourceNode" }, { elt: elt });
+ sendSyncMessage("FireGesturesRemote:Response", { name: "swipe" }, { direction: aData.direction });
+ },
+
handleEvent: function(event) {
switch (event.type) {
case "scroll":
@@ -169,18 +178,6 @@ let FireGesturesRemote = {
/* ::::: Utils ::::: */
-// // returns DOM element and some related data which is under the mouse pointer
-// _elementAtPointer: function FGR__elementAtPointer() {
-// let doc = content.document;
-// let elt = doc.querySelector(":hover") || doc.body || doc.documentElement;
-// while (/^i?frame$/.test(elt.localName.toLowerCase())) {
-// doc = elt.contentDocument;
-// elt = doc.querySelector(":hover");
-// }
-// log("_elementAtPointer: " + [doc.location, elt.localName].join(", ")); // #debug
-// return elt;
-// },
-
// returns DOM element and some data related which is located at given coordinates
_elementFromPoint: function FGR__elementFromPoint(x, y) {
let doc = content.document;
@@ -192,7 +189,7 @@ let FireGesturesRemote = {
elt = doc.elementFromPoint(x, y);
}
// log("_elementFromPoint: " + [doc.location, elt.localName, x, y].join(", ")); // #debug
- return { doc: doc, elt: elt, x: x, y: y };
+ return { doc: doc, elt: elt };
},
diff --git a/components/xdGestureHandler.js b/components/xdGestureHandler.js
index 744f389..6cdaa19 100644
--- a/components/xdGestureHandler.js
+++ b/components/xdGestureHandler.js
@@ -385,6 +385,16 @@ xdGestureHandler.prototype = {
case event.DIRECTION_UP : direction = "up"; break;
case event.DIRECTION_DOWN : direction = "down"; break;
}
+ this._isRemote = this._drawArea.mCurrentBrowser.getAttribute("remote") == "true";
+ // [e10s] get source node and invoke extra gesture in remote
+ if (this._isRemote) {
+ this._gestureObserver.sendAsyncMessage("FireGestures:SwipeGesture", {
+ direction: direction,
+ x: event.screenX - this._drawArea.mCurrentBrowser.boxObject.screenX,
+ y: event.screenY - this._drawArea.mCurrentBrowser.boxObject.screenY,
+ });
+ return;
+ }
this.sourceNode = event.target;
this._invokeExtraGesture(event, "swipe-" + direction);
this.sourceNode = 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