Bug 865826 - Remove the browser.tabs.closeButtons pref. r=jaws

This commit is contained in:
Dão Gottwald 2014-04-25 11:48:33 +02:00
parent 7d6b192675
commit 63e55755db
13 changed files with 37 additions and 142 deletions

View File

@ -457,13 +457,6 @@ pref("browser.tabs.drawInTitlebar", false);
pref("browser.tabs.drawInTitlebar", true);
#endif
// Where to show tab close buttons:
// 0 on active tab only
// 1 on all tabs until tabClipWidth is reached, then active tab only
// 2 no close buttons at all
// 3 at the end of the tabstrip
pref("browser.tabs.closeButtons", 1);
// When tabs opened by links in other tabs via a combination of
// browser.link.open_newwindow being set to 3 and target="_blank" etc are
// closed:
@ -1163,7 +1156,6 @@ pref("services.sync.prefs.sync.browser.search.update", true);
pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true);
pref("services.sync.prefs.sync.browser.startup.homepage", true);
pref("services.sync.prefs.sync.browser.startup.page", true);
pref("services.sync.prefs.sync.browser.tabs.closeButtons", true);
pref("services.sync.prefs.sync.browser.tabs.loadInBackground", true);
pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true);
pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true);

View File

@ -489,10 +489,6 @@ menuitem.spell-suggestion {
font-weight: bold;
}
#sidebar-header > .tabs-closebutton {
-moz-user-focus: normal;
}
/* apply Fitts' law to the notification bar's close button */
window[sizemode="maximized"] #content .notification-inner {
border-right: 0px !important;

View File

@ -549,7 +549,7 @@
iconsize="small"
aria-label="&tabsToolbar.label;"
context="toolbar-context-menu"
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton"
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button"
collapsed="true">
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
@ -600,13 +600,6 @@
</menupopup>
</toolbarbutton>
<toolbarbutton id="tabs-closebutton"
class="close-button tabs-closebutton close-icon"
command="cmd_close"
label="&closeTab.label;"
cui-areatype="toolbar"
tooltiptext="&closeTab.label;"/>
#if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
<hbox class="private-browsing-indicator" skipintoolbarset="true"/>
#endif
@ -1054,7 +1047,7 @@
<sidebarheader id="sidebar-header" align="center">
<label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
<image id="sidebar-throbber"/>
<toolbarbutton class="tabs-closebutton close-icon" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
<toolbarbutton class="close-icon tabbable" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
</sidebarheader>
<browser id="sidebar" flex="1" autoscroll="false" disablehistory="true"
style="min-width: 14em; width: 18em; max-width: 36em;"/>

View File

