зеркало из https://github.com/mozilla/gecko-dev.git
Bug 766556 - Cancel text selection on device rotation. r=mfinkle
This commit is contained in:
Родитель
4887dfc4b3
Коммит
89f9ccd699
|
@ -1428,17 +1428,31 @@ var SelectionHandler = {
|
||||||
|
|
||||||
init: function sh_init() {
|
init: function sh_init() {
|
||||||
Services.obs.addObserver(this, "Gesture:SingleTap", false);
|
Services.obs.addObserver(this, "Gesture:SingleTap", false);
|
||||||
|
Services.obs.addObserver(this, "Window:Resize", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function sh_uninit() {
|
uninit: function sh_uninit() {
|
||||||
Services.obs.removeObserver(this, "Gesture:SingleTap", false);
|
Services.obs.removeObserver(this, "Gesture:SingleTap", false);
|
||||||
|
Services.obs.removeObserver(this, "Window:Resize", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function sh_observe(aSubject, aTopic, aData) {
|
observe: function sh_observe(aSubject, aTopic, aData) {
|
||||||
let data = JSON.parse(aData);
|
switch (aTopic) {
|
||||||
|
case "Gesture:SingleTap": {
|
||||||
|
if (!this._active)
|
||||||
|
return;
|
||||||
|
|
||||||
if (this._active)
|
let data = JSON.parse(aData);
|
||||||
this.endSelection(data.x, data.y);
|
this.endSelection(data.x, data.y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "Window:Resize": {
|
||||||
|
// Knowing when the page is done drawing is hard, so let's just cancel
|
||||||
|
// the selection when the window changes. We should fix this later.
|
||||||
|
this.endSelection();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
notifySelectionChanged: function sh_notifySelectionChanged(aDoc, aSel, aReason) {
|
notifySelectionChanged: function sh_notifySelectionChanged(aDoc, aSel, aReason) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче