Bug 619412 - PanFinished is not fired on the same element as PanBegin [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2010-12-16 07:45:40 +01:00
Родитель b77cb68cef
Коммит 27af3051db
3 изменённых файлов: 8 добавлений и 6 удалений

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

@ -446,7 +446,8 @@ var BrowserUI = {
tabs.addEventListener("TabSelect", this, true); tabs.addEventListener("TabSelect", this, true);
tabs.addEventListener("TabOpen", this, true); tabs.addEventListener("TabOpen", this, true);
tabs.addEventListener("TabOpen", NewTabPopup, true); tabs.addEventListener("TabOpen", NewTabPopup, true);
window.addEventListener("PanFinished", this, true);
Elements.browsers.addEventListener("PanFinished", this, true);
// listen content messages // listen content messages
messageManager.addMessageListener("DOMLinkAdded", this); messageManager.addMessageListener("DOMLinkAdded", this);

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

@ -1150,7 +1150,7 @@ Browser.MainDragger = function MainDragger() {
this._scrollScales = { x: 0, y: 0 }; this._scrollScales = { x: 0, y: 0 };
Elements.browsers.addEventListener("PanBegin", this, false); Elements.browsers.addEventListener("PanBegin", this, false);
window.addEventListener("PanFinished", this, false); Elements.browsers.addEventListener("PanFinished", this, false);
Elements.contentNavigator.addEventListener("SizeChanged", this, false); Elements.contentNavigator.addEventListener("SizeChanged", this, false);
}; };

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

@ -94,6 +94,7 @@ function MouseModule() {
this._inputField = null; this._inputField = null;
this._downUpEvents = []; this._downUpEvents = [];
this._targetScrollbox = null;
this._targetScrollInterface = null; this._targetScrollInterface = null;
this._suppressNextMouseUp = false; this._suppressNextMouseUp = false;
@ -169,6 +170,7 @@ MouseModule.prototype = {
// made kinetic panning active. // made kinetic panning active.
this._kinetic.end(); this._kinetic.end();
this._targetScrollbox = null;
this._targetScrollInterface = null; this._targetScrollInterface = null;
this._cleanClickBuffer(); this._cleanClickBuffer();
@ -193,6 +195,7 @@ MouseModule.prototype = {
if (this._kinetic.isActive() && this._dragger != dragger) if (this._kinetic.isActive() && this._dragger != dragger)
this._kinetic.end(); this._kinetic.end();
this._targetScrollbox = targetScrollbox;
this._targetScrollInterface = targetScrollInterface; this._targetScrollInterface = targetScrollInterface;
// Do tap // Do tap
@ -304,7 +307,7 @@ MouseModule.prototype = {
let event = document.createEvent("Events"); let event = document.createEvent("Events");
event.initEvent("PanBegin", true, false); event.initEvent("PanBegin", true, false);
aEvent.target.dispatchEvent(event); this._targetScrollbox.dispatchEvent(event);
} }
} }
} }
@ -392,11 +395,9 @@ MouseModule.prototype = {
this._dragger.dragStop(0, 0, this._targetScrollInterface); this._dragger.dragStop(0, 0, this._targetScrollInterface);
this._dragger = null; this._dragger = null;
// bug 619412
// XXX why is PanFinished not dispatched on the same target as PanBegin
let event = document.createEvent("Events"); let event = document.createEvent("Events");
event.initEvent("PanFinished", true, false); event.initEvent("PanFinished", true, false);
document.dispatchEvent(event); this._targetScrollbox.dispatchEvent(event);
} }
}, },