зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1106101 - Let people open searches in new tabs with ctrl/cmd+click or middle mouse button. ui-r=phlsa, r=florian
This commit is contained in:
Родитель
81a9946ddf
Коммит
596118b5c6
|
@ -939,12 +939,24 @@
|
|||
this.closePopup();
|
||||
controller.handleEscape();
|
||||
|
||||
// Fill in the search bar's value
|
||||
searchBar.value = search;
|
||||
|
||||
// open the search results according to the clicking subtlety
|
||||
var where = whereToOpenLink(aEvent, false, true);
|
||||
|
||||
// But open ctrl/cmd clicks on autocomplete items in a new background tab.
|
||||
if (where == "tab" && (aEvent instanceof MouseEvent) &&
|
||||
(aEvent.button == 1 ||
|
||||
#ifdef XP_MACOSX
|
||||
aEvent.metaKey))
|
||||
#else
|
||||
aEvent.ctrlKey))
|
||||
#endif
|
||||
where = "tab-background";
|
||||
|
||||
searchBar.doSearch(search, where);
|
||||
if (where == "tab-background")
|
||||
searchBar.focus();
|
||||
else
|
||||
searchBar.value = search;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
|
@ -472,6 +472,8 @@
|
|||
var textValue = textBox.value;
|
||||
|
||||
var where = "current";
|
||||
|
||||
// Open ctrl/cmd clicks on one-off buttons in a new background tab.
|
||||
if (aEvent && aEvent.originalTarget.getAttribute("anonid") == "search-go-button") {
|
||||
if (aEvent.button == 2)
|
||||
return;
|
||||
|
@ -479,11 +481,20 @@
|
|||
}
|
||||
else {
|
||||
var newTabPref = textBox._prefBranch.getBoolPref("browser.search.openintab");
|
||||
if ((aEvent && aEvent.altKey) ^ newTabPref)
|
||||
if (((aEvent instanceof KeyboardEvent) && aEvent.altKey) ^ newTabPref)
|
||||
where = "tab";
|
||||
if ((aEvent instanceof MouseEvent) && (aEvent.button == 1 ||
|
||||
#ifdef XP_MACOSX
|
||||
aEvent.metaKey))
|
||||
#else
|
||||
aEvent.ctrlKey))
|
||||
#endif
|
||||
where = "tab-background";
|
||||
}
|
||||
|
||||
this.doSearch(textValue, where, aEngine);
|
||||
if (where == "tab-background")
|
||||
this.focus();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -509,7 +520,13 @@
|
|||
var submission = engine.getSubmission(aData, null, "searchbar");
|
||||
BrowserSearch.recordSearchInHealthReport(engine, "searchbar");
|
||||
// null parameter below specifies HTML response for search
|
||||
openUILinkIn(submission.uri.spec, aWhere, null, submission.postData);
|
||||
let params = {
|
||||
postData: submission.postData,
|
||||
inBackground: aWhere == "tab-background"
|
||||
};
|
||||
openUILinkIn(submission.uri.spec,
|
||||
aWhere == "tab-background" ? "tab" : aWhere,
|
||||
params);
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
|
Загрузка…
Ссылка в новой задаче