Bug 1195965 - Remove #ifdefs from browser/components/tabview JS files. r=Gijs

This commit is contained in:
Sebastian Hengst 2015-08-22 08:21:57 +02:00
Родитель 72963b0294
Коммит 60f3abac93
3 изменённых файлов: 40 добавлений и 48 удалений

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

@ -530,9 +530,8 @@ let Search = {
iQ("#searchbutton").css({ opacity:.8 });
#ifdef XP_MACOSX
if (AppConstants.platform == "macosx")
UI.setTitlebarColors(true);
#endif
this.perform();
this.switchToBeforeMode();
@ -594,9 +593,8 @@ let Search = {
$searchShade.show();
$search.show();
#ifdef XP_MACOSX
if (AppConstants.platform == "macosx")
UI.setTitlebarColors({active: "#717171", inactive: "#EDEDED"});
#endif
if (activatedByKeypress) {
// set the focus so key strokes are entered into the textbox.

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

@ -10,6 +10,7 @@ const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource:///modules/tabview/utils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

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

@ -470,9 +470,8 @@ let UI = {
gTabViewFrame.contentWindow.focus();
gBrowser.updateTitlebar();
#ifdef XP_MACOSX
if (AppConstants.platform == "macosx")
this.setTitlebarColors(true);
#endif
let event = document.createEvent("Events");
event.initEvent("tabviewshown", true, false);
@ -545,9 +544,8 @@ let UI = {
gBrowser.updateTitlebar();
gBrowser.tabContainer.mTabstrip.smoothScroll = this._originalSmoothScroll;
#ifdef XP_MACOSX
if (AppConstants.platform == "macosx")
this.setTitlebarColors(false);
#endif
Storage.saveVisibilityData(gWindow, "false");
this._isChangingVisibility = false;
@ -557,7 +555,6 @@ let UI = {
dispatchEvent(event);
},
#ifdef XP_MACOSX
// ----------
// Function: setTitlebarColors
// Used on the Mac to make the title bar match the gradient in the rest of the
@ -569,7 +566,8 @@ let UI = {
// properties to specify directly.
setTitlebarColors: function UI_setTitlebarColors(colors) {
// Mac Only
var mainWindow = gWindow.document.getElementById("main-window");
if (AppConstants.platform == "macosx") {
let mainWindow = gWindow.document.getElementById("main-window");
if (colors === true) {
mainWindow.setAttribute("activetitlebarcolor", "#C4C4C4");
mainWindow.setAttribute("inactivetitlebarcolor", "#EDEDED");
@ -580,8 +578,8 @@ let UI = {
mainWindow.removeAttribute("activetitlebarcolor");
mainWindow.removeAttribute("inactivetitlebarcolor");
}
}
},
#endif
// ----------
// Function: storageBusy
@ -932,18 +930,17 @@ let UI = {
_setupBrowserKeys: function UI__setupKeyWhiteList() {
let keys = {};
[
#ifdef XP_UNIX
"quitApplication",
#else
"redo",
#endif
#ifdef XP_MACOSX
"preferencesCmdMac", "minimizeWindow", "hideThisAppCmdMac",
#endif
let keyArray = [
"newNavigator", "newNavigatorTab", "undo", "cut", "copy", "paste",
"selectAll", "find"
].forEach(function(key) {
];
if (AppConstants.platform == "macosx")
keyArray.push("preferencesCmdMac", "minimizeWindow", "hideThisAppCmdMac")
if (AppConstants.platform == "macosx" || AppConstants.platform == "linux")
keyArray.push("quitApplication");
else
keyArray.push("redo");
keyArray.forEach(function(key) {
let element = gWindow.document.getElementById("key_" + key);
let code = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);
keys[code] = key;
@ -954,15 +951,14 @@ let UI = {
// The lower case letters are passed to processBrowserKeys() even with shift
// key when stimulating a key press using EventUtils.synthesizeKey() so need
// to handle both upper and lower cases here.
[
#ifdef XP_UNIX
"redo",
#endif
#ifdef XP_MACOSX
"fullScreen",
#endif
keyArray = [
"closeWindow", "tabview", "undoCloseTab", "undoCloseWindow"
].forEach(function(key) {
];
if (AppConstants.platform == "macosx" || AppConstants.platform == "linux")
keyArray.push("redo");
if (AppConstants.platform == "macosx")
keyArray.push("fullScreen");
keyArray.forEach(function(key) {
let element = gWindow.document.getElementById("key_" + key);
let code = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);
keys[code] = key;
@ -992,11 +988,8 @@ let UI = {
if (evt.altKey)
return;
#ifdef XP_MACOSX
if (evt.metaKey) {
#else
if (evt.ctrlKey) {
#endif
if ((AppConstants.platform == "macosx" && evt.metaKey) ||
(AppConstants.platform != "macosx" && evt.ctrlKey)) {
let preventDefault = true;
if (evt.shiftKey) {
// when a user presses ctrl+shift+key, upper case letter charCode