@ -12,12 +12,11 @@
.tab-close-button {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-close-tab-button");
display: none;
}
.tabbrowser-tabs[closebuttons="activetab"] > * > * > * > .tab-close-button:not([pinned])[selected="true"],
.tabbrowser-tabs[closebuttons="alltabs"] > * > * > * > .tab-close-button:not([pinned]) {
display: -moz-box;
.tab-close-button[pinned],
.tabbrowser-tabs[closebuttons="activetab"] > * > * > * > .tab-close-button:not([selected="true"]) {
display: none;
}
.tab-label[pinned] {

View File

@ -3372,14 +3372,12 @@
<constructor>
<![CDATA[
this.mTabClipWidth = Services.prefs.getIntPref("browser.tabs.tabClipWidth");
this.mCloseButtons = Services.prefs.getIntPref("browser.tabs.closeButtons");
this._closeWindowWithLastTab = Services.prefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
var tab = this.firstChild;
tab.label = this.tabbrowser.mStringBundle.getString("tabs.emptyTabTitle");
tab.setAttribute("crop", "end");
tab.setAttribute("onerror", "this.removeAttribute('image');");
this.adjustTabstrip();
Services.prefs.addObserver("browser.tabs.", this._prefObserver, false);
window.addEventListener("resize", this, false);
@ -3476,13 +3474,8 @@
observe: function (subject, topic, data) {
switch (data) {
case "browser.tabs.closeButtons":
this.tabContainer.mCloseButtons = Services.prefs.getIntPref(data);
this.tabContainer.adjustTabstrip();
break;
case "browser.tabs.closeWindowWithLastTab":
this.tabContainer._closeWindowWithLastTab = Services.prefs.getBoolPref(data);
this.tabContainer.adjustTabstrip();
break;
}
}
@ -3563,42 +3556,23 @@
<body><![CDATA[
let numTabs = this.childNodes.length -
this.tabbrowser._removingTabs.length;
// modes for tabstrip
// 0 - button on active tab only
// 1 - close buttons on all tabs
// 2 - no close buttons at all
// 3 - close button at the end of the tabstrip
switch (this.mCloseButtons) {
case 0:
this.setAttribute("closebuttons", "activetab");
break;
case 1:
if (numTabs <= 2) {
// This is an optimization to avoid layout flushes by calling
// getBoundingClientRect() when we just opened a second tab. In
// this case it's highly unlikely that the tab width is smaller
// than mTabClipWidth and the tab close button obscures too much
// of the tab's label. In the edge case of the window being too
// narrow (or if tabClipWidth has been set to a way higher value),
// we'll correct the 'closebuttons' attribute after the tabopen
// animation has finished.
this.setAttribute("closebuttons", "alltabs");
} else {
let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs];
if (tab && tab.getBoundingClientRect().width > this.mTabClipWidth)
this.setAttribute("closebuttons", "alltabs");
else
this.setAttribute("closebuttons", "activetab");
if (numTabs > 2) {
// This is an optimization to avoid layout flushes by calling
// getBoundingClientRect() when we just opened a second tab. In
// this case it's highly unlikely that the tab width is smaller
// than mTabClipWidth and the tab close button obscures too much
// of the tab's label. In the edge case of the window being too
// narrow (or if tabClipWidth has been set to a way higher value),
// we'll correct the 'closebuttons' attribute after the tabopen
// animation has finished.
let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs];
if (tab && tab.getBoundingClientRect().width <= this.mTabClipWidth) {
this.setAttribute("closebuttons", "activetab");
return;
}
break;
case 2:
case 3:
this.setAttribute("closebuttons", "never");
break;
}
var tabstripClosebutton = document.getElementById("tabs-closebutton");
if (tabstripClosebutton && tabstripClosebutton.parentNode == this._container)
tabstripClosebutton.collapsed = this.mCloseButtons != 3;
this.removeAttribute("closebuttons");
]]></body>
</method>

View File

@ -224,7 +224,6 @@ let CustomizableUIInternal = {
"tabbrowser-tabs",
"new-tab-button",
"alltabs-button",
"tabs-closebutton",
],
defaultCollapsed: null,
}, true);

View File

@ -20,7 +20,7 @@ function test() {
TabView.moveTabTo(newTabs[newTabs.length - 1], null);
ok(gBrowser.visibleTabs[0].getBoundingClientRect().width > gBrowser.tabContainer.mTabClipWidth,
"Tab width is bigger than tab clip width");
is(gBrowser.tabContainer.getAttribute("closebuttons"), "alltabs", "Show button on all tabs.")
is(gBrowser.tabContainer.getAttribute("closebuttons"), "", "Show button on all tabs.")
// clean up and finish
newTabs.forEach(function(tab) {

View File

@ -62,7 +62,6 @@ XPCOMUtils.defineLazyGetter(this, "DEFAULT_AREA_PLACEMENTS", function() {
"tabbrowser-tabs",
"new-tab-button",
"alltabs-button",
"tabs-closebutton",
],
"PersonalToolbar": [
"personal-bookmarks",

View File

@ -1772,32 +1772,15 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
z-index: 3;
}
/* In-tab close button */
.tab-close-button > .toolbarbutton-icon {
/* XXX Buttons have padding in widget/ that we don't want here but can't override with good CSS, so we must
use evil CSS to give the impression of smaller content */
margin: -4px;
}
/* Tabstrip close button */
.tabs-closebutton,
.tab-close-button {
-moz-appearance: none;
height: 16px;
width: 16px;
}
.tabs-closebutton:not([selected]):not(:hover),
/* Tab close button */
.tab-close-button:not([selected]):not(:hover) {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 64, 16, 48);
}
.tabs-closebutton:not([selected]):not(:hover):-moz-lwtheme-brighttext,
.tab-close-button:not([selected]):not(:hover):-moz-lwtheme-brighttext {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 80, 16, 64);
}
.tabs-closebutton:not([selected]):not(:hover):-moz-lwtheme-darktext,
.tab-close-button:not([selected]):not(:hover):-moz-lwtheme-darktext {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 96, 16, 80);
}
@ -1810,23 +1793,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
-moz-image-region: auto;
}
.customization-tipPanel-closeBox > .close-icon {
-moz-appearance: none;
width: 16px;
height: 16px;
}
/* The :hover:active style from toolkit doesn't seem to work in this panel so just use :active. */
.customization-tipPanel-closeBox > .close-icon:active {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 48, 16, 32);
}
.tabs-closebutton > .toolbarbutton-icon {
/* XXX Buttons have padding in widget/ that we don't want here but can't override with good CSS, so we must
use evil CSS to give the impression of smaller content */
margin: -2px;
}
/* Tabbrowser arrowscrollbox arrows */
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down {
@ -1903,11 +1869,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
/* Sidebar */
#sidebar-header > .tabs-closebutton {
margin-bottom: 0px !important;
padding: 0px 2px 0px 2px !important;
}
#sidebar-throbber[loading="true"] {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
-moz-margin-end: 4px;
@ -2235,6 +2196,11 @@ chatbox {
border-left: 3px solid transparent;
}
/* The :hover:active style from toolkit doesn't seem to work in this panel so just use :active. */
.customization-tipPanel-closeBox > .close-icon:active {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 48, 16, 32);
}
/* End customization mode */

