Show sound indicator in a tab which have any soundplaying descendant

This commit is contained in:
YUKI Hiroshi 2015-11-19 18:30:38 +09:00
parent 573556a834
commit e6eac24805

View File

@ -3006,11 +3006,19 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
case 'DOMAudioPlaybackStarted':
this.setTabValue(this.getTabFromBrowser(aEvent.target), this.kREALLY_SOUND_PLAYING, true);
{
let tab = this.getTabFromBrowser(aEvent.originalTarget);
this.setTabValue(tab, this.kREALLY_SOUND_PLAYING, true);
this.updateTabAsParent(this.getParentTab(tab));
}
return;
case 'DOMAudioPlaybackStopped':
this.deleteTabValue(this.getTabFromBrowser(aEvent.target), this.kREALLY_SOUND_PLAYING);
{
let tab = this.getTabFromBrowser(aEvent.originalTarget);
this.deleteTabValue(tab, this.kREALLY_SOUND_PLAYING);
this.updateTabAsParent(this.getParentTab(tab));
}
return;
@ -5929,8 +5937,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
return;
var descendants = this.getDescendantTabs(aTab);
this.updateTabsCount(aTab, descendants);
this.updateTabSoundIndicator(aTab, descendants);
if (!aDontUpdateAncestor) {
let parent = this.getParentTab(aTab);
@ -5948,6 +5956,17 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
count.setAttribute('value', value);
}
},
updateTabSoundIndicator : function TSTBrowser_updateTabSoundIndicator(aTab, aDescendants)
{
var hasSoundPlayingDescendant = aDescendants.some(function(aDescendant) {
return this.getTabValue(aDescendant, this.kREALLY_SOUND_PLAYING) == 'true';
}, this);
if (hasSoundPlayingDescendant ||
this.getTabValue(aTab, this.kREALLY_SOUND_PLAYING) == 'true')
aTab.setAttribute('soundplaying', true);
else
aTab.removeAttribute('soundplaying', true);
},
updateAllTabsCount : function TSTBrowser_updateAllTabsCount()
{