diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js
index 6420a5c0263b..485d243fd905 100644
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -312,8 +312,8 @@ var PlacesCommandHook = {
// 1. the bookmarks menu button
// 2. the page-proxy-favicon
// 3. the content area
- if (BookmarksMenuButton.anchor) {
- StarUI.showEditBookmarkPopup(itemId, BookmarksMenuButton.anchor,
+ if (BookmarkingUI.anchor) {
+ StarUI.showEditBookmarkPopup(itemId, BookmarkingUI.anchor,
"bottomcenter topright");
return;
}
@@ -991,12 +991,14 @@ let PlacesToolbarHelper = {
};
////////////////////////////////////////////////////////////////////////////////
-//// BookmarksMenuButton
+//// BookmarkingUI
/**
- * Handles the bookmarks menu-button in the toolbar.
+ * Handles the bookmarks star button in the URL bar, as well as the bookmark
+ * menu button.
*/
-let BookmarksMenuButton = {
+
+let BookmarkingUI = {
get button() {
if (!this._button) {
this._button = document.getElementById("bookmarks-menu-button");
@@ -1005,22 +1007,18 @@ let BookmarksMenuButton = {
},
get star() {
- if (!this._star && this.button) {
- this._star = document.getAnonymousElementByAttribute(this.button,
- "anonid",
- "button");
+ if (!this._star) {
+ this._star = document.getElementById("star-button");
}
return this._star;
},
get anchor() {
- if (!this._anchor && this.star && isElementVisible(this.star)) {
+ if (this.star && isElementVisible(this.star)) {
// Anchor to the icon, so the panel looks more natural.
- this._anchor = document.getAnonymousElementByAttribute(this.star,
- "class",
- "toolbarbutton-icon");
+ return this.star;
}
- return this._anchor;
+ return null;
},
STATUS_UPDATING: -1,
@@ -1029,9 +1027,9 @@ let BookmarksMenuButton = {
get status() {
if (this._pendingStmt)
return this.STATUS_UPDATING;
- return this.button &&
- this.button.hasAttribute("starred") ? this.STATUS_STARRED
- : this.STATUS_UNSTARRED;
+ return this.star &&
+ this.star.hasAttribute("starred") ? this.STATUS_STARRED
+ : this.STATUS_UNSTARRED;
},
get _starredTooltip()
@@ -1055,11 +1053,11 @@ let BookmarksMenuButton = {
* reasons.
*/
_popupNeedsUpdate: true,
- onToolbarVisibilityChange: function BMB_onToolbarVisibilityChange() {
+ onToolbarVisibilityChange: function BUI_onToolbarVisibilityChange() {
this._popupNeedsUpdate = true;
},
- onPopupShowing: function BMB_onPopupShowing(event) {
+ onPopupShowing: function BUI_onPopupShowing(event) {
// Don't handle events for submenus.
if (event.target != event.currentTarget)
return;
@@ -1093,26 +1091,21 @@ let BookmarksMenuButton = {
/**
* Handles star styling based on page proxy state changes.
*/
- onPageProxyStateChanged: function BMB_onPageProxyStateChanged(aState) {
+ onPageProxyStateChanged: function BUI_onPageProxyStateChanged(aState) {
if (!this.star) {
return;
}
if (aState == "invalid") {
this.star.setAttribute("disabled", "true");
- this.button.removeAttribute("starred");
+ this.star.removeAttribute("starred");
}
else {
this.star.removeAttribute("disabled");
}
- this._updateStyle();
},
- _updateStyle: function BMB__updateStyle() {
- if (!this.star) {
- return;
- }
-
+ _updateToolbarStyle: function BUI__updateToolbarStyle() {
let personalToolbar = document.getElementById("PersonalToolbar");
let onPersonalToolbar = this.button.parentNode == personalToolbar ||
this.button.parentNode.parentNode == personalToolbar;
@@ -1127,7 +1120,7 @@ let BookmarksMenuButton = {
}
},
- _uninitView: function BMB__uninitView() {
+ _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,
// so kill current view and let popupshowing generate a new one.
@@ -1136,24 +1129,22 @@ let BookmarksMenuButton = {
}
},
- customizeStart: function BMB_customizeStart() {
+ customizeStart: function BUI_customizeStart() {
this._uninitView();
},
- customizeChange: function BMB_customizeChange() {
- this._updateStyle();
+ customizeChange: function BUI_customizeChange() {
+ this._updateToolbarStyle();
},
- customizeDone: function BMB_customizeDone() {
+ customizeDone: function BUI_customizeDone() {
delete this._button;
- delete this._star;
- delete this._anchor;
this.onToolbarVisibilityChange();
- this._updateStyle();
+ this._updateToolbarStyle();
},
_hasBookmarksObserver: false,
- uninit: function BMB_uninit() {
+ uninit: function BUI_uninit() {
this._uninitView();
if (this._hasBookmarksObserver) {
@@ -1166,8 +1157,8 @@ let BookmarksMenuButton = {
}
},
- updateStarState: function BMB_updateStarState() {
- if (!this.button || (this._uri && gBrowser.currentURI.equals(this._uri))) {
+ updateStarState: function BUI_updateStarState() {
+ if (!this.star || (this._uri && gBrowser.currentURI.equals(this._uri))) {
return;
}
@@ -1215,22 +1206,22 @@ let BookmarksMenuButton = {
}, this);
},
- _updateStar: function BMB__updateStar() {
- if (!this.button) {
+ _updateStar: function BUI__updateStar() {
+ if (!this.star) {
return;
}
if (this._itemIds.length > 0) {
- this.button.setAttribute("starred", "true");
- this.button.setAttribute("tooltiptext", this._starredTooltip);
+ this.star.setAttribute("starred", "true");
+ this.star.setAttribute("tooltiptext", this._starredTooltip);
}
else {
- this.button.removeAttribute("starred");
- this.button.setAttribute("tooltiptext", this._unstarredTooltip);
+ this.star.removeAttribute("starred");
+ this.star.setAttribute("tooltiptext", this._unstarredTooltip);
}
},
- onCommand: function BMB_onCommand(aEvent) {
+ onCommand: function BUI_onCommand(aEvent) {
if (aEvent.target != aEvent.currentTarget) {
return;
}
@@ -1241,12 +1232,8 @@ let BookmarksMenuButton = {
},
// nsINavBookmarkObserver
- onItemAdded: function BMB_onItemAdded(aItemId, aParentId, aIndex, aItemType,
+ onItemAdded: function BUI_onItemAdded(aItemId, aParentId, aIndex, aItemType,
aURI) {
- if (!this.button) {
- return;
- }
-
if (aURI && aURI.equals(this._uri)) {
// If a new bookmark has been added to the tracked uri, register it.
if (this._itemIds.indexOf(aItemId) == -1) {
@@ -1256,11 +1243,7 @@ let BookmarksMenuButton = {
}
},
- onItemRemoved: function BMB_onItemRemoved(aItemId) {
- if (!this.button) {
- return;
- }
-
+ onItemRemoved: function BUI_onItemRemoved(aItemId) {
let index = this._itemIds.indexOf(aItemId);
// If one of the tracked bookmarks has been removed, unregister it.
if (index != -1) {
@@ -1269,12 +1252,8 @@ let BookmarksMenuButton = {
}
},
- onItemChanged: function BMB_onItemChanged(aItemId, aProperty,
+ onItemChanged: function BUI_onItemChanged(aItemId, aProperty,
aIsAnnotationProperty, aNewValue) {
- if (!this.button) {
- return;
- }
-
if (aProperty == "uri") {
let index = this._itemIds.indexOf(aItemId);
// If the changed bookmark was tracked, check if it is now pointing to
@@ -1299,5 +1278,5 @@ let BookmarksMenuButton = {
QueryInterface: XPCOMUtils.generateQI([
Ci.nsINavBookmarkObserver
- ]),
+ ])
};
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css
index 579546d43535..ff4e0da877a2 100644
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -308,20 +308,18 @@ toolbarbutton.bookmark-item {
max-width: 13em;
}
+%ifdef MENUBAR_CAN_AUTOHIDE
+#toolbar-menubar:not([autohide="true"]) ~ toolbar > #bookmarks-menu-button,
+#toolbar-menubar:not([autohide="true"]) > #bookmarks-menu-button {
+ display: none;
+}
+%endif
+
#editBMPanel_tagsSelector {
/* override default listbox width from xul.css */
width: auto;
}
-/* The star doesn't make sense as text */
-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 {
- display: none;
-}
-
menupopup[emptyplacesresult="true"] > .hide-if-empty-places-result {
display: none;
}
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 61650a9ec614..9314ffd7cfa8 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1313,7 +1313,7 @@ var gBrowserInit = {
} catch (ex) {
}
- BookmarksMenuButton.uninit();
+ BookmarkingUI.uninit();
TabsOnTop.uninit();
@@ -2231,7 +2231,7 @@ function UpdatePageProxyState()
function SetPageProxyState(aState)
{
- BookmarksMenuButton.onPageProxyStateChanged(aState);
+ BookmarkingUI.onPageProxyStateChanged(aState);
if (!gURLBar)
return;
@@ -3327,7 +3327,7 @@ function BrowserCustomizeToolbar() {
CombinedStopReload.uninit();
PlacesToolbarHelper.customizeStart();
- BookmarksMenuButton.customizeStart();
+ BookmarkingUI.customizeStart();
DownloadsButton.customizeStart();
TabsInTitlebar.allowedBy("customizing-toolbars", false);
@@ -3391,7 +3391,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
}
PlacesToolbarHelper.customizeDone();
- BookmarksMenuButton.customizeDone();
+ BookmarkingUI.customizeDone();
DownloadsButton.customizeDone();
// The url bar splitter state is dependent on whether stop/reload
@@ -3404,7 +3404,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
if (gURLBar) {
URLBarSetURI();
XULBrowserWindow.asyncUpdateUI();
- BookmarksMenuButton.updateStarState();
+ BookmarkingUI.updateStarState();
SocialMark.updateMarkState();
SocialShare.update();
}
@@ -3433,7 +3433,7 @@ function BrowserToolboxCustomizeChange(aType) {
break;
default:
gHomeButton.updatePersonalToolbarStyle();
- BookmarksMenuButton.customizeChange();
+ BookmarkingUI.customizeChange();
}
}
@@ -3879,7 +3879,7 @@ var XULBrowserWindow = {
URLBarSetURI(aLocationURI);
// Update starring UI
- BookmarksMenuButton.updateStarState();
+ BookmarkingUI.updateStarState();
SocialMark.updateMarkState();
SocialShare.update();
}
@@ -4507,7 +4507,7 @@ function setToolbarVisibility(toolbar, isVisible) {
document.persist(toolbar.id, hidingAttribute);
PlacesToolbarHelper.init();
- BookmarksMenuButton.onToolbarVisibilityChange();
+ BookmarkingUI.onToolbarVisibilityChange();
gBrowser.updateWindowResizers();
#ifdef MENUBAR_CAN_AUTOHIDE
diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul
index ba1858f783ee..db4b6d7ecaf1 100644
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -581,6 +581,9 @@
hidden="true"
tooltiptext="&pageReportIcon.tooltip;"
onclick="gPopupBlockerObserver.onReportButtonClick(event);"/>
+
+ ondrop="PlacesMenuDNDHandler.onDrop(event);">