From 737dbe4fe5e79668f818110e7f4c1a0ddab657a5 Mon Sep 17 00:00:00 2001 From: "jer.noble@apple.com" Date: Mon, 30 Sep 2013 16:09:37 +0000 Subject: [PATCH] REGRESSION(r156546): media/video-no-audio.html broken https://bugs.webkit.org/show_bug.cgi?id=122049 Reviewed by Eric Carlson. Source/WebCore: Now that our video elements have audio tracks, use their presence or absense to show or hide the volume controls. * Modules/mediacontrols/mediaControlsApple.js: (Controller): (Controller.prototype.addVideoListeners): Listen for audioTrack changes. (Controller.prototype.removeVideoListeners): Stop listening to same. (Controller.prototype.handleAudioTrackChange): Call this.updateHasAudio() (Controller.prototype.handleAudioTrackAdd): Ditto. (Controller.prototype.handleAudioTrackRemove): Ditto. (Controller.prototype.updateHasAudio): Hide the volume controls if no audioTracks are present, and vice versa. LayoutTests: * platform/mac/TestExpectations: * platform/mac/media/video-no-audio-expected.txt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156656 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 10 ++++++++ LayoutTests/platform/mac/TestExpectations | 1 - .../platform/mac/media/video-no-audio-expected.txt | 28 +++++++++++++--------- Source/WebCore/ChangeLog | 20 ++++++++++++++++ .../Modules/mediacontrols/mediaControlsApple.js | 19 +++++++++++++++ 5 files changed, 66 insertions(+), 12 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index fda29ed..2bf53b0 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,5 +1,15 @@ 2013-09-27 Jer Noble + REGRESSION(r156546): media/video-no-audio.html broken + https://bugs.webkit.org/show_bug.cgi?id=122049 + + Reviewed by Eric Carlson. + + * platform/mac/TestExpectations: + * platform/mac/media/video-no-audio-expected.txt: + +2013-09-27 Jer Noble + [Mac] Add AudioTrack support to MediaPlayerPrivateAVFObC. https://bugs.webkit.org/show_bug.cgi?id=122043 diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations index ddc0691..ab1c569 100644 --- a/LayoutTests/platform/mac/TestExpectations +++ b/LayoutTests/platform/mac/TestExpectations @@ -1358,7 +1358,6 @@ webkit.org/b/122021 media/video-controls-toggling.html webkit.org/b/122021 media/video-controls-visible-exiting-fullscreen.html webkit.org/b/122021 media/video-display-toggle.html webkit.org/b/122021 media/video-empty-source.html -webkit.org/b/122021 media/video-no-audio.html webkit.org/b/122021 media/video-rtl.html webkit.org/b/122021 media/video-volume-slider.html webkit.org/b/122021 media/volume-bar-empty-when-muted.html diff --git a/LayoutTests/platform/mac/media/video-no-audio-expected.txt b/LayoutTests/platform/mac/media/video-no-audio-expected.txt index 4c77a09..b18c450 100644 --- a/LayoutTests/platform/mac/media/video-no-audio-expected.txt +++ b/LayoutTests/platform/mac/media/video-no-audio-expected.txt @@ -14,22 +14,28 @@ layer at (8,42) size 352x288 RenderFlexibleBox {DIV} at (0,0) size 352x288 layer at (8,305) size 352x25 RenderFlexibleBox {DIV} at (0,263) size 352x25 - RenderButton {INPUT} at (6,3) size 18x18 - RenderButton {INPUT} at (32,4) size 16x16 - RenderFlexibleBox {DIV} at (49,5) size 273x15 - RenderSlider {INPUT} at (45,2) size 183x13 - RenderFlexibleBox {DIV} at (0,0) size 183x13 - RenderBlock {DIV} at (0,2) size 183x8 - RenderBlock {DIV} at (0,0) size 10x8 - RenderButton {INPUT} at (329,4) size 16x16 - RenderBlock {DIV} at (322,12) size 0x0 +layer at (14,309) size 16x16 + RenderButton {BUTTON} at (6,4) size 16x16 [color=#FFFFFF] +layer at (40,310) size 16x16 + RenderButton {BUTTON} at (32,5) size 16x16 [color=#FFFFFF] +layer at (57,312) size 273x11 + RenderFlexibleBox {DIV} at (49,7) size 273x11 layer at (57,312) size 45x11 - RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF] + RenderFlexibleBox {DIV} at (0,0) size 45x11 [color=#FFFFFF] RenderBlock (anonymous) at (9,0) size 26x11 RenderText {#text} at (0,0) size 26x11 text run at (0,0) width 26: "00:00" layer at (285,312) size 45x11 - RenderFlexibleBox {DIV} at (228,2) size 45x11 [color=#FFFFFF] + RenderFlexibleBox {DIV} at (228,0) size 45x11 [color=#FFFFFF] RenderBlock (anonymous) at (7,0) size 31x11 RenderText {#text} at (0,0) size 31x11 text run at (0,0) width 31: "-00:09" +layer at (104,313) size 179x9 + RenderFlexibleBox {DIV} at (47,1) size 179x9 + RenderSlider {INPUT} at (0,0) size 179x9 [color=#909090] [bgcolor=#000000] + RenderFlexibleBox {DIV} at (0,0) size 179x9 + RenderBlock {DIV} at (0,1) size 179x6 +layer at (104,314) size 6x6 + RenderBlock {DIV} at (0,0) size 6x6 [bgcolor=#FFFFFF] +layer at (337,310) size 16x16 + RenderButton {BUTTON} at (329,5) size 16x16 [color=#FFFFFF] diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 3248235..e9f4b2c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,23 @@ +2013-09-27 Jer Noble + + REGRESSION(r156546): media/video-no-audio.html broken + https://bugs.webkit.org/show_bug.cgi?id=122049 + + Reviewed by Eric Carlson. + + Now that our video elements have audio tracks, use their presence or + absense to show or hide the volume controls. + + * Modules/mediacontrols/mediaControlsApple.js: + (Controller): + (Controller.prototype.addVideoListeners): Listen for audioTrack changes. + (Controller.prototype.removeVideoListeners): Stop listening to same. + (Controller.prototype.handleAudioTrackChange): Call this.updateHasAudio() + (Controller.prototype.handleAudioTrackAdd): Ditto. + (Controller.prototype.handleAudioTrackRemove): Ditto. + (Controller.prototype.updateHasAudio): Hide the volume controls if no + audioTracks are present, and vice versa. + 2013-09-30 Jer Noble Unreviewed Mac-Lion build fix. diff --git a/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js b/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js index cc30400..7a117b4 100644 --- a/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js +++ b/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js @@ -25,6 +25,7 @@ function Controller(root, video, host) this.updateCaptionButton(); this.updateCaptionContainer(); this.updateVolume(); + this.updateHasAudio(); }; /* Enums */ @@ -112,6 +113,11 @@ Controller.prototype = { this.listenFor(this.video.textTracks, 'addtrack', this.handleTextTrackAdd); this.listenFor(this.video.textTracks, 'removetrack', this.handleTextTrackRemove); + /* audio tracks */ + this.listenFor(this.video.audioTracks, 'change', this.updateHasAudio); + this.listenFor(this.video.audioTracks, 'addtrack', this.updateHasAudio); + this.listenFor(this.video.audioTracks, 'removetrack', this.updateHasAudio); + /* controls attribute */ this.controlsObserver = new MutationObserver(this.handleControlsChange.bind(this)); this.controlsObserver.observe(this.video, { attributes: true, attributeFilter: ['controls'] }); @@ -128,6 +134,11 @@ Controller.prototype = { this.stopListeningFor(this.video.textTracks, 'addtrack', this.handleTextTrackAdd); this.stopListeningFor(this.video.textTracks, 'removetrack', this.handleTextTrackRemove); + /* audio tracks */ + this.stopListeningFor(this.video.audioTracks, 'change', this.updateHasAudio); + this.stopListeningFor(this.video.audioTracks, 'addtrack', this.updateHasAudio); + this.stopListeningFor(this.video.audioTracks, 'removetrack', this.updateHasAudio); + /* controls attribute */ this.controlsObserver.disconnect(); delete(this.controlsObserver); @@ -914,6 +925,14 @@ Controller.prototype = { delete this.captionMenuItems; }, + updateHasAudio: function() + { + if (this.video.audioTracks.length) + this.controls.muteBox.classList.remove(this.ClassNames.hidden); + else + this.controls.muteBox.classList.add(this.ClassNames.hidden); + }, + updateVolume: function() { if (this.video.muted || !this.video.volume) { -- 1.8.3.1