Backed out changeset 0f1efa209f53 (bug 863702) for B2G mochitest-2 failures.

This commit is contained in:
Ryan VanderMeulen 2013-10-11 14:41:22 -04:00
parent 5baa726d44
commit df03b6f3e3

View File

@ -24,16 +24,10 @@ const ContentPanning = {
hybridEvents: false,
init: function cp_init() {
let els = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
var events;
try {
content.document.createEvent('TouchEvent');
events = ['touchstart', 'touchend', 'touchmove'];
els.addSystemEventListener(global, 'mousedown',
this.handleEvent.bind(this),
/* useCapture = */ true);
this.watchedEventsType = 'touch';
#ifdef MOZ_WIDGET_GONK
// The gonk widget backend does not deliver mouse events per
@ -55,6 +49,9 @@ const ContentPanning = {
// it will handle subframe scrolling too. We don't need to listen for
// these events.
if (!this._asyncPanZoomForViewportFrame) {
let els = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
events.forEach(function(type) {
// Using the system group for mouse/touch events to avoid
// missing events if .stopPropagation() has been called.
@ -83,24 +80,6 @@ const ContentPanning = {
switch (evt.type) {
case 'mousedown':
// Touch events will generate a quick sequence of mouse events
// (mousemove, mousedown, mouseup) right after touchend. But
// the :active pseudo state is set during mousedown and is
// cleared during mouseup. The above code will delay the
// mouseup for a small amount of ms.
if (this.watchedEventsType == 'touch' && !this.hybridEvents) {
this._setActive(evt.target);
var start = Date.now();
var thread = Services.tm.currentThread;
while ((Date.now() - start) < 100) {
thread.processNextEvent(true);
}
// Don't consider this mousedown as the beginning of a
// panning sequence and just bail out.
return;
}
case 'touchstart':
this.onTouchStart(evt);
break;