View File

@ -2623,10 +2623,6 @@ sidebarheader {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
sidebarheader > .tabs-closebutton > .toolbarbutton-text {
display: none;
}
/* ----- CONTENT ----- */
.browserContainer > findbar {
@ -3179,18 +3175,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
box-shadow: inset -5px 0 ThreeDShadow;
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-padding-end: 4px;
border: none;
}
@media (min-resolution: 2dppx) {
.tabs-closebutton > .toolbarbutton-icon {
width: 16px;
}
}
/* Bookmarks toolbar */
#PlacesToolbarDropIndicator {
list-style-image: url(chrome://browser/skin/places/toolbarDropMarker.png);

View File

@ -1766,6 +1766,13 @@ toolbarbutton[type="socialmark"] > .toolbarbutton-icon {
-moz-padding-start: 0px;
}
#sidebar-header > .close-icon {
-moz-appearance: none;
padding: 4px 2px;
margin: 0;
border: none;
}
.browserContainer > findbar {
background-color: -moz-dialog;
color: -moz-DialogText;
@ -1997,20 +2004,6 @@ toolbarbutton[type="socialmark"] > .toolbarbutton-icon {
box-shadow: inset -5px 0 ThreeDShadow;
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-appearance: none;
padding: 4px 2px;
margin: 0px;
border: none;
}
.tabs-closebutton > .toolbarbutton-icon {
-moz-margin-end: 0px !important;
-moz-padding-end: 2px !important;
-moz-padding-start: 2px !important;
}
toolbarbutton.chevron {
list-style-image: url("chrome://global/skin/toolbar/chevron.gif") !important;
}

View File

@ -310,6 +310,9 @@ notification > button {
/* :::::: Close button icons ::::: */
.close-icon {
-moz-appearance: none;
height: 16px;
width: 16px;
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 16, 16, 0);
background-position: center center;
background-repeat: no-repeat;

View File

@ -52,9 +52,6 @@ notification[type="critical"] {
}
.messageCloseButton {
-moz-appearance: none;
width: 16px;
height: 16px;
padding-left: 11px;
padding-right: 11px;
}