From a27502d2e77e2102758248f9936d4305a3702547 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Sat, 13 Jun 2015 11:52:17 -0400 Subject: [PATCH] Bug 777680 - "Bookmark This Page" in context menu should be highlighted. r=mak --- browser/base/content/browser-context.inc | 2 +- browser/base/content/browser-places.js | 24 ++++++++++++++--------- browser/base/content/browser.xul | 2 ++ browser/base/content/nsContextMenu.js | 10 +++++++++- browser/themes/shared/contextmenu.inc.css | 12 ++++++++++++ 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc index d7c7992debe..15281d1b74b 100644 --- a/browser/base/content/browser-context.inc +++ b/browser/base/content/browser-context.inc @@ -32,7 +32,7 @@ command="Browser:Stop"/> diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index d219f9a81fc..da14a5c3d0d 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -1344,11 +1344,13 @@ let BookmarkingUI = { if (aState == "invalid") { this.star.setAttribute("disabled", "true"); - this.button.removeAttribute("starred"); - this.button.setAttribute("buttontooltiptext", ""); + this.broadcaster.setAttribute("stardisabled", "true"); + this.broadcaster.removeAttribute("starred"); + this.broadcaster.setAttribute("buttontooltiptext", ""); } else { this.star.removeAttribute("disabled"); + this.broadcaster.removeAttribute("stardisabled"); this._updateStar(); } this._updateToolbarStyle(); @@ -1523,23 +1525,23 @@ let BookmarkingUI = { _updateStar: function BUI__updateStar() { if (!this._shouldUpdateStarState()) { - if (this.button.hasAttribute("starred")) { - this.button.removeAttribute("starred"); - this.button.removeAttribute("buttontooltiptext"); + if (this.broadcaster.hasAttribute("starred")) { + this.broadcaster.removeAttribute("starred"); + this.broadcaster.removeAttribute("buttontooltiptext"); } return; } if (this._itemIds.length > 0) { - this.button.setAttribute("starred", "true"); - this.button.setAttribute("buttontooltiptext", this._starredTooltip); + this.broadcaster.setAttribute("starred", "true"); + this.broadcaster.setAttribute("buttontooltiptext", this._starredTooltip); if (this.button.getAttribute("overflowedItem") == "true") { this.button.setAttribute("label", this._starButtonOverflowedStarredLabel); } } else { - this.button.removeAttribute("starred"); - this.button.setAttribute("buttontooltiptext", this._unstarredTooltip); + this.broadcaster.removeAttribute("starred"); + this.broadcaster.setAttribute("buttontooltiptext", this._unstarredTooltip); if (this.button.getAttribute("overflowedItem") == "true") { this.button.setAttribute("label", this._starButtonOverflowedLabel); } @@ -1671,6 +1673,10 @@ let BookmarkingUI = { } }, + onCurrentPageContextPopupShowing() { + this._updateBookmarkPageMenuItem(); + }, + handleEvent: function BUI_handleEvent(aEvent) { switch (aEvent.type) { case "ViewShowing": diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index e419ecba3a4..485d84c769f 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -821,6 +821,8 @@ ondrop="PlacesMenuDNDHandler.onDrop(event);" cui-areatype="toolbar" oncommand="BookmarkingUI.onCommand(event);"> + +