Skip to content

Commit

Permalink
Bug 865826 - Remove the browser.tabs.closeButtons pref. r=jaws
Browse files Browse the repository at this point in the history
  • Loading branch information
daogottwald committed Apr 25, 2014
1 parent 2373859 commit 7c759c9
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 143 deletions.
2 changes: 1 addition & 1 deletion addon-sdk/source/test/test-ui-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ exports.testShowToOpenXToClose = function(assert, done) {
onShow: function() {
assert.ok(isChecked(menuitem), 'menuitem is checked');

let closeButton = window.document.querySelector('#sidebar-header > toolbarbutton.tabs-closebutton');
let closeButton = window.document.querySelector('#sidebar-header > toolbarbutton.close-icon');
simulateCommand(closeButton);
},
onHide: function() {
Expand Down
8 changes: 0 additions & 8 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions browser/base/content/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 2 additions & 9 deletions browser/base/content/browser.xul
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;"/>
Expand Down
7 changes: 3 additions & 4 deletions browser/base/content/tabbrowser.css
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down
56 changes: 15 additions & 41 deletions browser/base/content/tabbrowser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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>

Expand Down
1 change: 0 additions & 1 deletion browser/components/customizableui/src/CustomizableUI.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ let CustomizableUIInternal = {
"tabbrowser-tabs",
"new-tab-button",
"alltabs-button",
"tabs-closebutton",
],
defaultCollapsed: null,
}, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion browser/modules/BrowserUITelemetry.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ XPCOMUtils.defineLazyGetter(this, "DEFAULT_AREA_PLACEMENTS", function() {
"tabbrowser-tabs",
"new-tab-button",
"alltabs-button",
"tabs-closebutton",
],
"PersonalToolbar": [
"personal-bookmarks",
Expand Down
46 changes: 6 additions & 40 deletions browser/themes/linux/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */


Expand Down
16 changes: 0 additions & 16 deletions browser/themes/osx/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
21 changes: 7 additions & 14 deletions browser/themes/windows/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions toolkit/themes/linux/global/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions toolkit/themes/linux/global/notification.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ notification[type="critical"] {
}

.messageCloseButton {
-moz-appearance: none;
width: 16px;
height: 16px;
padding-left: 11px;
padding-right: 11px;
}
Expand Down

0 comments on commit 7c759c9

Please sign in to comment.