Bug 414945: fix home button styling when used on the main toolbar, without regressing Txul/Twinopen, patch by D��o Gottwald <dao@mozilla.com>, r=me, a=beltzner

This commit is contained in:
gavin%gavinsharp.com 2008-01-30 23:16:53 +00:00
Родитель 6dccc6385f
Коммит a911069c03
5 изменённых файлов: 34 добавлений и 27 удалений

Просмотреть файл

@ -946,7 +946,9 @@ function delayedStartup()
SetPageProxyState("invalid");
getNavToolbox().customizeDone = BrowserToolboxCustomizeDone;
var navToolbox = getNavToolbox();
navToolbox.customizeDone = BrowserToolboxCustomizeDone;
navToolbox.customizeChange = BrowserToolboxCustomizeChange;
// Set up Sanitize Item
gSanitizeListener = new SanitizeListener();
@ -958,8 +960,6 @@ function delayedStartup()
gPrefService.addObserver(gHomeButton.prefDomain, gHomeButton, false);
gHomeButton.updateTooltip();
//XXX
//gHomeButton.setPersonalToolbarStyle();
#ifdef HAVE_SHELL_SERVICE
// Perform default browser checking (after window opens).
@ -3084,8 +3084,6 @@ function BrowserCustomizeToolbar()
if (splitter)
splitter.parentNode.removeChild(splitter);
gHomeButton.unsetPersonalToolbarStyle();
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
sheetFrame.hidden = false;
@ -3132,7 +3130,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged)
UpdateUrlbarSearchSplitterState();
gHomeButton.setPersonalToolbarStyle();
gHomeButton.updatePersonalToolbarStyle();
// Update the urlbar
if (gURLBar) {
@ -3170,6 +3168,10 @@ function BrowserToolboxCustomizeDone(aToolboxChanged)
#endif
}
function BrowserToolboxCustomizeChange() {
gHomeButton.updatePersonalToolbarStyle();
}
/**
* 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
@ -4216,18 +4218,14 @@ var gHomeButton = {
return url;
},
setPersonalToolbarStyle: function ()
{
var homeButton = document.getElementById("home-button");
if (homeButton && homeButton.parentNode.id == "personal-toolbar")
homeButton.className = homeButton.className.replace("toolbarbutton-1", "bookmark-item");
},
unsetPersonalToolbarStyle: function ()
updatePersonalToolbarStyle: function ()
{
var homeButton = document.getElementById("home-button");
if (homeButton)
homeButton.className = homeButton.className.replace("bookmark-item", "toolbarbutton-1");
homeButton.className = homeButton.parentNode.id == "personal-toolbar"
|| homeButton.parentNode.parentNode.id == "personal-toolbar" ?
homeButton.className.replace("toolbarbutton-1", "bookmark-item") :
homeButton.className.replace("bookmark-item", "toolbarbutton-1");
}
};

Просмотреть файл

@ -272,6 +272,7 @@
tooltiptext="&stopButton.tooltip;"/>
<toolbarbutton id="home-button" class="bookmark-item chromeclass-toolbar-additional"
persist="class"
label="&homeButton.label;"
ondragover="nsDragAndDrop.dragOver(event, homeButtonObserver);"
ondragdrop="nsDragAndDrop.drop(event, homeButtonObserver);"

Просмотреть файл

@ -652,11 +652,11 @@ toolbar[iconsize="small"] #reload-button[disabled="true"] {
}
toolbar[iconsize="small"] #home-button ,
#personal-toolbar > #home-button {
#home-button.bookmark-item {
list-style-image: url("moz-icon://stock/gtk-home?size=menu");
}
toolbar[iconsize="small"] #home-button[disabled="true"] ,
#personal-toolbar > #home-button[disabled="true"] {
#home-button.bookmark-item[disabled="true"] {
list-style-image: url("moz-icon://stock/gtk-home?size=menu&state=disabled");
}

Просмотреть файл

@ -753,28 +753,29 @@ toolbar[iconsize="small"] #reload-button[disabled="true"] {
toolbar[iconsize="small"] #reload-button:not([disabled="true"]):hover:active {
-moz-image-region: rect(64px 64px 80px 48px);
}
/* home button */
toolbar[iconsize="small"] #home-button .toolbarbutton-icon {
toolbar[iconsize="small"] #home-button.toolbarbutton-1 .toolbarbutton-icon {
padding-left: 1px;
}
#personal-toolbar > #home-button {
#home-button.bookmark-item {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
}
toolbar[iconsize="small"] #home-button ,
#personal-toolbar > #home-button {
#home-button.bookmark-item {
-moz-image-region: rect(0px 80px 16px 64px);
}
toolbar[iconsize="small"] #home-button:not([disabled="true"]):hover ,
#personal-toolbar > #home-button:not([disabled="true"]):hover {
#home-button.bookmark-item:not([disabled="true"]):hover {
-moz-image-region: rect(16px 80px 32px 64px);
}
toolbar[iconsize="small"] #home-button[disabled="true"] ,
#personal-toolbar > #home-button[disabled="true"] {
#home-button.bookmark-item[disabled="true"] {
-moz-image-region: rect(32px 80px 48px 64px);
}
toolbar[iconsize="small"] #home-button:not([disabled="true"]):hover:active ,
#personal-toolbar > #home-button:not([disabled="true"]):hover:active {
#home-button.bookmark-item:not([disabled="true"]):hover:active {
-moz-image-region: rect(64px 80px 80px 64px);
}

Просмотреть файл

@ -125,6 +125,13 @@ function notifyParentComplete()
gToolbox.customizeDone(gToolboxChanged);
}
function toolboxChanged()
{
gToolboxChanged = true;
if ("customizeChange" in gToolbox)
gToolbox.customizeChange();
}
function getToolbarAt(i)
{
return gToolbox.childNodes[i];
@ -550,7 +557,7 @@ function addNewToolbar()
gToolbox.appendCustomToolbar(name.value, "");
gToolboxChanged = true;
toolboxChanged();
}
/**
@ -606,7 +613,7 @@ function restoreDefaultSet()
// Restore the disabled and command states
restoreItemAttributes(["itemdisabled", "itemcommand"], savedAttributes);
gToolboxChanged = true;
toolboxChanged();
}
function saveItemAttributes(aAttributeList)
@ -909,7 +916,7 @@ var toolbarDNDObserver =
gCurrentDragOverItem = null;
gToolboxChanged = true;
toolboxChanged();
},
_flavourSet: null,
@ -967,7 +974,7 @@ var paletteDNDObserver =
}
}
gToolboxChanged = true;
toolboxChanged();
},
_flavourSet: null,