From e74f5e2881554ad00773be4862a6b97410438190 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Thu, 13 Jun 2013 13:40:41 +0200 Subject: [PATCH] Bug 882306 - Use CSS to make buttons look enabled when customizing; don't change buttons' disabled states, r=dao --- browser/base/content/browser-feeds.js | 9 +------- .../src/CustomizableWidgets.jsm | 7 +++--- .../customizableui/src/CustomizeMode.jsm | 9 -------- browser/themes/linux/browser.css | 22 +++++++++---------- browser/themes/osx/browser.css | 22 +++++++++---------- browser/themes/windows/browser.css | 10 ++++----- 6 files changed, 31 insertions(+), 48 deletions(-) diff --git a/browser/base/content/browser-feeds.js b/browser/base/content/browser-feeds.js index 195d049b1e3..5b432ede2f9 100644 --- a/browser/base/content/browser-feeds.js +++ b/browser/base/content/browser-feeds.js @@ -118,15 +118,8 @@ var FeedHandler = { var haveFeeds = feeds && feeds.length > 0; var feedButton = document.getElementById("feed-button"); - // Don't disable the button for customization mode. We check the URL - // here rather than the window's [customizing] attribute because they - // do not change at the same time, and the browser's feed info pertains - // to the selected page's browser, so using the location ensures - // this check is always correct: - let contentLoc = window.content && window.content.location.href; - let areCustomizing = contentLoc == "about:customizing"; if (feedButton) - feedButton.disabled = !areCustomizing && !haveFeeds; + feedButton.disabled = !haveFeeds; if (!haveFeeds) { this._feedMenuitem.setAttribute("disabled", "true"); diff --git a/browser/components/customizableui/src/CustomizableWidgets.jsm b/browser/components/customizableui/src/CustomizableWidgets.jsm index e0888406530..2bdf785807d 100644 --- a/browser/components/customizableui/src/CustomizableWidgets.jsm +++ b/browser/components/customizableui/src/CustomizableWidgets.jsm @@ -450,10 +450,9 @@ const CustomizableWidgets = [{ }, onCreated: function(node) { let win = node.ownerDocument.defaultView; - let browser = win.gBrowser.selectedBrowser; - let feeds = browser && browser.feeds && browser.feeds.length; - let contentURL = browser && browser.currentURI && browser.currentURI.spec; - if (contentURL != "about:customizing" && !feeds) { + let selectedBrowser = win.gBrowser.selectedBrowser; + let feeds = selectedBrowser && selectedBrowser.feeds; + if (!feeds || !feeds.length) { node.setAttribute("disabled", "true"); } } diff --git a/browser/components/customizableui/src/CustomizeMode.jsm b/browser/components/customizableui/src/CustomizeMode.jsm index 7dd8c9dfcf7..2ab99657d64 100644 --- a/browser/components/customizableui/src/CustomizeMode.jsm +++ b/browser/components/customizableui/src/CustomizeMode.jsm @@ -413,11 +413,6 @@ CustomizeMode.prototype = { aNode.checked = false; } - if (aNode.disabled) { - wrapper.setAttribute("itemdisabled", "true"); - aNode.disabled = false; - } - if (aNode.hasAttribute("id")) { wrapper.setAttribute("id", "wrapper-" + aNode.getAttribute("id")); } @@ -455,10 +450,6 @@ CustomizeMode.prototype = { let toolbarItem = aWrapper.firstChild; - if (aWrapper.hasAttribute("itemdisabled")) { - toolbarItem.disabled = true; - } - if (aWrapper.hasAttribute("itemchecked")) { toolbarItem.checked = true; } diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css index 9bc48b7ca61..8411f467033 100644 --- a/browser/themes/linux/browser.css +++ b/browser/themes/linux/browser.css @@ -645,7 +645,7 @@ toolbar > .customization-target > toolbarpaletteitem > #history-panelmenu { #print-button { list-style-image: url("moz-icon://stock/gtk-print?size=toolbar"); } -#print-button[disabled="true"] { +:not(toolbarpaletteitem) > #print-button[disabled="true"] { list-style-image: url("moz-icon://stock/gtk-print?size=toolbar&state=disabled"); } @@ -660,21 +660,21 @@ toolbar > .customization-target > toolbarpaletteitem > #history-panelmenu { #cut-button { list-style-image: url("moz-icon://stock/gtk-cut?size=toolbar") !important; } -#cut-button[disabled="true"] { +:not(toolbarpaletteitem) > #edit-controls > #cut-button[disabled="true"] { list-style-image: url("moz-icon://stock/gtk-cut?size=toolbar&state=disabled") !important; } #copy-button { list-style-image: url("moz-icon://stock/gtk-copy?size=toolbar") !important; } -#copy-button[disabled="true"] { +:not(toolbarpaletteitem) > #edit-controls > #copy-button[disabled="true"] { list-style-image: url("moz-icon://stock/gtk-copy?size=toolbar&state=disabled") !important; } #paste-button { list-style-image: url("moz-icon://stock/gtk-paste?size=toolbar") !important; } -#paste-button[disabled="true"] { +:not(toolbarpaletteitem) > #edit-controls > #paste-button[disabled="true"] { list-style-image: url("moz-icon://stock/gtk-paste?size=toolbar&state=disabled") !important; } @@ -702,7 +702,7 @@ toolbar > .customization-target > toolbarpaletteitem > #history-panelmenu { -moz-image-region: rect(0px 168px 24px 144px); } -#feed-button[disabled] > .toolbarbutton-icon { +:not(toolbarpaletteitem) > #feed-button[disabled] > .toolbarbutton-icon { opacity: .4; } @@ -725,7 +725,7 @@ toolbar > .customization-target > toolbarpaletteitem > #history-panelmenu { #home-button.bookmark-item { list-style-image: url("moz-icon://stock/gtk-home?size=menu"); } -#home-button.bookmark-item[disabled="true"] { +:not(toolbarpaletteitem) > #home-button.bookmark-item[disabled="true"] { list-style-image: url("moz-icon://stock/gtk-home?size=menu&state=disabled"); } @@ -1373,11 +1373,11 @@ toolbar[iconsize="small"] #bookmarks-menu-button[starred], -moz-image-region: rect(16px 144px 32px 128px); } -#bookmarks-menu-button[disabled] > .toolbarbutton-icon, -#bookmarks-menu-button[disabled] > .toolbarbutton-menu-dropmarker, -#bookmarks-menu-button[disabled] > .toolbarbutton-menubutton-dropmarker, -#bookmarks-menu-button[disabled] > .toolbarbutton-menubutton-button > .toolbarbutton-icon, -#bookmarks-menu-button > .toolbarbutton-menubutton-button[disabled] > .toolbarbutton-icon { +:not(toolbarpaletteitem) > #bookmarks-menu-button[disabled] > .toolbarbutton-icon, +:not(toolbarpaletteitem) > #bookmarks-menu-button[disabled] > .toolbarbutton-menu-dropmarker, +:not(toolbarpaletteitem) > #bookmarks-menu-button[disabled] > .toolbarbutton-menubutton-dropmarker, +:not(toolbarpaletteitem) > #bookmarks-menu-button[disabled] > .toolbarbutton-menubutton-button > .toolbarbutton-icon, +:not(toolbarpaletteitem) > #bookmarks-menu-button > .toolbarbutton-menubutton-button[disabled] > .toolbarbutton-icon { opacity: .4; } diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css index 0cba21982ef..6c8e1249b38 100644 --- a/browser/themes/osx/browser.css +++ b/browser/themes/osx/browser.css @@ -450,20 +450,20 @@ toolbarbutton.bookmark-item > menupopup { margin: 2px; } -.toolbarbutton-1[disabled="true"] > .toolbarbutton-icon, -.toolbarbutton-1[disabled="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon, -.toolbarbutton-1 > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon, +#main-window:not([customizing]) .toolbarbutton-1[disabled="true"] > .toolbarbutton-icon, +#main-window:not([customizing]) .toolbarbutton-1[disabled="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon, +#main-window:not([customizing]) .toolbarbutton-1 > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon, #restore-button[disabled="true"] > .toolbarbutton-icon { opacity: .4; } @media (-moz-mac-lion-theme) { - .toolbarbutton-1[disabled="true"] > .toolbarbutton-icon, - .toolbarbutton-1[disabled="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon, - .toolbarbutton-1 > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon, + #main-window:not([customizing]) .toolbarbutton-1[disabled="true"] > .toolbarbutton-icon, + #main-window:not([customizing]) .toolbarbutton-1[disabled="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon, + #main-window:not([customizing]) .toolbarbutton-1 > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon, #restore-button[disabled="true"] > .toolbarbutton-icon, - .toolbarbutton-1[disabled="true"] > .toolbarbutton-menu-dropmarker, - .toolbarbutton-1[disabled="true"] > .toolbarbutton-menubutton-dropmarker, + #main-window:not([customizing]) .toolbarbutton-1[disabled="true"] > .toolbarbutton-menu-dropmarker, + #main-window:not([customizing]) .toolbarbutton-1[disabled="true"] > .toolbarbutton-menubutton-dropmarker, .toolbarbutton-1:not(:hover):-moz-window-inactive > .toolbarbutton-icon, .toolbarbutton-1:not(:hover):-moz-window-inactive > .toolbarbutton-badge-container > .toolbarbutton-icon, #restore-button:not(:hover):-moz-window-inactive > .toolbarbutton-icon, @@ -473,9 +473,9 @@ toolbarbutton.bookmark-item > menupopup { opacity: .5; } - .toolbarbutton-1:-moz-window-inactive[disabled="true"] > .toolbarbutton-icon, - .toolbarbutton-1:-moz-window-inactive[disabled="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon, - .toolbarbutton-1:-moz-window-inactive > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon, + #main-window:not([customizing]) .toolbarbutton-1:-moz-window-inactive[disabled="true"] > .toolbarbutton-icon, + #main-window:not([customizing]) .toolbarbutton-1:-moz-window-inactive[disabled="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon, + #main-window:not([customizing]) .toolbarbutton-1:-moz-window-inactive > .toolbarbutton-menubutton-button[disabled="true"] > .toolbarbutton-icon, #restore-button:-moz-window-inactive[disabled="true"] > .toolbarbutton-icon { opacity: .25; } diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index fa3cd7fc6b9..1adbdec2b86 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -343,11 +343,11 @@ menuitem.bookmark-item { list-style-image: url("chrome://browser/skin/Toolbar-inverted.png"); } -.toolbarbutton-1[disabled=true] > .toolbarbutton-icon, -.toolbarbutton-1[disabled=true] > .toolbarbutton-menu-dropmarker, -.toolbarbutton-1[disabled=true] > .toolbarbutton-menubutton-dropmarker, -.toolbarbutton-1[disabled=true] > .toolbarbutton-menubutton-button > .toolbarbutton-icon, -.toolbarbutton-1 > .toolbarbutton-menubutton-button[disabled] > .toolbarbutton-icon { +#main-window:not([customizing]) .toolbarbutton-1[disabled=true] > .toolbarbutton-icon, +#main-window:not([customizing]) .toolbarbutton-1[disabled=true] > .toolbarbutton-menu-dropmarker, +#main-window:not([customizing]) .toolbarbutton-1[disabled=true] > .toolbarbutton-menubutton-dropmarker, +#main-window:not([customizing]) .toolbarbutton-1[disabled=true] > .toolbarbutton-menubutton-button > .toolbarbutton-icon, +#main-window:not([customizing]) .toolbarbutton-1 > .toolbarbutton-menubutton-button[disabled] > .toolbarbutton-icon, opacity: .4; }