зеркало из https://github.com/mozilla/gecko-dev.git
+ Addressing dolske's comments in bug 574217:
++ Using Cc and Ci ++ Using let ++ Changing getWindowTitle to a memoizing getter ++ Updated comment for key combo routine
This commit is contained in:
Родитель
c4287b61b0
Коммит
32d9332f05
|
@ -40,6 +40,15 @@ let TabView = {
|
|||
_sessionstore: null,
|
||||
_visibilityID: "tabview-visibility",
|
||||
|
||||
// ----------
|
||||
get windowTitle() {
|
||||
delete this.windowTitle;
|
||||
let brandBundle = document.getElementById("bundle_brand");
|
||||
let brandShortName = brandBundle.getString("brandShortName");
|
||||
let title = gNavigatorBundle.getFormattedString("tabView.title", [brandShortName]);
|
||||
return this.windowTitle = title;
|
||||
},
|
||||
|
||||
// ----------
|
||||
init: function TabView_init() {
|
||||
// ___ keys
|
||||
|
@ -47,8 +56,8 @@ let TabView = {
|
|||
|
||||
// ___ visibility
|
||||
this._sessionstore =
|
||||
Components.classes["@mozilla.org/browser/sessionstore;1"]
|
||||
.getService(Components.interfaces.nsISessionStore);
|
||||
Cc["@mozilla.org/browser/sessionstore;1"].
|
||||
getService(Ci.nsISessionStore);
|
||||
|
||||
let data = this._sessionstore.getWindowValue(window, this._visibilityID);
|
||||
if (data) {
|
||||
|
@ -70,7 +79,7 @@ let TabView = {
|
|||
this._deck = document.getElementById("tab-view-deck");
|
||||
|
||||
// ___ create the frame
|
||||
var iframe = document.createElement("iframe");
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.id = "tab-view";
|
||||
iframe.setAttribute("transparent", "true");
|
||||
iframe.flex = 1;
|
||||
|
@ -133,13 +142,6 @@ let TabView = {
|
|||
this.show();
|
||||
},
|
||||
|
||||
// ----------
|
||||
getWindowTitle: function() {
|
||||
let brandBundle = document.getElementById("bundle_brand");
|
||||
let brandShortName = brandBundle.getString("brandShortName");
|
||||
return gNavigatorBundle.getFormattedString("tabView.title", [brandShortName]);
|
||||
},
|
||||
|
||||
// ----------
|
||||
updateContextMenu: function(tab, popup) {
|
||||
let isEmpty = true;
|
||||
|
@ -183,16 +185,16 @@ let TabView = {
|
|||
},
|
||||
|
||||
// ----------
|
||||
// Overrides the browser's keys for navigating between tab (outside of the
|
||||
// TabView UI) so they do the right thing in respect to groupItems.
|
||||
// Adds new key commands to the browser, for invoking the Tab Candy UI
|
||||
// and for switching between groups of tabs when outside of the Tab Candy UI.
|
||||
_setBrowserKeyHandlers : function() {
|
||||
var self = this;
|
||||
let self = this;
|
||||
|
||||
window.addEventListener("keypress", function(event) {
|
||||
if (self.isVisible())
|
||||
return;
|
||||
|
||||
var charCode = event.charCode;
|
||||
let charCode = event.charCode;
|
||||
#ifdef XP_MACOSX
|
||||
// if a text box in a webpage has the focus, the event.altKey would
|
||||
// return false so we are depending on the charCode here.
|
||||
|
@ -215,7 +217,7 @@ let TabView = {
|
|||
event.preventDefault();
|
||||
|
||||
self._initFrame(function() {
|
||||
var tabItem = self._window.GroupItems.getNextGroupItemTab(event.shiftKey);
|
||||
let tabItem = self._window.GroupItems.getNextGroupItemTab(event.shiftKey);
|
||||
if (tabItem)
|
||||
window.gBrowser.selectedTab = tabItem.tab;
|
||||
});
|
||||
|
|
|
@ -726,7 +726,7 @@
|
|||
if (TabView && TabView.isVisible()) {
|
||||
// ToDo: this will be removed when we gain ability to draw to the menu bar.
|
||||
// Bug 586175
|
||||
this.ownerDocument.title = TabView.getWindowTitle();
|
||||
this.ownerDocument.title = TabView.windowTitle;
|
||||
} else {
|
||||
this.ownerDocument.title = this.getWindowTitleForBrowser(this.mCurrentBrowser);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче