mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 888329 - Fix: Mouse scrollbars remain visible on the first tab. r=sfoster
This commit is contained in:
parent
1705e469f4
commit
ae80dadc12
@ -73,9 +73,7 @@ var Browser = {
|
||||
BrowserTouchHandler.init();
|
||||
PopupBlockerObserver.init();
|
||||
|
||||
// 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.
|
||||
// Init the touch scrollbox
|
||||
this.contentScrollbox = Elements.browsers;
|
||||
this.contentScrollboxScroller = {
|
||||
scrollBy: function(aDx, aDy) {
|
||||
@ -147,10 +145,6 @@ 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);
|
||||
@ -199,6 +193,9 @@ 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="imprecise"/>
|
||||
<broadcaster id="bcast_preciseInput" input="precise"/>
|
||||
<broadcaster id="bcast_windowState" viewstate=""/>
|
||||
</broadcasterset>
|
||||
|
||||
|
@ -1157,49 +1157,52 @@ var GestureModule = {
|
||||
*/
|
||||
var InputSourceHelper = {
|
||||
isPrecise: false,
|
||||
treatMouseAsTouch: false,
|
||||
|
||||
init: function ish_init() {
|
||||
// debug feature, make all input imprecise
|
||||
try {
|
||||
this.treatMouseAsTouch = Services.prefs.getBoolPref(kDebugMouseInputPref);
|
||||
} catch (e) {}
|
||||
if (!this.treatMouseAsTouch) {
|
||||
window.addEventListener("mousemove", this, true);
|
||||
window.addEventListener("mousedown", this, true);
|
||||
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");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_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:
|
||||
if (!this.isPrecise && !this.treatMouseAsTouch) {
|
||||
this.isPrecise = true;
|
||||
this._fire("MozPrecisePointer");
|
||||
}
|
||||
this._precise();
|
||||
break;
|
||||
|
||||
case Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH:
|
||||
if (this.isPrecise) {
|
||||
this.isPrecise = false;
|
||||
this._fire("MozImprecisePointer");
|
||||
}
|
||||
this._imprecise();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
fireUpdate: function fireUpdate() {
|
||||
if (this.treatMouseAsTouch) {
|
||||
this._fire("MozImprecisePointer");
|
||||
if (this.isPrecise) {
|
||||
this._fire("MozPrecisePointer");
|
||||
} else {
|
||||
if (this.isPrecise) {
|
||||
this._fire("MozPrecisePointer");
|
||||
} else {
|
||||
this._fire("MozImprecisePointer");
|
||||
}
|
||||
this._fire("MozImprecisePointer");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -25,6 +25,8 @@ function setUpAndTearDown() {
|
||||
yield waitForCondition(function () {
|
||||
return !SelectionHelperUI.isSelectionUIVisible;
|
||||
}, kCommonWaitMs, kCommonPollMs);
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
@ -42,7 +44,6 @@ gTests.push({
|
||||
yield hideContextUI();
|
||||
|
||||
gWindow = Browser.selectedTab.browser.contentWindow;
|
||||
InputSourceHelper.isPrecise = false;
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -25,6 +25,8 @@ function setUpAndTearDown() {
|
||||
yield waitForCondition(function () {
|
||||
return !SelectionHelperUI.isSelectionUIVisible;
|
||||
}, kCommonWaitMs, kCommonPollMs);
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
@ -43,8 +45,6 @@ gTests.push({
|
||||
|
||||
gWindow = Browser.selectedTab.browser.contentWindow;
|
||||
gFrame = gWindow.document.getElementById("frame1");
|
||||
|
||||
InputSourceHelper.isPrecise = false;
|
||||
},
|
||||
});
|
||||
|
||||
@ -144,7 +144,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
ok(popupPromise && !(popupPromise instanceof Error), "promise error");
|
||||
|
||||
@ -185,7 +185,6 @@ gTests.push({
|
||||
gFrame.contentDocument.defaultView.scrollBy(0, 200);
|
||||
yield scrollPromise;
|
||||
|
||||
InputSourceHelper.isPrecise = false;
|
||||
sendContextMenuClick(114, 130);
|
||||
|
||||
yield waitForCondition(function () {
|
||||
|
@ -28,6 +28,8 @@ function setUpAndTearDown() {
|
||||
yield waitForCondition(function () {
|
||||
return !SelectionHelperUI.isSelectionUIVisible;
|
||||
}, kCommonWaitMs, kCommonPollMs);
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
@ -51,8 +53,6 @@ gTests.push({
|
||||
ok(gWindow != null, "gWindow");
|
||||
ok(gFrame != null, "gFrame");
|
||||
ok(gInput != null, "gInput");
|
||||
|
||||
InputSourceHelper.isPrecise = false;
|
||||
},
|
||||
});
|
||||
|
||||
@ -75,7 +75,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
@ -109,7 +109,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
|
@ -28,6 +28,8 @@ function setUpAndTearDown() {
|
||||
yield waitForCondition(function () {
|
||||
return !SelectionHelperUI.isSelectionUIVisible;
|
||||
}, kCommonWaitMs, kCommonPollMs);
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
@ -50,8 +52,6 @@ gTests.push({
|
||||
ok(gWindow != null, "gWindow");
|
||||
ok(gFrame != null, "gFrame");
|
||||
ok(gTextArea != null, "gTextArea");
|
||||
|
||||
InputSourceHelper.isPrecise = false;
|
||||
},
|
||||
});
|
||||
|
||||
@ -74,7 +74,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
@ -89,7 +89,7 @@ gTests.push({
|
||||
});
|
||||
|
||||
gTests.push({
|
||||
desc: "drag selection",
|
||||
desc: "drag selection 1",
|
||||
setUp: setUpAndTearDown,
|
||||
tearDown: setUpAndTearDown,
|
||||
run: function test() {
|
||||
@ -107,7 +107,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
@ -154,7 +154,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
let string = "";
|
||||
@ -166,7 +166,7 @@ gTests.push({
|
||||
});
|
||||
|
||||
gTests.push({
|
||||
desc: "drag selection",
|
||||
desc: "drag selection 2",
|
||||
setUp: setUpAndTearDown,
|
||||
tearDown: setUpAndTearDown,
|
||||
run: function test() {
|
||||
@ -188,7 +188,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
@ -235,7 +235,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
let string = "";
|
||||
|
@ -25,6 +25,8 @@ function setUpAndTearDown() {
|
||||
yield waitForCondition(function () {
|
||||
return !SelectionHelperUI.isSelectionUIVisible;
|
||||
}, kCommonWaitMs, kCommonPollMs);
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -49,7 +51,6 @@ gTests.push({
|
||||
|
||||
gWindow = Browser.selectedTab.browser.contentWindow;
|
||||
gInput = gWindow.document.getElementById("a");
|
||||
InputSourceHelper.isPrecise = false;
|
||||
},
|
||||
});
|
||||
|
||||
@ -72,7 +73,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
@ -101,7 +102,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
@ -147,7 +148,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
|
||||
yield waitForCondition(function () {
|
||||
|
@ -25,6 +25,8 @@ function setUpAndTearDown() {
|
||||
yield waitForCondition(function () {
|
||||
return !SelectionHelperUI.isSelectionUIVisible;
|
||||
}, kCommonWaitMs, kCommonPollMs);
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
@ -42,7 +44,6 @@ gTests.push({
|
||||
yield hideContextUI();
|
||||
|
||||
gWindow = Browser.selectedTab.browser.contentWindow;
|
||||
InputSourceHelper.isPrecise = false;
|
||||
},
|
||||
});
|
||||
|
||||
@ -65,7 +66,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
ok(popupPromise && !(popupPromise instanceof Error), "promise error");
|
||||
|
||||
@ -101,7 +102,7 @@ gTests.push({
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, gWindow);
|
||||
sendElementTap(gWindow, menuItem);
|
||||
yield popupPromise;
|
||||
ok(popupPromise && !(popupPromise instanceof Error), "promise error");
|
||||
|
||||
|
@ -19,9 +19,6 @@ const kCommonPollMs = 100;
|
||||
gTests.push({
|
||||
desc: "normalize browser",
|
||||
run: function test() {
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
|
||||
info(chromeRoot + "res/textblock01.html");
|
||||
yield addTab(chromeRoot + "res/textblock01.html");
|
||||
|
||||
@ -30,6 +27,9 @@ gTests.push({
|
||||
});
|
||||
|
||||
yield hideContextUI();
|
||||
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user