Bug 944947 - update bookmarks toolbar button styling some more for Australis, r=jaws

This commit is contained in:
Gijs Kruitbosch 2014-01-18 01:43:21 +01:00
parent 38de1add5a
commit 2215de3342
6 changed files with 34 additions and 26 deletions

View File

@ -59,6 +59,7 @@ let CustomizationHandler = {
_customizationChange: function() {
gHomeButton.updatePersonalToolbarStyle();
BookmarkingUI.customizeChange();
PlacesToolbarHelper.customizeChange();
},
_customizationEnding: function(aDetails) {

View File

@ -863,6 +863,10 @@ let PlacesToolbarHelper = {
return document.getElementById("PlacesToolbar");
},
get _placeholder() {
return document.getElementById("bookmarks-toolbar-placeholder");
},
init: function PTH_init(forceToolbarOverflowCheck) {
let viewElt = this._viewElt;
if (!viewElt || viewElt._placesView)
@ -883,6 +887,7 @@ let PlacesToolbarHelper = {
if (forceToolbarOverflowCheck) {
viewElt._placesView.updateOverflowStatus();
}
this.customizeChange();
},
customizeStart: function PTH_customizeStart() {
@ -893,6 +898,24 @@ let PlacesToolbarHelper = {
} finally {
this._isCustomizing = true;
}
this._shouldWrap = this._getShouldWrap();
},
customizeChange: function PTH_customizeChange() {
let placeholder = this._placeholder;
if (!placeholder) {
return;
}
let shouldWrapNow = this._getShouldWrap();
if (this._shouldWrap != shouldWrapNow) {
if (shouldWrapNow) {
placeholder.setAttribute("wrap", "true");
} else {
placeholder.removeAttribute("wrap");
}
placeholder.classList.toggle("toolbarbutton-1", shouldWrapNow);
this._shouldWrap = shouldWrapNow;
}
},
customizeDone: function PTH_customizeDone() {
@ -900,6 +923,13 @@ let PlacesToolbarHelper = {
this.init(true);
},
_getShouldWrap: function PTH_getShouldWrap() {
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
let area = placement && placement.area;
let areaType = area && CustomizableUI.getAreaType(area);
return !area || CustomizableUI.TYPE_MENU_PANEL == areaType;
},
onPlaceholderCommand: function () {
let widgetGroup = CustomizableUI.getWidget("personal-bookmarks");
let widget = widgetGroup.forWindow(window);

View File

@ -1044,8 +1044,6 @@ var gBrowserInit = {
if (!isLoadingBlank || !focusAndSelectUrlBar())
gBrowser.selectedBrowser.focus();
gNavToolbox.customizeDone = BrowserToolboxCustomizeDone;
// Set up Sanitize Item
this._initializeSanitizer();
@ -1057,7 +1055,6 @@ var gBrowserInit = {
gPrefService.addObserver(gHomeButton.prefDomain, gHomeButton, false);
var homeButton = document.getElementById("home-button");
gHomeButton.init();
gHomeButton.updateTooltip(homeButton);
gHomeButton.updatePersonalToolbarStyle(homeButton);
@ -1250,7 +1247,6 @@ var gBrowserInit = {
}
BookmarkingUI.uninit();
gHomeButton.uninit();
TabsInTitlebar.uninit();
@ -3280,15 +3276,11 @@ function OpenBrowserWindow(options)
return win;
}
//XXXunf Are these still useful to keep around?
// Only here for backwards compat, we should remove this soon
function BrowserCustomizeToolbar() {
gCustomizeMode.enter();
}
function BrowserToolboxCustomizeDone(aToolboxChanged) {
gCustomizeMode.exit(aToolboxChanged);
}
/**
* Update the global flag that tracks whether or not any edit UI (the Edit menu,
* edit-related items in the context menu, and edit-related toolbar buttons
@ -4759,16 +4751,6 @@ function fireSidebarFocusedEvent() {
var gHomeButton = {
init: function() {
gNavToolbox.addEventListener("customizationchange",
this.onCustomizationChange);
},
uninit: function() {
gNavToolbox.removeEventListener("customizationchange",
this.onCustomizationChange);
},
prefDomain: "browser.startup.homepage",
observe: function (aSubject, aTopic, aPrefName)
{
@ -4821,10 +4803,6 @@ var gHomeButton = {
homeButton.className.replace("toolbarbutton-1", "bookmark-item") :
homeButton.className.replace("bookmark-item", "toolbarbutton-1");
},
onCustomizationChange: function(aEvent) {
gHomeButton.updatePersonalToolbarStyle();
},
};
/**

View File

@ -858,7 +858,6 @@
cui-areatype="toolbar"
removable="true">
<toolbarbutton id="bookmarks-toolbar-placeholder"
type="wrap"
mousethrough="never"
label="&bookmarksToolbarItem.label;"
oncommand="PlacesToolbarHelper.onPlaceholderCommand();"/>

View File

@ -45,8 +45,7 @@
}
}
.panel-wide-item[cui-areatype="menu-panel"] > toolbarbutton,
toolbarbutton[cui-areatype="menu-panel"] {
.panelUI-grid .toolbarbutton-1 {
margin-right: 0;
margin-left: 0;
margin-bottom: 0;

View File

@ -311,6 +311,7 @@ toolbarpaletteitem[place="palette"] > toolbaritem > toolbarbutton {
background-image: linear-gradient(rgb(38,115,191), rgb(38,125,191));
}
#customization-palette .toolbarbutton-multiline-text,
#customization-palette .toolbarbutton-text {
display: none;
}