mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-16 15:17:14 +00:00
Bug 891882 - Enable touch event on B2G desktop r=vingtetun
This commit is contained in:
parent
f2a57fa3f9
commit
a94450b388
@ -287,14 +287,10 @@ pref("image.mem.min_discard_timeout_ms", 86400000); /* 24h, we rely on the out o
|
||||
pref("image.mem.max_decoded_image_kb", 30000); /* 30MB seems reasonable */
|
||||
pref("image.onload.decode.limit", 24); /* don't decode more than 24 images eagerly */
|
||||
|
||||
// XXX this isn't a good check for "are touch events supported", but
|
||||
// we don't really have a better one at the moment.
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// enable touch events interfaces
|
||||
pref("dom.w3c_touch_events.enabled", 1);
|
||||
pref("dom.w3c_touch_events.safetyX", 0); // escape borders in units of 1/240"
|
||||
pref("dom.w3c_touch_events.safetyY", 120); // escape borders in units of 1/240"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
// Safe browsing does nothing unless this pref is set
|
||||
|
@ -628,6 +628,27 @@ var shell = {
|
||||
|
||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {})
|
||||
.devtools.require;
|
||||
let { TouchEventHandler } = require("devtools/touch-events");
|
||||
let frame = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
|
||||
let scope = {
|
||||
addEventListener:
|
||||
function(type, fun, capture) {
|
||||
frame.addEventListener(type, fun, capture);
|
||||
},
|
||||
removeEventListener:
|
||||
function(type, fun) {
|
||||
frame.removeEventListener(type, fun);
|
||||
}
|
||||
};
|
||||
let touchEventHandler = new TouchEventHandler(scope);
|
||||
touchEventHandler.start();
|
||||
#endif
|
||||
|
||||
if ('pendingChromeEvents' in shell) {
|
||||
shell.pendingChromeEvents.forEach((shell.sendChromeEvent).bind(shell));
|
||||
}
|
||||
|
@ -159,6 +159,18 @@ function TouchEventHandler (window) {
|
||||
return timeout;
|
||||
},
|
||||
sendTouchEvent: function teh_sendTouchEvent(evt, target, name) {
|
||||
// When running OOP b2g desktop, we need to send the touch events
|
||||
// using the mozbrowser api on the unwrapped frame.
|
||||
if (target.localName == "iframe" && target.mozbrowser === true) {
|
||||
let unwraped = XPCNativeWrapper.unwrap(target);
|
||||
unwraped.sendTouchEvent(name, [0], // event type, id
|
||||
[evt.pageX], [evt.pageY], // x, y
|
||||
[1], [1], // rx, ry
|
||||
[0], [0], // rotation, force
|
||||
1); // count
|
||||
return;
|
||||
}
|
||||
|
||||
let document = target.ownerDocument;
|
||||
let content = this.getContent(target);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user