Backout bug 888329 for causing permanent metro-chrome mochitest failures in bug 889694

This commit is contained in:
Wes Kocher 2013-07-02 18:33:57 -07:00
Родитель 92f5085fc7
Коммит 1b5b103f80
3 изменённых файлов: 31 добавлений и 31 удалений

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

@ -73,7 +73,9 @@ var Browser = {
BrowserTouchHandler.init();
PopupBlockerObserver.init();
// Init the touch scrollbox
// Warning, total hack ahead. All of the real-browser related scrolling code
// lies in a pretend scrollbox here. Let's not land this as-is. Maybe it's time
// to redo all the dragging code.
this.contentScrollbox = Elements.browsers;
this.contentScrollboxScroller = {
scrollBy: function(aDx, aDy) {
@ -145,6 +147,10 @@ var Browser = {
messageManager.addMessageListener("Browser:TapOnSelection", this);
messageManager.addMessageListener("Browser:PluginClickToPlayClicked", this);
// Let everyone know what kind of mouse input we are
// starting with:
InputSourceHelper.fireUpdate();
Task.spawn(function() {
// Activation URIs come from protocol activations, secondary tiles, and file activations
let activationURI = yield this.getShortcutOrURI(MetroUtils.activationURI);
@ -193,9 +199,6 @@ var Browser = {
loadStartupURI();
}
// Notify about our input type
InputSourceHelper.fireUpdate();
// Broadcast a UIReady message so add-ons know we are finished with startup
let event = document.createEvent("Events");
event.initEvent("UIReady", true, false);

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

@ -52,7 +52,7 @@
<broadcasterset id="broadcasterset">
<broadcaster id="bcast_contentShowing" disabled="false"/>
<broadcaster id="bcast_urlbarState" mode="view"/>
<broadcaster id="bcast_preciseInput" input="precise"/>
<broadcaster id="bcast_preciseInput" input="imprecise"/>
<broadcaster id="bcast_windowState" viewstate=""/>
</broadcasterset>

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

@ -1157,52 +1157,49 @@ var GestureModule = {
*/
var InputSourceHelper = {
isPrecise: false,
treatMouseAsTouch: false,
init: function ish_init() {
// debug feature, make all input imprecise
window.addEventListener("mousemove", this, true);
window.addEventListener("mousedown", this, true);
window.addEventListener("touchstart", this, true);
},
_precise: function () {
if (!this.isPrecise) {
this.isPrecise = true;
this._fire("MozPrecisePointer");
try {
this.treatMouseAsTouch = Services.prefs.getBoolPref(kDebugMouseInputPref);
} catch (e) {}
if (!this.treatMouseAsTouch) {
window.addEventListener("mousemove", this, true);
window.addEventListener("mousedown", this, true);
}
},
_imprecise: function () {
if (this.isPrecise) {
this.isPrecise = false;
this._fire("MozImprecisePointer");
}
},
handleEvent: function ish_handleEvent(aEvent) {
if (aEvent.type == "touchstart") {
this._imprecise();
return;
}
switch (aEvent.mozInputSource) {
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE:
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_PEN:
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_ERASER:
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_CURSOR:
this._precise();
if (!this.isPrecise && !this.treatMouseAsTouch) {
this.isPrecise = true;
this._fire("MozPrecisePointer");
}
break;
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH:
this._imprecise();
if (this.isPrecise) {
this.isPrecise = false;
this._fire("MozImprecisePointer");
}
break;
}
},
fireUpdate: function fireUpdate() {
if (this.isPrecise) {
this._fire("MozPrecisePointer");
} else {
if (this.treatMouseAsTouch) {
this._fire("MozImprecisePointer");
} else {
if (this.isPrecise) {
this._fire("MozPrecisePointer");
} else {
this._fire("MozImprecisePointer");
}
}
},