Bug 976605 - Disable active element handling in BEP.js if APZ is enabled. r=kats,vingtetun

--HG--
extra : source : 62f6bbf910b470d8e423811dd036fe13b2c8c47b
This commit is contained in:
Botond Ballo 2014-04-09 13:39:36 -04:00
Родитель a4fbe2f20e
Коммит ab3150cc0f
1 изменённых файлов: 28 добавлений и 24 удалений

Просмотреть файл

@ -29,6 +29,27 @@ const ContentPanning = {
hybridEvents: false,
init: function cp_init() {
// If APZ is enabled, we do active element handling in C++
// (see widget/xpwidgets/ActiveElementManager.h), and panning
// itself in APZ, so we don't need to handle any touch events here.
if (docShell.asyncPanZoomEnabled === false) {
this._setupListenersForPanning();
}
addEventListener("unload",
this._unloadHandler.bind(this),
/* useCapture = */ false,
/* wantsUntrusted = */ false);
addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
addEventListener("visibilitychange", this._handleVisibilityChange.bind(this));
kObservedEvents.forEach((topic) => {
Services.obs.addObserver(this, topic, false);
});
},
_setupListenersForPanning: function cp_setupListenersForPanning() {
var events;
try {
content.document.createEvent('TouchEvent');
@ -60,18 +81,6 @@ const ContentPanning = {
this.handleEvent.bind(this),
/* useCapture = */ false);
}.bind(this));
addEventListener("unload",
this._unloadHandler.bind(this),
/* useCapture = */ false,
/* wantsUntrusted = */ false);
addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
addEventListener("visibilitychange", this._handleVisibilityChange.bind(this));
kObservedEvents.forEach((topic) => {
Services.obs.addObserver(this, topic, false);
});
},
handleEvent: function cp_handleEvent(evt) {
@ -195,8 +204,7 @@ const ContentPanning = {
// We prevent start events to avoid sending a focus event at the end of this
// touch series. See bug 889717.
if (docShell.asyncPanZoomEnabled === false &&
(this.panning || this.preventNextClick)) {
if ((this.panning || this.preventNextClick)) {
evt.preventDefault();
}
},
@ -235,7 +243,7 @@ const ContentPanning = {
let view = target.ownerDocument ? target.ownerDocument.defaultView
: target;
view.addEventListener('click', this, true, true);
} else if (docShell.asyncPanZoomEnabled === false) {
} else {
// We prevent end events to avoid sending a focus event. See bug 889717.
evt.preventDefault();
}
@ -284,18 +292,15 @@ const ContentPanning = {
return;
}
// If the application is not managed by the AsyncPanZoomController, then
// scroll manually.
if (docShell.asyncPanZoomEnabled === false) {
this.scrollCallback(delta.scale(-1));
}
// Scroll manually.
this.scrollCallback(delta.scale(-1));
if (!this.panning && isPan) {
this.panning = true;
this._activationTimer.cancel();
}
if (this.panning && docShell.asyncPanZoomEnabled === false) {
if (this.panning) {
// Only do this when we're actually executing a pan gesture.
// Otherwise synthetic mouse events will be canceled.
evt.stopPropagation();
@ -592,9 +597,8 @@ const ContentPanning = {
delete this.primaryPointerId;
this._activationTimer.cancel();
// If there is a scroll action but the application is not managed by
// the AsyncPanZoom controller, let's do a manual kinetic panning action.
if (this.panning && docShell.asyncPanZoomEnabled === false) {
// If there is a scroll action, let's do a manual kinetic panning action.
if (this.panning) {
KineticPanning.start(this);
}
},