mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Backed out changeset a8ad10daa7c0 (bug 932804) to fix the jenkins builds; a=jenkins
This commit is contained in:
parent
6fc258bd19
commit
9a6a74ab70
@ -166,8 +166,6 @@ FrameManager.prototype = {
|
||||
messageManager.addWeakMessageListener("Marionette:emitTouchEvent", this.server);
|
||||
messageManager.addWeakMessageListener("Marionette:log", this.server);
|
||||
messageManager.addWeakMessageListener("Marionette:register", this.server);
|
||||
messageManager.addWeakMessageListener("Marionette:setStatusbarHeight", this.server);
|
||||
messageManager.addWeakMessageListener("Marionette:getStatusbarHeight", this.server);
|
||||
messageManager.addWeakMessageListener("Marionette:runEmulatorCmd", this.server);
|
||||
messageManager.addWeakMessageListener("Marionette:runEmulatorShell", this.server);
|
||||
messageManager.addWeakMessageListener("Marionette:shareData", this.server);
|
||||
@ -198,8 +196,6 @@ FrameManager.prototype = {
|
||||
messageManager.removeWeakMessageListener("Marionette:log", this.server);
|
||||
messageManager.removeWeakMessageListener("Marionette:shareData", this.server);
|
||||
messageManager.removeWeakMessageListener("Marionette:register", this.server);
|
||||
messageManager.removeWeakMessageListener("Marionette:setStatusbarHeight", this.server);
|
||||
messageManager.removeWeakMessageListener("Marionette:getStatusbarHeight", this.server);
|
||||
messageManager.removeWeakMessageListener("Marionette:runEmulatorCmd", this.server);
|
||||
messageManager.removeWeakMessageListener("Marionette:runEmulatorShell", this.server);
|
||||
messageManager.removeWeakMessageListener("Marionette:switchToFrame", this.server);
|
||||
|
@ -72,6 +72,7 @@ let touchIds = {};
|
||||
let multiLast = {};
|
||||
let lastCoordinates = null;
|
||||
let isTap = false;
|
||||
let scrolling = false;
|
||||
// whether to send mouse event
|
||||
let mouseEventsOnly = false;
|
||||
|
||||
@ -104,10 +105,6 @@ function registerSelf() {
|
||||
// check if we're the main process
|
||||
if (register[0][1] == true) {
|
||||
addMessageListener("MarionetteMainListener:emitTouchEvent", emitTouchEventForIFrame);
|
||||
let height = getStatusbarHeight();
|
||||
if (height) {
|
||||
sendSyncMessage("Marionette:setStatusbarHeight", { height: height });
|
||||
}
|
||||
}
|
||||
importedScripts = FileUtils.getDir('TmpD', [], false);
|
||||
importedScripts.append('marionetteContentScripts');
|
||||
@ -128,14 +125,6 @@ function emitTouchEventForIFrame(message) {
|
||||
1, 0);
|
||||
}
|
||||
|
||||
function getStatusbarHeight(message) {
|
||||
let statusbar = curFrame.document.getElementById("statusbar");
|
||||
if (statusbar) {
|
||||
//Yes, clientHeight. This statusbar affects screens where it isn't even visible, like FTU
|
||||
return statusbar.clientHeight;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message listener that's tied to our listenerId.
|
||||
*/
|
||||
@ -690,31 +679,24 @@ function executeWithCallback(msg, useFinish) {
|
||||
/**
|
||||
* This function creates a touch event given a touch type and a touch
|
||||
*/
|
||||
function emitTouchEvent(type, target, x, y, touchId) {
|
||||
function emitTouchEvent(type, touch) {
|
||||
if (!wasInterrupted()) {
|
||||
let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport";
|
||||
dumpLog(loggingInfo);
|
||||
var docShell = curFrame.document.defaultView.
|
||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIDocShell);
|
||||
if (docShell.asyncPanZoomEnabled) {
|
||||
if (docShell.asyncPanZoomEnabled && scrolling) {
|
||||
// if we're in APZ and we're scrolling, we must use injectTouchEvent to dispatch our touchmove events
|
||||
// NOTE: This is an internal frame, below the statusbar. The coordinates we get here must be offset by
|
||||
// the coordinates of the statusbar
|
||||
let statusbarHeight = sendSyncMessage("Marionette:getStatusbarHeight");
|
||||
if (statusbarHeight) {
|
||||
y += parseInt(statusbarHeight, 10);
|
||||
}
|
||||
let touch = createATouch(target, x, y, touchId);
|
||||
let index = sendSyncMessage("MarionetteFrame:getCurrentFrameId");
|
||||
// only call emitTouchEventForIFrame if we're inside an iframe.
|
||||
if (index != null) {
|
||||
let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport";
|
||||
dumpLog(loggingInfo);
|
||||
sendSyncMessage("Marionette:emitTouchEvent", {index: index, type: type, id: touch.identifier,
|
||||
clientX: touch.clientX, clientY: touch.clientY,
|
||||
radiusX: touch.radiusX, radiusY: touch.radiusY,
|
||||
rotation: touch.rotationAngle, force: touch.force});
|
||||
return touch;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// we get here if we're not in asyncPacZoomEnabled land, or if we're the main process
|
||||
@ -725,12 +707,8 @@ function emitTouchEvent(type, target, x, y, touchId) {
|
||||
{log: elementManager.wrapValue(marionetteLogObj.getLogs())});
|
||||
marionetteLogObj.clearLogs();
|
||||
*/
|
||||
let touch = createATouch(target, x, y, touchId);
|
||||
let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport";
|
||||
dumpLog(loggingInfo);
|
||||
let domWindowUtils = curFrame.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
domWindowUtils.sendTouchEvent(type, [touch.identifier], [touch.clientX], [touch.clientY], [touch.radiusX], [touch.radiusY], [touch.rotationAngle], [touch.force], 1, 0);
|
||||
return touch;
|
||||
}
|
||||
}
|
||||
|
||||
@ -841,8 +819,9 @@ function generateEvents(type, x, y, touchId, target) {
|
||||
}
|
||||
else {
|
||||
let touchId = nextTouchId++;
|
||||
emitTouchEvent('touchstart', target, x, y, touchId);
|
||||
emitTouchEvent('touchend', target, x, y, touchId);
|
||||
let touch = createATouch(target, x, y, touchId);
|
||||
emitTouchEvent('touchstart', touch);
|
||||
emitTouchEvent('touchend', touch);
|
||||
mousetap(target.ownerDocument, x, y);
|
||||
}
|
||||
lastCoordinates = null;
|
||||
@ -855,7 +834,9 @@ function generateEvents(type, x, y, touchId, target) {
|
||||
}
|
||||
else {
|
||||
let touchId = nextTouchId++;
|
||||
touchIds[touchId] = emitTouchEvent('touchstart', target, x, y, touchId);
|
||||
let touch = createATouch(target, x, y, touchId);
|
||||
emitTouchEvent('touchstart', touch);
|
||||
touchIds[touchId] = touch;
|
||||
return touchId;
|
||||
}
|
||||
break;
|
||||
@ -865,7 +846,8 @@ function generateEvents(type, x, y, touchId, target) {
|
||||
}
|
||||
else {
|
||||
let touch = touchIds[touchId];
|
||||
emitTouchEvent('touchend', touch.target, lastCoordinates[0], lastCoordinates[1], touchId);
|
||||
touch = createATouch(touch.target, lastCoordinates[0], lastCoordinates[1], touchId);
|
||||
emitTouchEvent('touchend', touch);
|
||||
if (isTap) {
|
||||
mousetap(touch.target.ownerDocument, touch.clientX, touch.clientY);
|
||||
}
|
||||
@ -880,8 +862,7 @@ function generateEvents(type, x, y, touchId, target) {
|
||||
emitMouseEvent(doc, 'mouseup', lastCoordinates[0], lastCoordinates[1]);
|
||||
}
|
||||
else {
|
||||
let touch = touchIds[touchId];
|
||||
emitTouchEvent('touchcancel', touch.target, x, y, touchId);
|
||||
emitTouchEvent('touchcancel', touchIds[touchId]);
|
||||
delete touchIds[touchId];
|
||||
}
|
||||
lastCoordinates = null;
|
||||
@ -892,7 +873,9 @@ function generateEvents(type, x, y, touchId, target) {
|
||||
emitMouseEvent(doc, 'mousemove', x, y);
|
||||
}
|
||||
else {
|
||||
touchIds[touchId] = emitTouchEvent('touchmove', touchIds[touchId].target, x, y, touchId);
|
||||
touch = createATouch(touchIds[touchId].target, x, y, touchId);
|
||||
touchIds[touchId] = touch;
|
||||
emitTouchEvent('touchmove', touch);
|
||||
}
|
||||
break;
|
||||
case 'contextmenu':
|
||||
@ -998,6 +981,9 @@ function actions(chain, touchId, command_id, i) {
|
||||
return;
|
||||
}
|
||||
// look ahead to check if we're scrolling. Needed for APZ touch dispatching.
|
||||
if ((i != chain.length) && (chain[i][0].indexOf('move') !== -1)) {
|
||||
scrolling = true;
|
||||
}
|
||||
el = elementManager.getKnownElement(pack[1], curFrame);
|
||||
c = coordinates(el, pack[2], pack[3]);
|
||||
touchId = generateEvents('press', c.x, c.y, null, el);
|
||||
@ -1006,6 +992,7 @@ function actions(chain, touchId, command_id, i) {
|
||||
case 'release':
|
||||
generateEvents('release', lastCoordinates[0], lastCoordinates[1], touchId);
|
||||
actions(chain, null, command_id, i);
|
||||
scrolling = false;
|
||||
break;
|
||||
case 'move':
|
||||
el = elementManager.getKnownElement(pack[1], curFrame);
|
||||
@ -1039,6 +1026,7 @@ function actions(chain, touchId, command_id, i) {
|
||||
case 'cancel':
|
||||
generateEvents('cancel', lastCoordinates[0], lastCoordinates[1], touchId);
|
||||
actions(chain, touchId, command_id, i);
|
||||
scrolling = false;
|
||||
break;
|
||||
case 'longPress':
|
||||
generateEvents('contextmenu', lastCoordinates[0], lastCoordinates[1], touchId);
|
||||
|
@ -138,7 +138,6 @@ function MarionetteServerConnection(aPrefix, aTransport, aServer)
|
||||
this.currentFrameElement = null;
|
||||
this.testName = null;
|
||||
this.mozBrowserClose = null;
|
||||
this.statusbarHeight = null;
|
||||
}
|
||||
|
||||
MarionetteServerConnection.prototype = {
|
||||
@ -425,12 +424,7 @@ MarionetteServerConnection.prototype = {
|
||||
whenBrowserStarted: function MDA_whenBrowserStarted(win, newSession) {
|
||||
try {
|
||||
if (!Services.prefs.getBoolPref("marionette.contentListener") || !newSession) {
|
||||
try {
|
||||
this.curBrowser.loadFrameScript(FRAME_SCRIPT, win);
|
||||
} catch (e) {
|
||||
logger.info("failed loading frame script due to" + e.toString());
|
||||
throw e;
|
||||
}
|
||||
this.curBrowser.loadFrameScript(FRAME_SCRIPT, win);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
@ -2442,12 +2436,6 @@ MarionetteServerConnection.prototype = {
|
||||
globalMessageManager.broadcastAsyncMessage(
|
||||
"MarionetteMainListener:emitTouchEvent", message.json);
|
||||
return;
|
||||
case "Marionette:setStatusbarHeight":
|
||||
//NOTE: If we had content<->content communication, this wouldn't be needed
|
||||
this.statusbarHeight = message.json.height;
|
||||
return;
|
||||
case "Marionette:getStatusbarHeight":
|
||||
return [this.statusbarHeight];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user