Bug 616014 - Add close button to the add-on bar. r=dao

This commit is contained in:
Dietrich Ayala 2010-12-09 20:09:05 +01:00
parent 56cb4f4bc2
commit 15684f4296
7 changed files with 98 additions and 2 deletions

View File

@ -973,8 +973,12 @@
context="toolbar-context-menu" toolboxid="navigator-toolbox"
mode="icons" iconsize="small" defaulticonsize="small"
lockiconsize="true"
defaultset="status-bar"
customizable="true" align="right">
defaultset="addonbar-closebutton,addonbar-spring,status-bar"
customizable="true">
<toolbarbutton id="addonbar-closebutton"
tooltiptext="&addonBarCloseButton.tooltip;"
oncommand="setToolbarVisibility(this.parentNode, false);"/>
<hbox id="addonbar-spring" flex="1"/>
<statusbar id="status-bar"/>
</toolbar>
</vbox>

View File

@ -232,6 +232,7 @@ _BROWSER_FILES = \
app_bug575561.html \
app_subframe_bug575561.html \
browser_contentAreaClick.js \
browser_addon_bar_close_button.js \
$(NULL)
# compartment-disabled

View File

@ -0,0 +1,51 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is browser add-on bar test code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dietrich Ayala <dietrich@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function test() {
let addonbar = document.getElementById("addon-bar");
ok(addonbar.collapsed, "addon bar is collapsed by default");
// make add-on bar visible
setToolbarVisibility(addonbar, true);
ok(!addonbar.collapsed, "addon bar is not collapsed after toggle");
// click the close button
let closeButton = document.getElementById("addonbar-closebutton");
EventUtils.synthesizeMouseAtCenter(closeButton, {});
// confirm addon bar is closed
ok(addonbar.collapsed, "addon bar is collapsed after clicking close button");
}

View File

@ -548,3 +548,5 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY syncSyncNowItem.label "Sync Now">
<!ENTITY syncSyncNowItem.accesskey "S">
<!ENTITY syncToolbarButton.label "Sync">
<!ENTITY addonBarCloseButton.tooltip "Close Add-on Bar">

View File

@ -1777,3 +1777,8 @@ panel[dimmed="true"] {
browser[tabmodalPromptShowing] {
filter: url("chrome://browser/skin/effects.svg#blurAndDesaturate");
}
/* Add-on bar close button */
#addonbar-closebutton {
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
}

View File

@ -2266,6 +2266,22 @@ panel[dimmed="true"] {
-moz-appearance: statusbar;
}
/* Add-on bar close button */
#addonbar-closebutton {
padding: 0;
margin: 0 4px;
list-style-image: url("chrome://global/skin/icons/closetab.png");
border: none;
}
#addonbar-closebutton:hover {
list-style-image: url("chrome://global/skin/icons/closetab-hover.png");
}
#addonbar-closebutton:hover:active {
list-style-image: url("chrome://global/skin/icons/closetab-active.png");
}
browser[tabmodalPromptShowing] {
filter: url("chrome://browser/skin/effects.svg#blurAndDesaturate");
}

View File

@ -2126,3 +2126,20 @@ panel[dimmed="true"] {
browser[tabmodalPromptShowing] {
filter: url("chrome://browser/skin/effects.svg#blurAndDesaturate");
}
/* Add-on bar close button */
#addonbar-closebutton {
border: none;
padding: 3px 5px;
list-style-image: url("chrome://global/skin/icons/close.png");
-moz-appearance: none;
-moz-image-region: rect(0, 16px, 16px, 0);
}
#addonbar-closebutton:hover {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
#addonbar-closebutton:hover:active {
-moz-image-region: rect(0, 48px, 16px, 32px);
}