mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 991111 - Middle clicks on tiles are not counted [r=adw]
Move the click listener to the xul window to correctly get the click event to filter for site-related clicks. --HG-- extra : rebase_source : 3fd8b2c658a695fbc9aa79d09f461acaeef2078f
This commit is contained in:
parent
4bffb6f53a
commit
ac847ef39e
@ -169,7 +169,10 @@ Site.prototype = {
|
||||
this._node.addEventListener("dragstart", this, false);
|
||||
this._node.addEventListener("dragend", this, false);
|
||||
this._node.addEventListener("mouseover", this, false);
|
||||
this._node.addEventListener("click", this, false);
|
||||
|
||||
// XXX bug 991111 - Not all click events are correctly triggered when
|
||||
// listening from the xhtml node, so listen from the xul window and filter
|
||||
addEventListener("click", this, false);
|
||||
|
||||
// Specially treat the sponsored icon to prevent regular hover effects
|
||||
let sponsored = this._querySelector(".newtab-control-sponsored");
|
||||
@ -240,7 +243,11 @@ Site.prototype = {
|
||||
handleEvent: function Site_handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "click":
|
||||
this._onClick(aEvent);
|
||||
// Check the bitmask if the click event is for the site's descendants
|
||||
if (this._node.compareDocumentPosition(aEvent.target) &
|
||||
this._node.DOCUMENT_POSITION_CONTAINED_BY) {
|
||||
this._onClick(aEvent);
|
||||
}
|
||||
break;
|
||||
case "mouseover":
|
||||
this._node.removeEventListener("mouseover", this, false);
|
||||
|
@ -15,6 +15,7 @@ skip-if = os == "mac" # Intermittent failures, bug 898317
|
||||
[browser_newtab_bug752841.js]
|
||||
[browser_newtab_bug765628.js]
|
||||
[browser_newtab_bug876313.js]
|
||||
[browser_newtab_bug991111.js]
|
||||
[browser_newtab_disable.js]
|
||||
[browser_newtab_drag_drop.js]
|
||||
[browser_newtab_drag_drop_ext.js]
|
||||
|
19
browser/base/content/test/newtab/browser_newtab_bug991111.js
Normal file
19
browser/base/content/test/newtab/browser_newtab_bug991111.js
Normal file
@ -0,0 +1,19 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function runTests() {
|
||||
yield setLinks("0");
|
||||
yield addNewTabPageTab();
|
||||
|
||||
// Remember if the click handler was triggered
|
||||
let cell = getCell(0);
|
||||
let clicked = false;
|
||||
cell.site._onClick = e => {
|
||||
clicked = true;
|
||||
executeSoon(TestRunner.next);
|
||||
};
|
||||
|
||||
// Send a middle-click and make sure it happened
|
||||
yield EventUtils.synthesizeMouseAtCenter(cell.node, {button: 1}, getContentWindow());
|
||||
ok(clicked, "middle click triggered click listener");
|
||||
}
|
Loading…
Reference in New Issue
Block a user