From ce9ddc4dabe22673c40cb412bc3de2b99b8a3c15 Mon Sep 17 00:00:00 2001 From: Alastor Wu Date: Wed, 17 May 2017 11:55:54 +0800 Subject: [PATCH] Bug 1347791 - part1 : rename the attribute for the tab which has blocked the autoplay audio and would show the play-tab icon. r=mikedeboer The "blocked" attribute is too general to indicate the real usage, so rename it to "activemedia-blocked". This attribute indicates that whether the tab has blocked the autoplay media. MozReview-Commit-ID: EAmq6OuBYjq --HG-- extra : rebase_source : e8e9321854b80736f0959fbfecbc8bf9a83b0712 --- browser/base/content/browser.js | 2 +- browser/base/content/tabbrowser.css | 4 ++-- browser/base/content/tabbrowser.xml | 31 +++++++++++---------------- browser/themes/shared/tabs.inc.css | 26 +++++++++++----------- toolkit/content/tests/browser/head.js | 6 +++--- 5 files changed, 32 insertions(+), 37 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 06959b2a9f50..fb7ce3fff367 100755 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -8202,7 +8202,7 @@ var TabContextMenu = { // Adjust the state of the toggle mute menu item. let toggleMute = document.getElementById("context_toggleMuteTab"); - if (this.contextTab.hasAttribute("blocked")) { + if (this.contextTab.hasAttribute("activemedia-blocked")) { toggleMute.label = gNavigatorBundle.getString("playTab.label"); toggleMute.accessKey = gNavigatorBundle.getString("playTab.accesskey"); } else if (this.contextTab.hasAttribute("muted")) { diff --git a/browser/base/content/tabbrowser.css b/browser/base/content/tabbrowser.css index 8e28beab5a9d..7451bb9a0a41 100644 --- a/browser/base/content/tabbrowser.css +++ b/browser/base/content/tabbrowser.css @@ -24,7 +24,7 @@ .tab-icon-image:not([src]):not([pinned]):not([crashed]):not([sharing]), .tab-icon-image[busy], .tab-throbber:not([busy]), -.tab-icon-sound:not([soundplaying]):not([muted]):not([blocked]), +.tab-icon-sound:not([soundplaying]):not([muted]):not([activemedia-blocked]), .tab-icon-sound[pinned], .tab-sharing-icon-overlay, .tab-icon-overlay { @@ -34,7 +34,7 @@ .tab-sharing-icon-overlay[sharing]:not([selected]), .tab-icon-overlay[soundplaying][pinned], .tab-icon-overlay[muted][pinned], -.tab-icon-overlay[blocked][pinned], +.tab-icon-overlay[activemedia-blocked][pinned], .tab-icon-overlay[crashed] { display: -moz-box; } diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 63a49afe1b85..9fe0a38ffcf6 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -5606,9 +5606,9 @@ return; } - if (!tab.hasAttribute("blocked")) { - tab.setAttribute("blocked", true); - this._tabAttrModified(tab, ["blocked"]); + if (!tab.hasAttribute("activemedia-blocked")) { + tab.setAttribute("activemedia-blocked", true); + this._tabAttrModified(tab, ["activemedia-blocked"]); tab.startMediaBlockTimer(); } ]]> @@ -5620,9 +5620,9 @@ return; } - if (tab.hasAttribute("blocked")) { - tab.removeAttribute("blocked"); - this._tabAttrModified(tab, ["blocked"]); + if (tab.hasAttribute("activemedia-blocked")) { + tab.removeAttribute("activemedia-blocked"); + this._tabAttrModified(tab, ["activemedia-blocked"]); let hist = Services.telemetry.getHistogramById("TAB_AUDIO_INDICATOR_USED"); hist.add(2 /* unblockByVisitingTab */); tab.finishMediaBlockTimer(); @@ -7132,7 +7132,7 @@ anonid="sharing-icon" class="tab-sharing-icon-overlay" role="presentation"/> - @@ -7145,7 +7145,7 @@ xbl:inherits="xbl:text=label,accesskey,fadein,pinned,selected=visuallyselected,attention" role="presentation"/> - @@ -7222,11 +7222,6 @@ return this.getAttribute("muted") == "true"; - - - return this.getAttribute("blocked") == "true"; - -