Bug 574702: avoid initializing WindowDraggingUtils multiple times due to binding re-attachment (causes dragging jumpiness issues), r=enndeakin

This commit is contained in:
Felipe Gomes 2010-06-25 16:06:36 -04:00
Родитель 013e10d651
Коммит e358a123e2
2 изменённых файлов: 25 добавлений и 16 удалений

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

@ -161,10 +161,13 @@
extends="chrome://global/content/bindings/general.xml#statusbar">
<implementation>
<constructor>
try {
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
new WindowDraggingElement(this, window);
} catch (e) {}
if (!this._draggableStarted) {
this._draggableStarted = true;
try {
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
new WindowDraggingElement(this, window);
} catch (e) {}
}
</constructor>
</implementation>
</binding>
@ -262,10 +265,13 @@
<binding id="windowdragbox">
<implementation>
<constructor>
try {
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
new WindowDraggingElement(this, window);
} catch (e) {}
if (!this._draggableStarted) {
this._draggableStarted = true;
try {
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
new WindowDraggingElement(this, window);
} catch (e) {}
}
</constructor>
</implementation>
</binding>

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

@ -441,14 +441,17 @@
extends="chrome://global/content/bindings/toolbar.xml#toolbar">
<implementation>
<constructor><![CDATA[
try {
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
let draggableThis = new WindowDraggingElement(this, window);
draggableThis.mouseDownCheck = function(e) {
// Don't move while customizing or while in full screen mode.
return !this.parentNode.customizing && !window.fullScreen;
}
} catch (e) {}
if (!this._draggableStarted) {
this._draggableStarted = true;
try {
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
let draggableThis = new WindowDraggingElement(this, window);
draggableThis.mouseDownCheck = function(e) {
// Don't move while customizing or while in full screen mode.
return !this.parentNode.customizing && !window.fullScreen;
}
} catch (e) {}
}
]]></constructor>
</implementation>
</binding>