From a73ee765d8cb7c7cf2651836d9de5b25aad92566 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 17 Dec 2010 00:46:26 -0500 Subject: [PATCH] Kill tab bindings. --- common/content/bindings.xml | 83 ------------------------------------ common/content/configbase.js | 9 +++- common/content/dactyl.js | 3 -- common/content/events.js | 21 ++++----- common/content/statusline.js | 5 --- common/content/tabs.js | 22 ++++++---- common/modules/util.jsm | 3 +- common/skin/dactyl.css | 7 +++ 8 files changed, 41 insertions(+), 112 deletions(-) diff --git a/common/content/bindings.xml b/common/content/bindings.xml index 27ca1d93..eca6f65d 100644 --- a/common/content/bindings.xml +++ b/common/content/bindings.xml @@ -24,89 +24,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/content/configbase.js b/common/content/configbase.js index 41fb4d18..99bdb1ef 100644 --- a/common/content/configbase.js +++ b/common/content/configbase.js @@ -234,13 +234,18 @@ const ConfigBase = Class(ModuleBase, { TabClose;.tab-close-button TabIcon;.tab-icon TabText;.tab-text - !TabNumber font-weight: bold; margin: 0px; padding-right: .3ex; - !TabIconNumber { + TabNumber font-weight: bold; margin: 0px; padding-right: .3ex; + TabNumber::after content: counter(dactyl-tab-number); + TabIconNumber { + width: 16px; + margin-left: -16px; + display: block; font-weight: bold; color: white; text-align: center; text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px; } + TabIconNumber::after content: counter(dactyl-tab-number); Title color: magenta; background: white; font-weight: bold; URL text-decoration: none; color: green; background: inherit; diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 69ce4149..78fe6a03 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1237,9 +1237,6 @@ const Dactyl = Module("dactyl", { styles.addSheet(true, "taboptions", "chrome://*", classes.length ? classes.join(",") + "{ display: none; }" : ""); - - tabs.tabBinding.enabled = Array.some(opts, function (k) k in this.opts, this); - statusline.updateTabCount(); } } ].filter(function (group) !group.feature || dactyl.has(group.feature)); diff --git a/common/content/events.js b/common/content/events.js index 0a8fca7a..b9731ee8 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -72,16 +72,16 @@ const Events = Module("events", { }; this._activeMenubar = false; - this.addSessionListener(window, "DOMMenuBarActive", this.closure.onDOMMenuBarActive, true); - this.addSessionListener(window, "DOMMenuBarInactive", this.closure.onDOMMenuBarInactive, true); - this.addSessionListener(window, "focus", this.wrapListener(this.onFocus), true); - this.addSessionListener(window, "keydown", this.wrapListener(this.onKeyUpOrDown), true); - this.addSessionListener(window, "keypress", this.wrapListener(this.onKeyPress), true); - this.addSessionListener(window, "keyup", this.wrapListener(this.onKeyUpOrDown), true); - this.addSessionListener(window, "mousedown", this.wrapListener(this.onMouseDown), true); - this.addSessionListener(window, "popuphidden", this.closure.onPopupHidden, true); - this.addSessionListener(window, "popupshown", this.closure.onPopupShown, true); - this.addSessionListener(window, "resize", this.closure.onResize, true); + this.addSessionListener(window, "DOMMenuBarActive", this.onDOMMenuBarActive, true); + this.addSessionListener(window, "DOMMenuBarInactive", this.onDOMMenuBarInactive, true); + this.addSessionListener(window, "focus", this.onFocus, true); + this.addSessionListener(window, "keydown", this.onKeyUpOrDown, true); + this.addSessionListener(window, "keypress", this.onKeyPress, true); + this.addSessionListener(window, "keyup", this.onKeyUpOrDown, true); + this.addSessionListener(window, "mousedown", this.onMouseDown, true); + this.addSessionListener(window, "popuphidden", this.onPopupHidden, true); + this.addSessionListener(window, "popupshown", this.onPopupShown, true); + this.addSessionListener(window, "resize", this.onResize, true); }, destroy: function () { @@ -103,6 +103,7 @@ const Events = Module("events", { */ addSessionListener: function (target, event, callback, capture) { let args = Array.slice(arguments, 0); + args[2] = this.wrapListener(callback); args[0].addEventListener.apply(args[0], args.slice(1)); args[0] = Cu.getWeakReference(args[0]); this.sessionListeners.push(args); diff --git a/common/content/statusline.js b/common/content/statusline.js index 8d24adbc..63967cc5 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -214,11 +214,6 @@ const StatusLine = Module("statusline", { return; } - // update the ordinal which is used for numbered tabs - if (options.get("guioptions").has("n", "N")) - for (let [i, tab] in Iterator(tabs.visibleTabs)) - tab.setAttribute("ordinal", i + 1); - this.widgets.tabcount.value = "[" + (tabs.index(null, true) + 1) + "/" + tabs.visibleTabs.length + "]"; } }, diff --git a/common/content/tabs.js b/common/content/tabs.js index f2be4187..29b0be24 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -21,14 +21,6 @@ const Tabs = Module("tabs", { this._lastBufferSwitchArgs = ""; this._lastBufferSwitchSpecial = true; - this.tabBinding = styles.addSheet(true, "tab-binding", "chrome://browser/content/browser.xul", String.replace(<> xul|tabs > xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab-4) !important; } - // FIXME: better solution for themes? - .tabbrowser-tab[busy] > .tab-icon > .tab-icon-image { list-style-image: url('chrome://global/skin/icons/loading_16.png') !important; } - ]]>, /tab-./g, function (m) util.OS.isMacOSX ? "tab-mac" : m), - false, true); - // hide tabs initially to prevent flickering when 'stal' would hide them // on startup if (config.hasTabbrowser) @@ -45,6 +37,17 @@ const Tabs = Module("tabs", { }, _updateTabCount: function () { + for (let tab in values(this.allTabs)) { + function node(clas) document.getAnonymousElementByAttribute(tab, "class", clas); + if (!node("dactyl-tab-number")) { + let dom = util.xmlToDom(.*, document); + let img = node("tab-icon-image"); + img.parentNode.appendChild(dom); + } + } statusline.updateTabCount(true); }, @@ -479,6 +482,9 @@ const Tabs = Module("tabs", { services.sessionStore.setTabState(to, tabState); } }, { + load: function () { + tabs._updateTabCount(); + }, commands: function () { commands.add(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"], "Delete current buffer", diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 9dfae270..ea0e352b 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -10,11 +10,12 @@ try { Components.utils.import("resource://dactyl/base.jsm"); defineModule("util", { - exports: ["FailedAssertion", "Math", "NS", "Util", "XHTML", "XUL", "util"], + exports: ["FailedAssertion", "Math", "NS", "Util", "XBL", "XHTML", "XUL", "util"], require: ["services"], use: ["highlight", "storage", "template"] }); +const XBL = Namespace("xbl", "http://www.mozilla.org/xbl"); const XHTML = Namespace("html", "http://www.w3.org/1999/xhtml"); const XUL = Namespace("xul", "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); const NS = Namespace("dactyl", "http://vimperator.org/namespaces/liberator"); diff --git a/common/skin/dactyl.css b/common/skin/dactyl.css index 24b8b352..93744980 100644 --- a/common/skin/dactyl.css +++ b/common/skin/dactyl.css @@ -1,5 +1,6 @@ @namespace dactyl url("http://vimperator.org/namespaces/liberator"); @namespace html url("http://www.w3.org/1999/xhtml"); +@namespace xul uri("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* Applied to all content */ [dactyl|activeframe] { @@ -79,6 +80,12 @@ @-moz-document url-prefix(chrome://) { +xul|tabs, xul|tabbrowser { counter-reset: dactyl-tab-number; } +xul|tab { counter-increment: dacytl-tab-number; } +.tab-icon-image, .tab-throbber { -moz-box-ordinal-group: 10; } +[dactyl|highlight~=TabNumber], [dactyl|highlight~=TabIconNumber] { -moz-box-ordinal-group: 20; } +.tab-text, .tab-label, .tab-close-button { -moz-box-ordinal-group: 50; } + #addon-bar > #addonbar-closebutton { visibility: collapse; }