Bug 1182102 - Stop setting the bookmark-item class on the home button or the bookmarks button when moving them to the bookmarks toolbar. r=gijs

This commit is contained in:
Dão Gottwald 2015-08-17 15:51:22 +02:00
parent 6a1f20f8e5
commit e0bb5614ac
19 changed files with 31 additions and 153 deletions

View File

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

View File

@ -1353,7 +1353,6 @@ let BookmarkingUI = {
this.broadcaster.removeAttribute("stardisabled");
this._updateStar();
}
this._updateToolbarStyle();
},
_updateCustomizationState: function BUI__updateCustomizationState() {
@ -1361,20 +1360,6 @@ let BookmarkingUI = {
this._currentAreaType = placement && CustomizableUI.getAreaType(placement.area);
},
_updateToolbarStyle: function BUI__updateToolbarStyle() {
let onPersonalToolbar = false;
if (this._currentAreaType == CustomizableUI.TYPE_TOOLBAR) {
let personalToolbar = document.getElementById("PersonalToolbar");
onPersonalToolbar = this.button.parentNode == personalToolbar ||
this.button.parentNode.parentNode == personalToolbar;
}
if (onPersonalToolbar)
this.button.classList.add("bookmark-item");
else
this.button.classList.remove("bookmark-item");
},
_uninitView: function BUI__uninitView() {
// When an element with a placesView attached is removed and re-inserted,
// XBL reapplies the binding causing any kind of issues and possible leaks,
@ -1437,14 +1422,12 @@ let BookmarkingUI = {
if (!this._isCustomizing) {
this._uninitView();
}
this._updateToolbarStyle();
},
onCustomizeEnd: function BUI_customizeEnd(aWindow) {
if (aWindow == window) {
this._isCustomizing = false;
this.onToolbarVisibilityChange();
this._updateToolbarStyle();
}
},

View File

@ -597,8 +597,7 @@ toolbarbutton.bookmark-item {
toolbar[mode="text"] #bookmarks-menu-button > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
display: -moz-box !important;
}
toolbar[mode="text"] #bookmarks-menu-button > .toolbarbutton-menubutton-button > .toolbarbutton-text,
toolbar[mode="full"] #bookmarks-menu-button.bookmark-item > .toolbarbutton-menubutton-button > .toolbarbutton-text {
toolbar[mode="text"] #bookmarks-menu-button > .toolbarbutton-menubutton-button > .toolbarbutton-text {
display: none;
}

View File

@ -1296,7 +1296,6 @@ var gBrowserInit = {
var homeButton = document.getElementById("home-button");
gHomeButton.updateTooltip(homeButton);
gHomeButton.updatePersonalToolbarStyle(homeButton);
let safeMode = document.getElementById("helpSafeMode");
if (Services.appinfo.inSafeMode) {
@ -5388,17 +5387,6 @@ var gHomeButton = {
return url;
},
updatePersonalToolbarStyle: function (homeButton)
{
if (!homeButton)
homeButton = document.getElementById("home-button");
if (homeButton)
homeButton.className = homeButton.parentNode.id == "PersonalToolbar"
|| homeButton.parentNode.parentNode.id == "PersonalToolbar" ?
homeButton.className.replace("toolbarbutton-1", "bookmark-item") :
homeButton.className.replace("bookmark-item", "toolbarbutton-1");
},
};
const nodeToTooltipMap = {

View File

@ -815,7 +815,6 @@
<toolbarbutton id="bookmarks-menu-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
persist="class"
removable="true"
type="menu-button"
label="&bookmarksMenuButton.label;"
@ -939,7 +938,7 @@
tooltip="dynamic-shortcut-tooltip"/>
<toolbarbutton id="home-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
persist="class" removable="true"
removable="true"
label="&homeButton.label;"
ondragover="homeButtonObserver.onDragOver(event)"
ondragenter="homeButtonObserver.onDragOver(event)"

View File

@ -60,7 +60,6 @@ skip-if = os == "linux"
[browser_938980_navbar_collapsed.js]
[browser_938995_indefaultstate_nonremovable.js]
[browser_940013_registerToolbarNode_calls_registerArea.js]
[browser_940107_home_button_in_bookmarks_toolbar.js]
[browser_940307_panel_click_closure_handling.js]
[browser_940946_removable_from_navbar_customizemode.js]
[browser_941083_invalidate_wrapper_cache_createWidget.js]

View File

@ -1,41 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Bug 940107 - Home icon not displayed correctly when in bookmarks toolbar.
add_task(function() {
ok(CustomizableUI.inDefaultState, "Should be in default state when test starts.");
let bookmarksToolbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
bookmarksToolbar.collapsed = false;
let homeButton = document.getElementById("home-button");
ok(homeButton.classList.contains("toolbarbutton-1"), "Home Button should have toolbarbutton-1 when in the nav-bar");
ok(!homeButton.classList.contains("bookmark-item"), "Home Button should not be displayed as a bookmarks item");
yield startCustomizing();
CustomizableUI.addWidgetToArea(homeButton.id, CustomizableUI.AREA_BOOKMARKS);
yield endCustomizing();
ok(homeButton.classList.contains("bookmark-item"), "Home Button should be displayed as a bookmarks item");
ok(!homeButton.classList.contains("toolbarbutton-1"), "Home Button should not be displayed as a nav-bar item");
gCustomizeMode.addToPanel(homeButton);
let panelShownPromise = promisePanelShown(window);
PanelUI.toggle();
yield panelShownPromise;
ok(homeButton.classList.contains("toolbarbutton-1"), "Home Button should have toolbarbutton-1 when in the panel");
ok(!homeButton.classList.contains("bookmark-item"), "Home Button should not be displayed as a bookmarks item");
gCustomizeMode.addToToolbar(homeButton);
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.toggle();
yield panelHiddenPromise;
ok(homeButton.classList.contains("toolbarbutton-1"), "Home Button should have toolbarbutton-1 when in the nav-bar");
ok(!homeButton.classList.contains("bookmark-item"), "Home Button should not be displayed as a bookmarks item");
bookmarksToolbar.collapsed = true;
CustomizableUI.reset();
});

View File

@ -1771,7 +1771,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 30;
const UI_VERSION = 31;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion = 0;
try {
@ -2132,6 +2132,11 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("browser.devedition.showCustomizeButton");
}
if (currentUIVersion < 31) {
xulStore.removeValue(BROWSER_DOCURL, "bookmarks-menu-button", "class");
xulStore.removeValue(BROWSER_DOCURL, "home-button", "class");
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);

View File

@ -142,7 +142,7 @@ toolbarbutton.bookmark-item[open="true"] {
-moz-padding-end: 2px;
}
.bookmark-item:not(#home-button) > .toolbarbutton-icon,
.bookmark-item > .toolbarbutton-icon,
#personal-bookmarks[cui-areatype="toolbar"] > #bookmarks-toolbar-placeholder > .toolbarbutton-icon {
width: 16px;
height: 16px;
@ -1108,8 +1108,7 @@ notification[value="loop-sharing-notification"] .messageImage {
.ac-result-type-bookmark,
.autocomplete-treebody::-moz-tree-image(bookmark, treecolAutoCompleteImage) {
list-style-image: url("chrome://browser/skin/places/star-icons.png");
-moz-image-region: rect(0px 32px 16px 16px);
list-style-image: url("chrome://browser/skin/places/autocomplete-star.png");
width: 16px;
height: 16px;
}

View File

@ -190,6 +190,7 @@ browser.jar:
skin/classic/browser/panic-panel/header-small@2x.png (../shared/panic-panel/header-small@2x.png)
skin/classic/browser/panic-panel/icons.png (../shared/panic-panel/icons.png)
skin/classic/browser/panic-panel/icons@2x.png (../shared/panic-panel/icons@2x.png)
skin/classic/browser/places/autocomplete-star.png (places/autocomplete-star.png)
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
skin/classic/browser/places/bookmarksToolbar-menuPanel.png (places/bookmarksToolbar-menuPanel.png)
@ -198,7 +199,6 @@ browser.jar:
skin/classic/browser/places/calendar.png (places/calendar.png)
* skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
skin/classic/browser/places/livemark-item.png (places/livemark-item.png)
skin/classic/browser/places/star-icons.png (places/star-icons.png)
skin/classic/browser/places/starred48.png (places/starred48.png)
skin/classic/browser/places/unstarred48.png (places/unstarred48.png)
skin/classic/browser/places/places.css (places/places.css)

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 B

View File

@ -294,7 +294,7 @@ toolbarbutton.chevron:-moz-locale-dir(rtl) > .toolbarbutton-icon {
/* ----- BOOKMARK BUTTONS ----- */
toolbarbutton.bookmark-item:not(.subviewbutton):not(#bookmarks-menu-button),
toolbarbutton.bookmark-item:not(.subviewbutton),
#personal-bookmarks[cui-areatype="toolbar"]:not([overflowedItem=true]) > #bookmarks-toolbar-placeholder {
border: 0;
border-radius: 10000px;
@ -330,7 +330,7 @@ toolbarbutton.bookmark-item:not(.subviewbutton):not(#bookmarks-menu-button),
display: -moz-box !important; /* Force the display of the label for bookmarks */
}
toolbarbutton.bookmark-item:not(.subviewbutton):not(#bookmarks-menu-button):hover {
toolbarbutton.bookmark-item:not(.subviewbutton):hover {
background-color: rgba(0, 0, 0, .205);
}
@ -352,8 +352,8 @@ toolbarbutton.bookmark-item[open="true"]:not(.subviewbutton) {
}
}
toolbarbutton.bookmark-item:not(.subviewbutton):not(#bookmarks-menu-button):active:hover,
toolbarbutton.bookmark-item:not(.subviewbutton):not(#bookmarks-menu-button)[open="true"] {
toolbarbutton.bookmark-item:not(.subviewbutton):active:hover,
toolbarbutton.bookmark-item:not(.subviewbutton)[open="true"] {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4), 0 1px rgba(255, 255, 255, 0.4);
background-color: rgba(0, 0, 0, .5);
}
@ -363,7 +363,7 @@ toolbarbutton.bookmark-item > menupopup {
-moz-margin-start: 3px;
}
.bookmark-item:not(#home-button) > .toolbarbutton-icon,
.bookmark-item > .toolbarbutton-icon,
#personal-bookmarks[cui-areatype="toolbar"] > #bookmarks-toolbar-placeholder > .toolbarbutton-icon {
width: 16px;
min-height: 16px;
@ -1427,21 +1427,6 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba
list-style-image: url("chrome://browser/skin/menu-forward.png") !important;
}
/* home button */
#home-button.bookmark-item {
/* We need to use !important here, because other selectors that apply padding
are more specific. */
padding-top: 0 !important;
padding-bottom: 0 !important;
}
#home-button.bookmark-item > .toolbarbutton-icon {
display: -moz-box !important;
-moz-margin-start: -2px;
-moz-margin-end: 3px;
}
/* tabview menu item */
#menu_tabview {
@ -1805,8 +1790,13 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba
.ac-result-type-bookmark,
.autocomplete-treebody::-moz-tree-image(bookmark, treecolAutoCompleteImage) {
list-style-image: url("chrome://browser/skin/places/star-icons.png");
-moz-image-region: rect(0, 48px, 16px, 32px);
list-style-image: url("chrome://browser/skin/places/autocomplete-star.png");
-moz-image-region: rect(0, 16px, 16px, 0);
}
richlistitem[selected="true"][current="true"] > .ac-title-box > .ac-result-type-bookmark,
.autocomplete-treebody::-moz-tree-image(selected, current, bookmark, treecolAutoCompleteImage) {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
.ac-result-type-keyword,
@ -1823,12 +1813,6 @@ richlistitem[type~="action"][actiontype="searchengine"][selected="true"] > .ac-t
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon-inverted);
}
richlistitem[selected="true"][current="true"] > .ac-title-box > .ac-result-type-bookmark,
.autocomplete-treebody::-moz-tree-image(selected, current, bookmark, treecolAutoCompleteImage) {
list-style-image: url("chrome://browser/skin/places/star-icons.png");
-moz-image-region: rect(0, 64px, 16px, 48px);
}
.ac-result-type-tag,
.autocomplete-treebody::-moz-tree-image(tag, treecolAutoCompleteImage) {
list-style-image: url("chrome://browser/skin/places/tag.png");
@ -1856,15 +1840,15 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-
-moz-image-region: rect(11px, 16px, 22px, 0);
}
@media (min-resolution: 2dppx) {
@media (min-resolution: 1.1dppx) {
.ac-result-type-bookmark {
list-style-image: url("chrome://browser/skin/places/star-icons@2x.png");
-moz-image-region: rect(0, 64px, 32px, 32px);
list-style-image: url("chrome://browser/skin/places/autocomplete-star@2x.png");
-moz-image-region: rect(0, 32px, 32px, 0);
}
richlistitem[selected="true"][current="true"] > .ac-title-box > .ac-result-type-bookmark {
list-style-image: url("chrome://browser/skin/places/star-icons@2x.png");
-moz-image-region: rect(0, 128px, 32px, 96px);
list-style-image: url("chrome://browser/skin/places/autocomplete-star@2x.png");
-moz-image-region: rect(0, 64px, 32px, 32px);
}
.ac-result-type-tag {
@ -2103,38 +2087,6 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-
-moz-image-region: rect(0, 16px, 16px, 0);
}
/* bookmarks menu-button */
#bookmarks-menu-button.bookmark-item,
#bookmarks-menu-button.bookmark-item[open] {
list-style-image: url("chrome://browser/skin/places/star-icons.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
#bookmarks-menu-button.bookmark-item[starred] {
-moz-image-region: rect(0px 32px 16px 16px);
}
#bookmarks-menu-button.bookmark-item > .toolbarbutton-menubutton-button {
padding: 0;
}
@media (min-resolution: 2dppx) {
#bookmarks-menu-button.bookmark-item,
#bookmarks-menu-button.bookmark-item[open] {
list-style-image: url("chrome://browser/skin/places/star-icons@2x.png");
-moz-image-region: rect(0px 32px 32px 0px);
}
#bookmarks-menu-button.bookmark-item[starred] {
-moz-image-region: rect(0px 64px 32px 32px);
}
#bookmarks-menu-button.bookmark-item > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
width: 16px;
}
}
/* BOOKMARKING PANEL */
#editBookmarkPanelStarIcon {
list-style-image: url("chrome://browser/skin/places/starred48.png");

View File

@ -250,6 +250,8 @@ browser.jar:
skin/classic/browser/panic-panel/icons.png (../shared/panic-panel/icons.png)
skin/classic/browser/panic-panel/icons@2x.png (../shared/panic-panel/icons@2x.png)
skin/classic/browser/places/allBookmarks.png (places/allBookmarks.png)
skin/classic/browser/places/autocomplete-star.png (places/autocomplete-star.png)
skin/classic/browser/places/autocomplete-star@2x.png (places/autocomplete-star@2x.png)
* skin/classic/browser/places/places.css (places/places.css)
* skin/classic/browser/places/organizer.css (places/organizer.css)
skin/classic/browser/places/query.png (places/query.png)
@ -263,8 +265,6 @@ browser.jar:
skin/classic/browser/places/bookmarksToolbar-menuPanel@2x.png (places/bookmarksToolbar-menuPanel@2x.png)
skin/classic/browser/places/history.png (places/history.png)
skin/classic/browser/places/history@2x.png (places/history@2x.png)
skin/classic/browser/places/star-icons.png (places/star-icons.png)
skin/classic/browser/places/star-icons@2x.png (places/star-icons@2x.png)
skin/classic/browser/places/toolbar.png (places/toolbar.png)
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
skin/classic/browser/places/folderDropArrow.png (places/folderDropArrow.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -1876,11 +1876,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
/* bookmarks menu-button */
#bookmarks-menu-button.bookmark-item > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
-moz-margin-start: 5px;
}
#bookmarks-menu-button[cui-areatype="toolbar"]:not(.bookmark-item):not([overflowedItem=true]) > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
#nav-bar #bookmarks-menu-button[cui-areatype="toolbar"]:not([overflowedItem=true]) > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
padding-top: var(--toolbarbutton-vertical-inner-padding);
padding-bottom: var(--toolbarbutton-vertical-inner-padding);
}