From becd71a8600c7229f765d8eda21c1843c4f4adf1 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 16 Nov 2018 20:59:11 +0800 Subject: Issue #638 - Part 1: Provide a visual indicator for muting/unmuting tabs --- application/palemoon/app/profile/palemoon.js | 4 + application/palemoon/base/content/tabbrowser.xml | 140 ++++++++++++++++++++- application/palemoon/themes/linux/browser.css | 73 +++++++++++ application/palemoon/themes/linux/jar.mn | 2 + application/palemoon/themes/osx/browser.css | 73 +++++++++++ application/palemoon/themes/osx/jar.mn | 2 + .../themes/shared/tabbrowser/tab-audio-small.svg | 85 +++++++++++++ .../themes/shared/tabbrowser/tab-audio.svg | 86 +++++++++++++ application/palemoon/themes/windows/browser.css | 72 +++++++++++ application/palemoon/themes/windows/jar.mn | 2 + 10 files changed, 538 insertions(+), 1 deletion(-) create mode 100644 application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg create mode 100644 application/palemoon/themes/shared/tabbrowser/tab-audio.svg diff --git a/application/palemoon/app/profile/palemoon.js b/application/palemoon/app/profile/palemoon.js index 15accd146..e53b1693b 100644 --- a/application/palemoon/app/profile/palemoon.js +++ b/application/palemoon/app/profile/palemoon.js @@ -463,6 +463,10 @@ pref("browser.tabs.closeButtons", 1); // false return to the adjacent tab (old default) pref("browser.tabs.selectOwnerOnClose", true); +pref("browser.tabs.showAudioPlayingIcon", true); +// This should match Chromium's audio indicator delay. +pref("browser.tabs.delayHidingAudioPlayingIconMS", 3000); + pref("browser.allTabs.previews", true); pref("browser.ctrlTab.previews", true); pref("browser.ctrlTab.recentlyUsedLimit", 7); diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index dc6cb0a9d..0a2a1c3f5 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -3347,6 +3347,78 @@ tab.setAttribute("titlechanged", "true"); ]]> + + + + + { + tab.removeAttribute("soundplaying-scheduledremoval"); + tab.removeAttribute("soundplaying"); + this._tabAttrModified(tab, ["soundplaying", "soundplaying-scheduledremoval"]); + }, removalDelay); + } + ]]> + + + + + + + @@ -4762,6 +4834,10 @@ xbl:inherits="value=label,crop,accesskey,fadein,pinned,selected" class="tab-text tab-label" role="presentation"/> + @@ -4782,9 +4858,59 @@ false + + + null false 0 + + + + + + + @@ -4843,7 +4969,8 @@ if (this.selected) { this.style.MozUserFocus = 'ignore'; this.clientTop; // just using this to flush style updates - } else if (this.mOverCloseButton) { + } else if (this.mOverCloseButton || + this._overPlayingIcon) { // Prevent tabbox.xml from selecting the tab. event.stopPropagation(); } @@ -4852,6 +4979,17 @@ this.style.MozUserFocus = ''; + + + diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index c6587babc..cf48dc819 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -1758,6 +1758,79 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- -moz-margin-end: -1px; } +/* Tab sound indicator */ +.tab-icon-sound { + -moz-margin-start: 4px; + width: 16px; + height: 16px; + padding: 0; +} + +.tab-icon-sound:not(:-moz-any([soundplaying],[muted])), +.tab-icon-sound[pinned] { + display: none; +} + +.tab-icon-sound[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); +} + +.tab-icon-sound[soundplaying]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-hover"); +} + +.tab-icon-sound[soundplaying]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); +} + +.tab-icon-sound[muted], +.tab-icon-sound[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); +} + +.tab-icon-sound[muted]:hover, +.tab-icon-sound[blocked]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-hover"); +} + +.tab-icon-sound[muted]:hover:active, +.tab-icon-sound[blocked]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-pressed"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-hover"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-pressed"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked], +#TabsToolbar[brighttext] .tab-icon-sound[muted] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover, +#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-hover"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover:active, +#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-pressed"); +} + +.tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover), +.tab-icon-overlay[soundplaying-scheduledremoval]:not([muted]):not(:hover) { + transition: opacity .3s linear var(--soundplaying-removal-delay); + opacity: 0; +} + /* Tabstrip new tab button */ .tabs-newtab-button, #TabsToolbar > #new-tab-button , diff --git a/application/palemoon/themes/linux/jar.mn b/application/palemoon/themes/linux/jar.mn index 8b2e9dc77..8cb6878e8 100644 --- a/application/palemoon/themes/linux/jar.mn +++ b/application/palemoon/themes/linux/jar.mn @@ -123,6 +123,8 @@ browser.jar: skin/classic/browser/tabbrowser/tab.png (tabbrowser/tab.png) skin/classic/browser/tabbrowser/tab-overflow-border.png (tabbrowser/tab-overflow-border.png) skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png) + skin/classic/browser/tabbrowser/tab-audio.svg (../shared/tabbrowser/tab-audio.svg) + skin/classic/browser/tabbrowser/tab-audio-small.svg (../shared/tabbrowser/tab-audio-small.svg) #ifdef MOZ_SERVICES_SYNC skin/classic/browser/sync-16-throbber.png skin/classic/browser/sync-16.png diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index a915af3a3..d9b7d1271 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1821,6 +1821,79 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- } } +/* Tab sound indicator */ +.tab-icon-sound { + -moz-margin-start: 4px; + width: 16px; + height: 16px; + padding: 0; +} + +.tab-icon-sound:not(:-moz-any([soundplaying],[muted])), +.tab-icon-sound[pinned] { + display: none; +} + +.tab-icon-sound[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); +} + +.tab-icon-sound[soundplaying]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-hover"); +} + +.tab-icon-sound[soundplaying]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); +} + +.tab-icon-sound[muted], +.tab-icon-sound[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); +} + +.tab-icon-sound[muted]:hover, +.tab-icon-sound[blocked]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-hover"); +} + +.tab-icon-sound[muted]:hover:active, +.tab-icon-sound[blocked]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-pressed"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-hover"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-pressed"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked], +#TabsToolbar[brighttext] .tab-icon-sound[muted] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover, +#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-hover"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover:active, +#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-pressed"); +} + +.tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover), +.tab-icon-overlay[soundplaying-scheduledremoval]:not([muted]):not(:hover) { + transition: opacity .3s linear var(--soundplaying-removal-delay); + opacity: 0; +} + /* Tab scrollbox arrow, tabstrip new tab and all-tabs buttons */ .tabbrowser-arrowscrollbox > .scrollbutton-up, diff --git a/application/palemoon/themes/osx/jar.mn b/application/palemoon/themes/osx/jar.mn index a66563989..1a11d0a30 100644 --- a/application/palemoon/themes/osx/jar.mn +++ b/application/palemoon/themes/osx/jar.mn @@ -166,6 +166,8 @@ browser.jar: skin/classic/browser/tabbrowser/tab-arrow-left-inverted.png (tabbrowser/tab-arrow-left-inverted.png) skin/classic/browser/tabbrowser/tab-overflow-border.png (tabbrowser/tab-overflow-border.png) skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png) + skin/classic/browser/tabbrowser/tab-audio.svg (../shared/tabbrowser/tab-audio.svg) + skin/classic/browser/tabbrowser/tab-audio-small.svg (../shared/tabbrowser/tab-audio-small.svg) #ifdef MOZ_SERVICES_SYNC skin/classic/browser/sync-throbber.png skin/classic/browser/sync-16.png diff --git a/application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg b/application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg new file mode 100644 index 000000000..da4ad3ef9 --- /dev/null +++ b/application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/palemoon/themes/shared/tabbrowser/tab-audio.svg b/application/palemoon/themes/shared/tabbrowser/tab-audio.svg new file mode 100644 index 000000000..1949c0595 --- /dev/null +++ b/application/palemoon/themes/shared/tabbrowser/tab-audio.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index 45f0e066c..aa7afa7a6 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -2018,6 +2018,78 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- list-style-image: url("chrome://global/skin/icons/close-inverted.svg"); } +/* Tab sound indicator */ +.tab-icon-sound { + -moz-margin-start: 4px; + width: 16px; + height: 16px; + padding: 0; +} + +.tab-icon-sound:not(:-moz-any([soundplaying],[muted])), +.tab-icon-sound[pinned] { + display: none; +} + +.tab-icon-sound[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); +} + +.tab-icon-sound[soundplaying]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-hover"); +} + +.tab-icon-sound[soundplaying]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); +} + +.tab-icon-sound[muted], +.tab-icon-sound[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); +} + +.tab-icon-sound[muted]:hover, +.tab-icon-sound[blocked]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-hover"); +} + +.tab-icon-sound[muted]:hover:active, +.tab-icon-sound[blocked]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-pressed"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-hover"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-pressed"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked], +#TabsToolbar[brighttext] .tab-icon-sound[muted] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover, +#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-hover"); +} + +#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover:active, +#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover:active { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-pressed"); +} + +.tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover) { + transition: opacity .3s linear var(--soundplaying-removal-delay); + opacity: 0; +} + /* Tab scrollbox arrow, tabstrip new tab and all-tabs buttons */ .tabbrowser-arrowscrollbox > .scrollbutton-up, diff --git a/application/palemoon/themes/windows/jar.mn b/application/palemoon/themes/windows/jar.mn index 0a4342d40..984de5384 100644 --- a/application/palemoon/themes/windows/jar.mn +++ b/application/palemoon/themes/windows/jar.mn @@ -151,6 +151,8 @@ browser.jar: skin/classic/browser/tabbrowser/tab-arrow-left-inverted.png (tabbrowser/tab-arrow-left-inverted.png) skin/classic/browser/tabbrowser/tab-overflow-border.png (tabbrowser/tab-overflow-border.png) skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png) + skin/classic/browser/tabbrowser/tab-audio.svg (../shared/tabbrowser/tab-audio.svg) + skin/classic/browser/tabbrowser/tab-audio-small.svg (../shared/tabbrowser/tab-audio-small.svg) #ifdef MOZ_SERVICES_SYNC skin/classic/browser/sync-throbber.png skin/classic/browser/sync-16.png -- cgit v1.2.3 From ae48428aa3f5e45db068106e825e23e80f1a1a55 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 16 Nov 2018 21:40:17 +0800 Subject: Issue #638 - Part 2: Add tooltip to mute/unmute buttons --- application/palemoon/base/content/tabbrowser.xml | 22 +++++++++++++++++++--- .../en-US/chrome/browser/tabbrowser.properties | 4 ++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 0a2a1c3f5..d73f87bd6 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -3084,9 +3084,25 @@ event.preventDefault(); return; } - event.target.setAttribute("label", tab.mOverCloseButton ? - tab.getAttribute("closetabtext") : - tab.getAttribute("label")); + + var stringID, label; + if (tab.mOverCloseButton) { + stringID = "tabs.closeTab"; + } else if (tab._overPlayingIcon) { + if (tab.linkedBrowser.audioBlocked) { + stringID = "tabs.unblockAudio.tooltip"; + } else { + stringID = tab.linkedBrowser.audioMuted ? + "tabs.unmuteAudio.tooltip" : + "tabs.muteAudio.tooltip"; + } + } else { + label = tab.getAttribute("label"); + } + if (stringID && !label) { + label = this.mStringBundle.getString(stringID); + } + event.target.setAttribute("label", label); ]]> diff --git a/application/palemoon/locales/en-US/chrome/browser/tabbrowser.properties b/application/palemoon/locales/en-US/chrome/browser/tabbrowser.properties index 0d21d4d14..a4a0be0a0 100644 --- a/application/palemoon/locales/en-US/chrome/browser/tabbrowser.properties +++ b/application/palemoon/locales/en-US/chrome/browser/tabbrowser.properties @@ -24,3 +24,7 @@ tabs.closeWarningTitle=Confirm close tabs.closeWarningMultipleTabs=You are about to close %S tabs. Are you sure you want to continue? tabs.closeButtonMultiple=Close tabs tabs.closeWarningPromptMe=Warn me when I attempt to close multiple tabs + +tabs.muteAudio.tooltip=Mute tab +tabs.unmuteAudio.tooltip=Unmute tab +tabs.unblockAudio.tooltip=Play tab -- cgit v1.2.3 From 15afe680798ed70ded4e02621bb0c6229d5e5fb5 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 16 Nov 2018 21:53:49 +0800 Subject: Issue #638 - Part 3: Add a keyboard shortcut for toggling the tab mute state --- application/palemoon/base/content/browser-sets.inc | 2 ++ application/palemoon/locales/en-US/chrome/browser/browser.dtd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/application/palemoon/base/content/browser-sets.inc b/application/palemoon/base/content/browser-sets.inc index 25794a65c..78fce2670 100644 --- a/application/palemoon/base/content/browser-sets.inc +++ b/application/palemoon/base/content/browser-sets.inc @@ -32,6 +32,7 @@ + @@ -212,6 +213,7 @@ + diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.dtd b/application/palemoon/locales/en-US/chrome/browser/browser.dtd index 2d80c8078..8632b44b4 100644 --- a/application/palemoon/locales/en-US/chrome/browser/browser.dtd +++ b/application/palemoon/locales/en-US/chrome/browser/browser.dtd @@ -507,6 +507,8 @@ you can use these alternative items. Otherwise, their values should be empty. - + + -- cgit v1.2.3 From 719234847ecbab2fe8b4b4c2f153fa0c12bffbc6 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 16 Nov 2018 22:40:59 +0800 Subject: Issue #638 - Part 4: Add tab sound icon to tab drop-down list --- application/palemoon/base/content/tabbrowser.xml | 18 ++++++++++++++++++ application/palemoon/themes/linux/browser.css | 3 +++ application/palemoon/themes/osx/browser.css | 3 +++ application/palemoon/themes/windows/browser.css | 3 +++ 4 files changed, 27 insertions(+) diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index d73f87bd6..073a12f16 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -5111,6 +5111,24 @@ aMenuitem.setAttribute("selected", "true"); else aMenuitem.removeAttribute("selected"); + + function addEndImage() { + let endImage = document.createElement("image"); + endImage.setAttribute("class", "alltabs-endimage"); + let endImageContainer = document.createElement("hbox"); + endImageContainer.setAttribute("align", "center"); + endImageContainer.setAttribute("pack", "center"); + endImageContainer.appendChild(endImage); + aMenuitem.appendChild(endImageContainer); + return endImage; + } + + if (aMenuitem.firstChild) + aMenuitem.firstChild.remove(); + if (aTab.hasAttribute("muted")) + addEndImage().setAttribute("muted", "true"); + else if (aTab.hasAttribute("soundplaying")) + addEndImage().setAttribute("soundplaying", "true"); ]]> diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index cf48dc819..3439bb3fb 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -1771,6 +1771,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- display: none; } +.alltabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } @@ -1783,6 +1784,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); } +.alltabs-endimage[muted], +.alltabs-endimage[blocked], .tab-icon-sound[muted], .tab-icon-sound[blocked] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index d9b7d1271..754740562 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1834,6 +1834,7 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- display: none; } +.alltabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } @@ -1846,6 +1847,8 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); } +.alltabs-endimage[muted], +.alltabs-endimage[blocked], .tab-icon-sound[muted], .tab-icon-sound[blocked] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index aa7afa7a6..26d096055 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -2031,6 +2031,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- display: none; } +.alltabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } @@ -2043,6 +2044,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); } +.alltabs-endimage[muted], +.alltabs-endimage[blocked], .tab-icon-sound[muted], .tab-icon-sound[blocked] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); -- cgit v1.2.3 From eff89e1c9d7ccfbfb09fb615848b7e288e8b2c7d Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 16 Nov 2018 22:58:46 +0800 Subject: Issue #638 - Part 5: Add mute/unmute option to tab context menu --- application/palemoon/base/content/browser.js | 40 ++++++++++++++++++++++ application/palemoon/base/content/browser.xul | 1 + .../en-US/chrome/browser/browser.properties | 5 +++ 3 files changed, 46 insertions(+) diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 4167f186c..5d44f0066 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -7021,6 +7021,17 @@ function restoreLastSession() { var TabContextMenu = { contextTab: null, + _updateToggleMuteMenuItem(aTab, aConditionFn) { + ["muted", "soundplaying"].forEach(attr => { + if (!aConditionFn || aConditionFn(attr)) { + if (aTab.hasAttribute(attr)) { + aTab.toggleMuteMenuItem.setAttribute(attr, "true"); + } else { + aTab.toggleMuteMenuItem.removeAttribute(attr); + } + } + }); + }, updateContextMenu: function updateContextMenu(aPopupMenu) { this.contextTab = aPopupMenu.triggerNode.localName == "tab" ? aPopupMenu.triggerNode : gBrowser.selectedTab; @@ -7067,6 +7078,35 @@ var TabContextMenu = { bookmarkAllTabs.hidden = this.contextTab.pinned; if (!bookmarkAllTabs.hidden) PlacesCommandHook.updateBookmarkAllTabsCommand(); + + // Adjust the state of the toggle mute menu item. + let toggleMute = document.getElementById("context_toggleMuteTab"); + if (this.contextTab.hasAttribute("muted")) { + toggleMute.label = gNavigatorBundle.getString("unmuteTab.label"); + toggleMute.accessKey = gNavigatorBundle.getString("unmuteTab.accesskey"); + } else { + toggleMute.label = gNavigatorBundle.getString("muteTab.label"); + toggleMute.accessKey = gNavigatorBundle.getString("muteTab.accesskey"); + } + + this.contextTab.toggleMuteMenuItem = toggleMute; + this._updateToggleMuteMenuItem(this.contextTab); + + this.contextTab.addEventListener("TabAttrModified", this, false); + aPopupMenu.addEventListener("popuphiding", this, false); + }, + handleEvent(aEvent) { + switch (aEvent.type) { + case "popuphiding": + gBrowser.removeEventListener("TabAttrModified", this); + aEvent.target.removeEventListener("popuphiding", this); + break; + case "TabAttrModified": + let tab = aEvent.target; + this._updateToggleMuteMenuItem(tab, + attr => aEvent.detail.changed.indexOf(attr) >= 0); + break; + } } }; diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul index 07ca54722..ce2a7c5a8 100644 --- a/application/palemoon/base/content/browser.xul +++ b/application/palemoon/base/content/browser.xul @@ -87,6 +87,7 @@ onpopuphidden="if (event.target == this) TabContextMenu.contextTab = null;"> + Date: Fri, 16 Nov 2018 23:22:42 +0800 Subject: Issue #638 - Part 6: Fix up remaining references - Refactor _tabAttrModified to accept two parameters - Modify consumers of _tabAttrModified to pass details - Add missing _soundPlayingAttrRemovalTimer field - Add missing checks for mute/unmute around the tab browser - Tab sound icon should inherit 'selected' attribute instead of 'visuallyselected' --- application/palemoon/base/content/tabbrowser.xml | 66 +++++++++++++++++++----- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 073a12f16..aa9c8adc3 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -616,7 +616,7 @@ if (this.mTab.hasAttribute("busy")) { this.mTab.removeAttribute("busy"); - this.mTabBrowser._tabAttrModified(this.mTab); + this.mTabBrowser._tabAttrModified(this.mTab, ["busy"]); if (!this.mTab.selected) this.mTab.setAttribute("unread", "true"); } @@ -696,6 +696,19 @@ aLocation.spec != "about:blank")) this.mBrowser.userTypedValue = null; + // If the browser was playing audio, we should remove the playing state. + if (this.mTab.hasAttribute("soundplaying") && !isSameDocument) { + clearTimeout(this.mTab._soundPlayingAttrRemovalTimer); + this.mTab._soundPlayingAttrRemovalTimer = 0; + this.mTab.removeAttribute("soundplaying"); + this.mTabBrowser._tabAttrModified(this.mTab, ["soundplaying"]); + } + + // If the browser was previously muted, we should restore the muted state. + if (this.mTab.hasAttribute("muted")) { + this.mTab.linkedBrowser.mute(); + } + // Don't clear the favicon if this onLocationChange was // triggered by a pushState or a replaceState. See bug 550565. if (!gMultiProcessBrowser) { @@ -804,7 +817,7 @@ aTab.setAttribute("image", sizedIconUrl); else aTab.removeAttribute("image"); - this._tabAttrModified(aTab); + this._tabAttrModified(aTab, ["image"]); } this._callProgressListeners(browser, "onLinkIconAvailable", [browser.mIconURL]); @@ -1116,8 +1129,8 @@ }); this.mCurrentTab.dispatchEvent(event); - this._tabAttrModified(oldTab); - this._tabAttrModified(this.mCurrentTab); + this._tabAttrModified(oldTab, ["selected"]); + this._tabAttrModified(this.mCurrentTab, ["selected"]); // Adjust focus oldBrowser._urlbarFocused = (gURLBar && gURLBar.focused); @@ -1187,14 +1200,18 @@ + @@ -1205,7 +1222,7 @@ @@ -1250,7 +1267,7 @@ aTab.label = title; aTab.crop = crop; - this._tabAttrModified(aTab); + this._tabAttrModified(aTab, ["label", "crop"]); if (aTab.selected) this.updateTitlebar(); @@ -2239,6 +2256,14 @@ var remoteBrowser = aOtherTab.ownerDocument.defaultView.gBrowser; var isPending = aOtherTab.hasAttribute("pending"); + // Expedite the removal of the icon if it was already scheduled. + if (aOtherTab._soundPlayingAttrRemovalTimer) { + clearTimeout(aOtherTab._soundPlayingAttrRemovalTimer); + aOtherTab._soundPlayingAttrRemovalTimer = 0; + aOtherTab.removeAttribute("soundplaying"); + remoteBrowser._tabAttrModified(aOtherTab, ["soundplaying"]); + } + // First, start teardown of the other browser. Make sure to not // fire the beforeunload event in the process. Close the other // window if this was its last tab. @@ -2248,6 +2273,18 @@ let ourBrowser = this.getBrowserForTab(aOurTab); let otherBrowser = aOtherTab.linkedBrowser; + let modifiedAttrs = []; + if (aOtherTab.hasAttribute("muted")) { + aOurTab.setAttribute("muted", "true"); + aOurTab.muteReason = aOtherTab.muteReason; + ourBrowser.mute(); + modifiedAttrs.push("muted"); + } + if (aOtherTab.hasAttribute("soundplaying")) { + aOurTab.setAttribute("soundplaying", "true"); + modifiedAttrs.push("soundplaying"); + } + // If the other tab is pending (i.e. has not been restored, yet) // then do not switch docShells but retrieve the other tab's state // and apply it to our tab. @@ -2266,7 +2303,7 @@ var isBusy = aOtherTab.hasAttribute("busy"); if (isBusy) { aOurTab.setAttribute("busy", "true"); - this._tabAttrModified(aOurTab); + modifiedAttrs.push("busy"); if (aOurTab.selected) this.mIsBusy = true; } @@ -2286,6 +2323,10 @@ // of replaceTabWithWindow), notify onLocationChange, etc. if (aOurTab.selected) this.updateCurrentBrowser(true); + + if (modifiedAttrs.length) { + this._tabAttrModified(aOurTab, modifiedAttrs); + } ]]> @@ -3316,6 +3357,7 @@ ]]> + 0 @@ -4850,7 +4892,7 @@ xbl:inherits="value=label,crop,accesskey,fadein,pinned,selected" class="tab-text tab-label" role="presentation"/> - -- cgit v1.2.3 From 66cc7d91a44fd6789b80cd61ee7b84c63d402122 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 17 Nov 2018 10:25:16 +0800 Subject: Issue #638 - Part 7: Remove hover and active states for sound indicator --- application/palemoon/themes/linux/browser.css | 50 ++------- application/palemoon/themes/osx/browser.css | 50 ++------- .../themes/shared/tabbrowser/tab-audio-small.svg | 113 ++++++++------------- .../themes/shared/tabbrowser/tab-audio.svg | 88 ++-------------- application/palemoon/themes/windows/browser.css | 50 ++------- 5 files changed, 74 insertions(+), 277 deletions(-) diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index 3439bb3fb..1eed36741 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -1766,7 +1766,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- padding: 0; } -.tab-icon-sound:not(:-moz-any([soundplaying],[muted])), +.tab-icon-sound:not(:-moz-any([soundplaying],[muted],[blocked])), .tab-icon-sound[pinned] { display: none; } @@ -1776,56 +1776,20 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } -.tab-icon-sound[soundplaying]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-hover"); -} - -.tab-icon-sound[soundplaying]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); -} - .alltabs-endimage[muted], -.alltabs-endimage[blocked], -.tab-icon-sound[muted], -.tab-icon-sound[blocked] { +.tab-icon-sound[muted] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); } -.tab-icon-sound[muted]:hover, -.tab-icon-sound[blocked]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-hover"); -} - -.tab-icon-sound[muted]:hover:active, -.tab-icon-sound[blocked]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-pressed"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying] { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-hover"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-pressed"); +.alltabs-endimage[blocked], +.tab-icon-sound[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-blocked"); } +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying], #TabsToolbar[brighttext] .tab-icon-sound[blocked], #TabsToolbar[brighttext] .tab-icon-sound[muted] { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover, -#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-hover"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover:active, -#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-pressed"); + filter: invert(1); } .tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover), diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index 754740562..e402a3f0d 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1829,7 +1829,7 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- padding: 0; } -.tab-icon-sound:not(:-moz-any([soundplaying],[muted])), +.tab-icon-sound:not(:-moz-any([soundplaying],[muted],[blocked])), .tab-icon-sound[pinned] { display: none; } @@ -1839,56 +1839,20 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } -.tab-icon-sound[soundplaying]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-hover"); -} - -.tab-icon-sound[soundplaying]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); -} - .alltabs-endimage[muted], -.alltabs-endimage[blocked], -.tab-icon-sound[muted], -.tab-icon-sound[blocked] { +.tab-icon-sound[muted] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); } -.tab-icon-sound[muted]:hover, -.tab-icon-sound[blocked]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-hover"); -} - -.tab-icon-sound[muted]:hover:active, -.tab-icon-sound[blocked]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-pressed"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying] { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-hover"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-pressed"); +.alltabs-endimage[blocked], +.tab-icon-sound[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-blocked"); } +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying], #TabsToolbar[brighttext] .tab-icon-sound[blocked], #TabsToolbar[brighttext] .tab-icon-sound[muted] { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover, -#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-hover"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover:active, -#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-pressed"); + filter: invert(1); } .tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover), diff --git a/application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg b/application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg index da4ad3ef9..abfe71268 100644 --- a/application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg +++ b/application/palemoon/themes/shared/tabbrowser/tab-audio-small.svg @@ -4,82 +4,55 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/palemoon/themes/shared/tabbrowser/tab-audio.svg b/application/palemoon/themes/shared/tabbrowser/tab-audio.svg index 1949c0595..274e10c29 100644 --- a/application/palemoon/themes/shared/tabbrowser/tab-audio.svg +++ b/application/palemoon/themes/shared/tabbrowser/tab-audio.svg @@ -2,85 +2,17 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index 26d096055..ca3d187c1 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -2026,7 +2026,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- padding: 0; } -.tab-icon-sound:not(:-moz-any([soundplaying],[muted])), +.tab-icon-sound:not(:-moz-any([soundplaying],[muted],[blocked])), .tab-icon-sound[pinned] { display: none; } @@ -2036,56 +2036,20 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } -.tab-icon-sound[soundplaying]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-hover"); -} - -.tab-icon-sound[soundplaying]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-pressed"); -} - .alltabs-endimage[muted], -.alltabs-endimage[blocked], -.tab-icon-sound[muted], -.tab-icon-sound[blocked] { +.tab-icon-sound[muted] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); } -.tab-icon-sound[muted]:hover, -.tab-icon-sound[blocked]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-hover"); -} - -.tab-icon-sound[muted]:hover:active, -.tab-icon-sound[blocked]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-pressed"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying] { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-hover"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[soundplaying]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-dark-pressed"); +.alltabs-endimage[blocked], +.tab-icon-sound[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-blocked"); } +#TabsToolbar[brighttext] .tab-icon-sound[soundplaying], #TabsToolbar[brighttext] .tab-icon-sound[blocked], #TabsToolbar[brighttext] .tab-icon-sound[muted] { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover, -#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-hover"); -} - -#TabsToolbar[brighttext] .tab-icon-sound[blocked]:hover:active, -#TabsToolbar[brighttext] .tab-icon-sound[muted]:hover:active { - list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted-dark-pressed"); + filter: invert(1); } .tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover) { -- cgit v1.2.3 From a6b250b47730cc4751cfc5ca9e96a4b74e4d6572 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 17 Nov 2018 10:55:10 +0800 Subject: Issue #638 - Part 8: Add overlay sound icon for pinned tabs - This also moves some styles to tabbrowser.css --- application/palemoon/base/content/tabbrowser.css | 11 ++++- application/palemoon/base/content/tabbrowser.xml | 4 ++ application/palemoon/themes/linux/browser.css | 54 +++++++++++++++++++--- application/palemoon/themes/osx/browser.css | 54 +++++++++++++++++++--- application/palemoon/themes/windows/browser.css | 57 +++++++++++++++++++++--- 5 files changed, 163 insertions(+), 17 deletions(-) diff --git a/application/palemoon/base/content/tabbrowser.css b/application/palemoon/base/content/tabbrowser.css index 94d6dbb2e..43536b27a 100644 --- a/application/palemoon/base/content/tabbrowser.css +++ b/application/palemoon/base/content/tabbrowser.css @@ -45,10 +45,19 @@ tabpanels { } .tab-throbber:not([busy]), -.tab-throbber[busy] + .tab-icon-image { +.tab-throbber[busy] + .tab-icon-image, +.tab-icon-sound:not([soundplaying]):not([muted]):not([blocked]), +.tab-icon-sound[pinned], +.tab-icon-overlay { display: none; } +.tab-icon-overlay[soundplaying][pinned], +.tab-icon-overlay[muted][pinned], +.tab-icon-overlay[blocked][pinned] { + display: -moz-box; +} + .closing-tabs-spacer { pointer-events: none; } diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index aa9c8adc3..62b2028b4 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -4888,6 +4888,10 @@ class="tab-icon-image" role="presentation" anonid="tab-icon"/> + .ac-url-box > .ac-action- padding: 0; } -.tab-icon-sound:not(:-moz-any([soundplaying],[muted],[blocked])), -.tab-icon-sound[pinned] { - display: none; -} - .alltabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); @@ -1798,6 +1793,55 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- opacity: 0; } +/* Tab icon overlay */ +.tab-icon-overlay { + width: 16px; + height: 16px; + margin-top: -8px; + margin-inline-start: -15px; + margin-inline-end: -1px; + position: relative; +} + +.tab-icon-overlay[soundplaying], +.tab-icon-overlay[muted]:not([crashed]), +.tab-icon-overlay[blocked]:not([crashed]) { + border-radius: 10px; +} + +.tab-icon-overlay[soundplaying]:hover, +.tab-icon-overlay[muted]:not([crashed]):hover, +.tab-icon-overlay[blocked]:not([crashed]):hover { + background-color: white; +} + +.tab-icon-overlay[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio"); +} + +.tab-icon-overlay[muted] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-muted"); +} + +.tab-icon-overlay[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-blocked"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[soundplaying]:not([selected]):not(:hover), +.tab-icon-overlay[soundplaying][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[muted]:not([crashed]):not([selected]):not(:hover), +.tab-icon-overlay[muted][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white-muted"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[blocked]:not([crashed]):not([selected]):not(:hover), +.tab-icon-overlay[blocked][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white-blocked"); +} + /* Tabstrip new tab button */ .tabs-newtab-button, #TabsToolbar > #new-tab-button , diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index e402a3f0d..b2e935b0b 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1829,11 +1829,6 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- padding: 0; } -.tab-icon-sound:not(:-moz-any([soundplaying],[muted],[blocked])), -.tab-icon-sound[pinned] { - display: none; -} - .alltabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); @@ -1861,6 +1856,55 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- opacity: 0; } +/* Tab icon overlay */ +.tab-icon-overlay { + width: 16px; + height: 16px; + margin-top: -8px; + margin-inline-start: -15px; + margin-inline-end: -1px; + position: relative; +} + +.tab-icon-overlay[soundplaying], +.tab-icon-overlay[muted]:not([crashed]), +.tab-icon-overlay[blocked]:not([crashed]) { + border-radius: 10px; +} + +.tab-icon-overlay[soundplaying]:hover, +.tab-icon-overlay[muted]:not([crashed]):hover, +.tab-icon-overlay[blocked]:not([crashed]):hover { + background-color: white; +} + +.tab-icon-overlay[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio"); +} + +.tab-icon-overlay[muted] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-muted"); +} + +.tab-icon-overlay[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-blocked"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[soundplaying]:not([selected]):not(:hover), +.tab-icon-overlay[soundplaying][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[muted]:not([crashed]):not([selected]):not(:hover), +.tab-icon-overlay[muted][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white-muted"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[blocked]:not([crashed]):not([selected]):not(:hover), +.tab-icon-overlay[blocked][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white-blocked"); +} + /* Tab scrollbox arrow, tabstrip new tab and all-tabs buttons */ .tabbrowser-arrowscrollbox > .scrollbutton-up, diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index ca3d187c1..506b85bf0 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -2026,11 +2026,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- padding: 0; } -.tab-icon-sound:not(:-moz-any([soundplaying],[muted],[blocked])), -.tab-icon-sound[pinned] { - display: none; -} - .alltabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); @@ -2052,11 +2047,61 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- filter: invert(1); } -.tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover) { +.tab-icon-sound[soundplaying-scheduledremoval]:not([muted]):not(:hover), +.tab-icon-overlay[soundplaying-scheduledremoval]:not([muted]):not(:hover) { transition: opacity .3s linear var(--soundplaying-removal-delay); opacity: 0; } +/* Tab icon overlay */ +.tab-icon-overlay { + width: 16px; + height: 16px; + margin-top: -8px; + margin-inline-start: -15px; + margin-inline-end: -1px; + position: relative; +} + +.tab-icon-overlay[soundplaying], +.tab-icon-overlay[muted]:not([crashed]), +.tab-icon-overlay[blocked]:not([crashed]) { + border-radius: 10px; +} + +.tab-icon-overlay[soundplaying]:hover, +.tab-icon-overlay[muted]:not([crashed]):hover, +.tab-icon-overlay[blocked]:not([crashed]):hover { + background-color: white; +} + +.tab-icon-overlay[soundplaying] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio"); +} + +.tab-icon-overlay[muted] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-muted"); +} + +.tab-icon-overlay[blocked] { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-blocked"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[soundplaying]:not([selected]):not(:hover), +.tab-icon-overlay[soundplaying][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[muted]:not([crashed]):not([selected]):not(:hover), +.tab-icon-overlay[muted][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white-muted"); +} + +#TabsToolbar[brighttext] .tab-icon-overlay[blocked]:not([crashed]):not([selected]):not(:hover), +.tab-icon-overlay[blocked][selected]:-moz-lwtheme-brighttext:not(:hover) { + list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-small.svg#tab-audio-white-blocked"); +} + /* Tab scrollbox arrow, tabstrip new tab and all-tabs buttons */ .tabbrowser-arrowscrollbox > .scrollbutton-up, -- cgit v1.2.3 From fe4c12e2d64627930e4a1581e726d36539b4847c Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 17 Nov 2018 12:09:14 +0800 Subject: Issue #638 - Part 9: Add sound icon to all tabs menu --- application/palemoon/base/content/browser-tabPreviews.js | 7 +++++++ application/palemoon/base/content/browser-tabPreviews.xml | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/application/palemoon/base/content/browser-tabPreviews.js b/application/palemoon/base/content/browser-tabPreviews.js index eaae78ba8..e0755b81d 100644 --- a/application/palemoon/base/content/browser-tabPreviews.js +++ b/application/palemoon/base/content/browser-tabPreviews.js @@ -940,6 +940,13 @@ var allTabs = { aPreview.setAttribute("image", aPreview._tab.image); else aPreview.removeAttribute("image"); + + aPreview.removeAttribute("soundplaying"); + aPreview.removeAttribute("muted"); + if (aPreview._tab.hasAttribute("muted")) + aPreview.setAttribute("muted", "true"); + else if (aPreview._tab.hasAttribute("soundplaying")) + aPreview.setAttribute("soundplaying", "true"); var thumbnail = tabPreviews.get(aPreview._tab); if (aPreview.firstChild) { diff --git a/application/palemoon/base/content/browser-tabPreviews.xml b/application/palemoon/base/content/browser-tabPreviews.xml index e957649e7..5b9c58226 100644 --- a/application/palemoon/base/content/browser-tabPreviews.xml +++ b/application/palemoon/base/content/browser-tabPreviews.xml @@ -42,7 +42,10 @@ - + + + + -- cgit v1.2.3 From deb4791e21e9cda73083f0c61c44a51270f433e2 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 17 Nov 2018 12:11:34 +0800 Subject: Issue #638 - Part 10: Rename all tabs sound icon to be consistent with others - alltabs => allTabs --- application/palemoon/base/content/browser-tabPreviews.xml | 2 +- application/palemoon/base/content/tabbrowser.xml | 2 +- application/palemoon/themes/linux/browser.css | 6 +++--- application/palemoon/themes/osx/browser.css | 6 +++--- application/palemoon/themes/windows/browser.css | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/application/palemoon/base/content/browser-tabPreviews.xml b/application/palemoon/base/content/browser-tabPreviews.xml index 5b9c58226..4f54321ea 100644 --- a/application/palemoon/base/content/browser-tabPreviews.xml +++ b/application/palemoon/base/content/browser-tabPreviews.xml @@ -43,7 +43,7 @@ - + diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 62b2028b4..9ee7f1b11 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -5160,7 +5160,7 @@ function addEndImage() { let endImage = document.createElement("image"); - endImage.setAttribute("class", "alltabs-endimage"); + endImage.setAttribute("class", "allTabs-endimage"); let endImageContainer = document.createElement("hbox"); endImageContainer.setAttribute("align", "center"); endImageContainer.setAttribute("pack", "center"); diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index 33ae211d6..516677fe6 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -1766,17 +1766,17 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- padding: 0; } -.alltabs-endimage[soundplaying], +.allTabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } -.alltabs-endimage[muted], +.allTabs-endimage[muted], .tab-icon-sound[muted] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); } -.alltabs-endimage[blocked], +.allTabs-endimage[blocked], .tab-icon-sound[blocked] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-blocked"); } diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index b2e935b0b..a7bd683bd 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1829,17 +1829,17 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url- padding: 0; } -.alltabs-endimage[soundplaying], +.allTabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } -.alltabs-endimage[muted], +.allTabs-endimage[muted], .tab-icon-sound[muted] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); } -.alltabs-endimage[blocked], +.allTabs-endimage[blocked], .tab-icon-sound[blocked] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-blocked"); } diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index 506b85bf0..ebc417786 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -2026,17 +2026,17 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action- padding: 0; } -.alltabs-endimage[soundplaying], +.allTabs-endimage[soundplaying], .tab-icon-sound[soundplaying] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio"); } -.alltabs-endimage[muted], +.allTabs-endimage[muted], .tab-icon-sound[muted] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-muted"); } -.alltabs-endimage[blocked], +.allTabs-endimage[blocked], .tab-icon-sound[blocked] { list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio.svg#tab-audio-blocked"); } -- cgit v1.2.3 From 61b21c8083ec889b900efd78ff9435c441537e38 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 17 Nov 2018 19:17:20 +0800 Subject: Follow-up: Add missing getTabFromAudioEvent method --- application/palemoon/base/content/tabbrowser.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 9ee7f1b11..9479db109 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -438,6 +438,22 @@ + + + + + + + -- cgit v1.2.3 From a681891e66255bfc466782ee5714e5cff80e0004 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 17 Nov 2018 21:49:36 +0800 Subject: Fix undefined isSameDocument --- application/palemoon/base/content/tabbrowser.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 9479db109..929afd057 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -702,6 +702,8 @@ let topLevel = aWebProgress.isTopLevel; if (topLevel) { + let isSameDocument = + !!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT); // We need to clear the typed value // if the document failed to load, to make sure the urlbar reflects the // failed URI (particularly for SSL errors). However, don't clear the value -- cgit v1.2.3 From af0164310dd94e24bf7b44ebb6d9b146eb5db241 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sun, 18 Nov 2018 15:38:15 +0800 Subject: Hide mute menu item and disable mute hotkey with existing pref --- application/palemoon/base/content/browser.js | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 5d44f0066..591d00fbb 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -976,6 +976,7 @@ var gBrowserInit = { CombinedStopReload.init(); allTabs.readPref(); TabsOnTop.init(); + AudioIndicator.init(); gPrivateBrowsingUI.init(); TabsInTitlebar.init(); retrieveToolbarIconsizesFromTheme(); @@ -1364,6 +1365,8 @@ var gBrowserInit = { BookmarkingUI.uninit(); TabsOnTop.uninit(); + + AudioIndicator.uninit(); TabsInTitlebar.uninit(); @@ -4597,6 +4600,42 @@ function setToolbarVisibility(toolbar, isVisible) { ToolbarIconColor.inferFromText(); } +var AudioIndicator = { + init: function () { + Services.prefs.addObserver(this._prefName, this, false); + this.syncUI(); + }, + + uninit: function () { + Services.prefs.removeObserver(this._prefName, this); + }, + + toggle: function () { + this.enabled = !Services.prefs.getBoolPref(this._prefName); + }, + + syncUI: function () { + document.getElementById("context_toggleMuteTab").setAttribute("hidden", this.enabled); + document.getElementById("key_toggleMute").setAttribute("disabled", this.enabled); + }, + + get enabled () { + return !Services.prefs.getBoolPref(this._prefName); + }, + + set enabled (val) { + Services.prefs.setBoolPref(this._prefName, !!val); + return val; + }, + + observe: function (subject, topic, data) { + if (topic == "nsPref:changed") + this.syncUI(); + }, + + _prefName: "browser.tabs.showAudioPlayingIcon" +} + var TabsOnTop = { init: function TabsOnTop_init() { Services.prefs.addObserver(this._prefName, this, false); -- cgit v1.2.3