Bug 1345440 - Force a style flush of the tab when we set the soundplaying attribute to get the icon drawn immediately. r=Gijs
authorJared Wein <jwein@mozilla.com>
Wed, 29 Mar 2017 23:45:22 -0400
changeset 350628 2015c1f2ce57a8c76b76a4c47635d2ad7f0e4f52
parent 350627 6d376d7031df13dc18b533d47fea7bebb8462b33
child 350629 0d1d8024cc28f77d80986d171e39d8c3dfe59d1f
push id88685
push usercbook@mozilla.com
push dateFri, 31 Mar 2017 12:48:11 +0000
treeherdermozilla-inbound@aece477a513e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1345440
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1345440 - Force a style flush of the tab when we set the soundplaying attribute to get the icon drawn immediately. r=Gijs MozReview-Commit-ID: 5JRyZp1SzDb
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -5514,16 +5514,19 @@
           let modifiedAttrs = [];
           if (tab.hasAttribute("soundplaying-scheduledremoval")) {
             tab.removeAttribute("soundplaying-scheduledremoval");
             modifiedAttrs.push("soundplaying-scheduledremoval");
           }
 
           if (!tab.hasAttribute("soundplaying")) {
             tab.setAttribute("soundplaying", true);
+            // Flush style so that the opacity takes effect immediately, in
+            // case the media is stopped before the style flushes naturally.
+            getComputedStyle(tab).opacity;
             modifiedAttrs.push("soundplaying");
           }
 
           this._tabAttrModified(tab, modifiedAttrs);
         ]]>
       </handler>
       <handler event="DOMAudioPlaybackStopped">
         <![CDATA[