mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 07:45:30 +00:00
Bug 1060888 - Autocomplete drop down list item should not be copied to the search fields when mouse over the list item. r=MattN
This commit is contained in:
parent
405a49873c
commit
e8554ec8fc
@ -223,13 +223,6 @@ SearchSuggestionUIController.prototype = {
|
||||
this._hideSuggestions();
|
||||
},
|
||||
|
||||
_onMousemove: function (event) {
|
||||
// It's important to listen for mousemove, not mouseover or mouseenter. The
|
||||
// latter two are triggered when the user is typing and the mouse happens to
|
||||
// be over the suggestions popup.
|
||||
this.selectedIndex = this._indexOfTableRowOrDescendent(event.target);
|
||||
},
|
||||
|
||||
_onMousedown: function (event) {
|
||||
let idx = this._indexOfTableRowOrDescendent(event.target);
|
||||
let suggestion = this.suggestionAtIndex(idx);
|
||||
@ -307,7 +300,6 @@ SearchSuggestionUIController.prototype = {
|
||||
row.classList.add("searchSuggestionRow");
|
||||
row.classList.add(type);
|
||||
row.setAttribute("role", "presentation");
|
||||
row.addEventListener("mousemove", this);
|
||||
row.addEventListener("mousedown", this);
|
||||
|
||||
let entry = document.createElementNS(HTML_NS, "td");
|
||||
|
@ -102,14 +102,6 @@ add_task(function* mouse() {
|
||||
let state = yield msg("key", { key: "x", waitForSuggestions: true });
|
||||
checkState(state, "x", ["xfoo", "xbar"], -1);
|
||||
|
||||
// Mouse over the first suggestion.
|
||||
state = yield msg("mousemove", 0);
|
||||
checkState(state, "xfoo", ["xfoo", "xbar"], 0);
|
||||
|
||||
// Mouse over the second suggestion.
|
||||
state = yield msg("mousemove", 1);
|
||||
checkState(state, "xbar", ["xfoo", "xbar"], 1);
|
||||
|
||||
// Click the second suggestion. This should make it sticky. To make sure it
|
||||
// sticks, trigger suggestions again and cycle through them by pressing Down
|
||||
// until nothing is selected again.
|
||||
|
@ -37,33 +37,6 @@ let messageHandlers = {
|
||||
ack();
|
||||
},
|
||||
|
||||
mousemove: function (suggestionIdx) {
|
||||
// Copied from widget/tests/test_panel_mouse_coords.xul and
|
||||
// browser/base/content/test/newtab/head.js
|
||||
let row = gController._table.children[suggestionIdx];
|
||||
let rect = row.getBoundingClientRect();
|
||||
let left = content.mozInnerScreenX + rect.left;
|
||||
let x = left + rect.width / 2;
|
||||
let y = content.mozInnerScreenY + rect.top + rect.height / 2;
|
||||
|
||||
let utils = content.SpecialPowers.getDOMWindowUtils(content);
|
||||
let scale = utils.screenPixelsPerCSSPixel;
|
||||
|
||||
let widgetToolkit = content.SpecialPowers.
|
||||
Cc["@mozilla.org/xre/app-info;1"].
|
||||
getService(content.SpecialPowers.Ci.nsIXULRuntime).
|
||||
widgetToolkit;
|
||||
let nativeMsg = widgetToolkit == "cocoa" ? 5 : // NSMouseMoved
|
||||
widgetToolkit == "windows" ? 1 : // MOUSEEVENTF_MOVE
|
||||
3; // GDK_MOTION_NOTIFY
|
||||
|
||||
row.addEventListener("mousemove", function onMove() {
|
||||
row.removeEventListener("mousemove", onMove);
|
||||
ack();
|
||||
});
|
||||
utils.sendNativeMouseEvent(x * scale, y * scale, nativeMsg, 0, null);
|
||||
},
|
||||
|
||||
mousedown: function (suggestionIdx) {
|
||||
gController.onClick = () => {
|
||||
gController.onClick = null;
|
||||
|
Loading…
Reference in New Issue
Block a user