mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 777680 - "Bookmark This Page" in context menu should be highlighted. r=mak
This commit is contained in:
parent
22e3853dcf
commit
a27502d2e7
@ -32,7 +32,7 @@
|
||||
command="Browser:Stop"/>
|
||||
<menuitem id="context-bookmarkpage"
|
||||
class="menuitem-iconic"
|
||||
tooltiptext="&bookmarkPageCmd2.label;"
|
||||
observes="bookmarkThisPageBroadcaster"
|
||||
aria-label="&bookmarkPageCmd2.label;"
|
||||
oncommand="gContextMenu.bookmarkThisPage();"/>
|
||||
</menugroup>
|
||||
|
@ -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":
|
||||
|
@ -821,6 +821,8 @@
|
||||
ondrop="PlacesMenuDNDHandler.onDrop(event);"
|
||||
cui-areatype="toolbar"
|
||||
oncommand="BookmarkingUI.onCommand(event);">
|
||||
<observes element="bookmarkThisPageBroadcaster" attribute="starred"/>
|
||||
<observes element="bookmarkThisPageBroadcaster" attribute="buttontooltiptext"/>
|
||||
<menupopup id="BMB_bookmarksPopup"
|
||||
class="cui-widget-panel cui-widget-panelview cui-widget-panelWithFooter PanelUI-subView"
|
||||
placespopup="true"
|
||||
|
@ -51,6 +51,10 @@ nsContextMenu.prototype = {
|
||||
this.isContentSelected = !this.selectionInfo.docSelectionIsCollapsed;
|
||||
this.onPlainTextLink = false;
|
||||
|
||||
let bookmarkPage = document.getElementById("context-bookmarkpage");
|
||||
if (bookmarkPage)
|
||||
BookmarkingUI.onCurrentPageContextPopupShowing();
|
||||
|
||||
// Initialize (disable/remove) menu items.
|
||||
this.initItems();
|
||||
|
||||
@ -269,10 +273,14 @@ nsContextMenu.prototype = {
|
||||
|
||||
initMiscItems: function CM_initMiscItems() {
|
||||
// Use "Bookmark This Link" if on a link.
|
||||
this.showItem("context-bookmarkpage",
|
||||
let bookmarkPage = document.getElementById("context-bookmarkpage");
|
||||
this.showItem(bookmarkPage,
|
||||
!(this.isContentSelected || this.onTextInput || this.onLink ||
|
||||
this.onImage || this.onVideo || this.onAudio || this.onSocial ||
|
||||
this.onCanvas));
|
||||
bookmarkPage.setAttribute("tooltiptext", bookmarkPage.getAttribute("buttontooltiptext"));
|
||||
bookmarkPage.disabled = bookmarkPage.hasAttribute("stardisabled");
|
||||
|
||||
this.showItem("context-bookmarklink", (this.onLink && !this.onMailtoLink &&
|
||||
!this.onSocial) || this.onPlainTextLink);
|
||||
this.showItem("context-keywordfield",
|
||||
|
@ -68,6 +68,18 @@
|
||||
list-style-image: url("chrome://browser/skin/content-contextmenu.svg#bookmark-disabled");
|
||||
}
|
||||
|
||||
#context-bookmarkpage[starred=true] {
|
||||
list-style-image: url("chrome://browser/skin/content-contextmenu.svg#bookmarked");
|
||||
}
|
||||
|
||||
#context-bookmarkpage[starred=true][_moz-menuactive=true] {
|
||||
list-style-image: url("chrome://browser/skin/content-contextmenu.svg#bookmarked-active");
|
||||
}
|
||||
|
||||
#context-bookmarkpage[starred=true][disabled=true] {
|
||||
list-style-image: url("chrome://browser/skin/content-contextmenu.svg#bookmarked-disabled");
|
||||
}
|
||||
|
||||
#context-back:-moz-locale-dir(rtl),
|
||||
#context-forward:-moz-locale-dir(rtl),
|
||||
#context-reload:-moz-locale-dir(rtl) {
|
||||
|
Loading…
Reference in New Issue
Block a user