2009-08-19 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2009 18:10:44 +0000 (18:10 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2009 18:10:44 +0000 (18:10 +0000)
        Reviewed by Eric Seidel.

        Sound button appears in controller with movies that have no audio
        https://bugs.webkit.org/show_bug.cgi?id=28464

        Test: media/video-no-audio.html

        * html/HTMLMediaElement.cpp:
        * html/HTMLMediaElement.h:
        (WebCore::HTMLMediaElement::hasAudio):
            Added hasAudio.

        * platform/graphics/MediaPlayer.h:
        * platform/graphics/MediaPlayer.cpp:
        (WebCore::NullMediaPlayerPrivate::hasAudio):
        (WebCore::MediaPlayer::hasVideo):
            Make const.
        (WebCore::MediaPlayer::hasAudio):
            Added hasAudio.

        * platform/graphics/MediaPlayerPrivate.h:
            Add hasAudio.

        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h:
        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivate::hasAudio):
            Ditto.

        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivate::hasAudio):
            Ditto.

        * platform/graphics/qt/MediaPlayerPrivatePhonon.h:
        * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
        (WebCore::MediaPlayerPrivate::hasAudio):
            Ditto.

        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h:
        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
        (WebCore::MediaPlayerPrivate::hasAudio):
            Ditto.

        * platform/graphics/win/QTMovieWin.h:
        * platform/graphics/win/QTMovieWin.cpp:
        (QTMovieWin::hasAudio):
            Ditto.

        * rendering/MediaControlElements.cpp:
        (WebCore::MediaControlMuteButtonElement::disabled):
            New, return true if media element doesn't have audio.
        (WebCore::MediaControlMuteButtonElement::rendererIsNeeded):
            Renderer is not needed if element has no audio.
        * rendering/MediaControlElements.h:
        (WebCore::MediaControlInputElement::disabled):

        * rendering/RenderThemeMac.mm:
        (WebCore::getMediaUIPartStateFlags):
            Return MediaUIPartDisabledFlag if node is disabled.

2009-08-19  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Eric Seidel.

        Sound button appears in controller with movies that have no audio
        https://bugs.webkit.org/show_bug.cgi?id=28464

        * media/video-controls-visible-audio-only.html:
        * media/video-no-audio.html: Added.
        * platform/mac-leopard/media/video-empty-source-expected.txt:
        * platform/mac-leopard/media/video-no-audio-expected.txt: Added.
        * platform/mac/media/video-empty-source-expected.txt:
        * platform/mac/media/video-no-audio-expected.txt: Added.
        * platform/win/media/video-empty-source-expected.txt: Added.
        * platform/win/media/video-no-audio-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@47515 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
LayoutTests/ChangeLog
LayoutTests/media/video-controls-visible-audio-only.html
LayoutTests/media/video-no-audio.html [new file with mode: 0644]
LayoutTests/platform/mac-leopard/media/video-empty-source-expected.txt
LayoutTests/platform/mac-leopard/media/video-no-audio-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/media/video-empty-source-expected.txt
LayoutTests/platform/mac/media/video-no-audio-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/media/video-empty-source-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/media/video-no-audio-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLMediaElement.cpp
WebCore/html/HTMLMediaElement.h
WebCore/platform/graphics/MediaPlayer.cpp
WebCore/platform/graphics/MediaPlayer.h
WebCore/platform/graphics/MediaPlayerPrivate.h
WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h
WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.h
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h
WebCore/platform/graphics/win/QTMovieWin.cpp
WebCore/platform/graphics/win/QTMovieWin.h
WebCore/rendering/MediaControlElements.cpp
WebCore/rendering/MediaControlElements.h
WebCore/rendering/RenderThemeMac.mm

index 985261627fc829597dba3f72b73a58ecbf18d7b0..cb9e7e7e6820111a0a002739fc25f6fe2a5775f7 100644 (file)
@@ -1,3 +1,19 @@
+2009-08-19  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Eric Seidel.
+
+        Sound button appears in controller with movies that have no audio
+        https://bugs.webkit.org/show_bug.cgi?id=28464
+
+        * media/video-controls-visible-audio-only.html:
+        * media/video-no-audio.html: Added.
+        * platform/mac-leopard/media/video-empty-source-expected.txt:
+        * platform/mac-leopard/media/video-no-audio-expected.txt: Added.
+        * platform/mac/media/video-empty-source-expected.txt:
+        * platform/mac/media/video-no-audio-expected.txt: Added.
+        * platform/win/media/video-empty-source-expected.txt: Added.
+        * platform/win/media/video-no-audio-expected.txt: Added.
+
 2009-08-19  Alexey Proskuryakov  <ap@apple.com>
 
         Reviewed by Anders Carlsson.
index e3cc72378b93017516f740c1df70fd77fa3e9833..055c33493513c2af7b5524c9984d30c4d3ee3a5a 100644 (file)
 
         </script>
     </head>
-    <body onload="start()">
+    <body >
 
         <p>Test video element control visibility when mouse is not over element.</p>
         <p>This test only runs in DRT!</p>
 
         <p><span id="mouse-parking">mouse parks here, am I blue?</span></p>
 
-        <video id="no-video-media" controls loop src="content/test.wav"></video>
+        <video id="no-video-media" controls loop src="content/test.wav" onload="start()"></video>
         <br><br><div id="console"></div>
     </body>
 </html>
diff --git a/LayoutTests/media/video-no-audio.html b/LayoutTests/media/video-no-audio.html
new file mode 100644 (file)
index 0000000..ed00889
--- /dev/null
@@ -0,0 +1,18 @@
+<html>
+    <head>
+        <script>
+            if (window.layoutTestController)
+                layoutTestController.waitUntilDone();
+    
+            function finish()
+            {
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+            }
+        </script>
+    </head>
+    <body>
+        <p>Movie with no audio track. The volume button should not render.</p>
+        <video src="content/scaled-matrix.mov" controls onload="finish()"></video>
+    </body>
+</html>
index 92a0bd60b587c99735ba1f0e8e49ec8dc31c62f3..a4303323bf54f8292100b422bca0c24aeaa1bf53 100644 (file)
@@ -17,9 +17,8 @@ layer at (9,43) size 300x150
 layer at (9,177) size 300x16
   RenderFlexibleBox (positioned) {DIV} at (0,134) size 300x16
     RenderButton {INPUT} at (0,0) size 16x16
-    RenderButton {INPUT} at (16,0) size 16x16
-    RenderFlexibleBox {DIV} at (32,0) size 236x16
-      RenderSlider {INPUT} at (0,0) size 236x16
+    RenderFlexibleBox {DIV} at (16,0) size 252x16
+      RenderSlider {INPUT} at (0,0) size 252x16
         RenderBlock {DIV} at (2,1) size 13x14
     RenderButton {INPUT} at (268,0) size 16x16
     RenderButton {INPUT} at (284,0) size 16x16
diff --git a/LayoutTests/platform/mac-leopard/media/video-no-audio-expected.txt b/LayoutTests/platform/mac-leopard/media/video-no-audio-expected.txt
new file mode 100644 (file)
index 0000000..f0872fc
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 413x18
+          text run at (0,0) width 413: "Movie with no audio track. The volume button should not render."
+      RenderBlock (anonymous) at (0,34) size 784x480
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,42) size 640x480
+  RenderVideo {VIDEO} at (0,0) size 640x480
+layer at (8,42) size 640x480
+  RenderBlock (relative positioned) {DIV} at (0,0) size 640x480
+layer at (8,506) size 640x16
+  RenderFlexibleBox (positioned) {DIV} at (0,464) size 640x16
+    RenderButton {INPUT} at (0,0) size 16x16
+    RenderFlexibleBox {DIV} at (16,0) size 592x16
+      RenderSlider {INPUT} at (0,0) size 592x16
+        RenderBlock {DIV} at (2,1) size 13x14
+    RenderButton {INPUT} at (608,0) size 16x16
+    RenderButton {INPUT} at (624,0) size 16x16
index c70f5ca18c1d21bdd8ad9a26556b5107a42b5d06..eb14c2cec93945bbf3e9098d5a3ef959eda87276 100644 (file)
@@ -17,5 +17,4 @@ layer at (9,43) size 300x150
 layer at (9,168) size 300x25
   RenderFlexibleBox (positioned) {DIV} at (0,125) size 300x25
     RenderButton {INPUT} at (6,3) size 18x18
-    RenderButton {INPUT} at (277,5) size 15x14
     RenderButton {INPUT} at (32,4) size 16x16
diff --git a/LayoutTests/platform/mac/media/video-no-audio-expected.txt b/LayoutTests/platform/mac/media/video-no-audio-expected.txt
new file mode 100644 (file)
index 0000000..56393fd
--- /dev/null
@@ -0,0 +1,33 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 413x18
+          text run at (0,0) width 413: "Movie with no audio track. The volume button should not render."
+      RenderBlock (anonymous) at (0,34) size 784x480
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,42) size 640x480
+  RenderVideo {VIDEO} at (0,0) size 640x480
+layer at (8,42) size 640x480
+  RenderBlock (relative positioned) {DIV} at (0,0) size 640x480
+layer at (8,497) size 640x25
+  RenderFlexibleBox (positioned) {DIV} at (0,455) size 640x25
+    RenderButton {INPUT} at (6,3) size 18x18
+    RenderButton {INPUT} at (32,4) size 16x16
+    RenderFlexibleBox {DIV} at (49,5) size 591x15
+      RenderSlider {INPUT} at (45,2) size 501x13
+        RenderBlock {DIV} at (0,1) size 12x10
+layer at (57,504) size 45x11
+  RenderFlexibleBox {DIV} at (0,2) 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 (603,504) size 45x11
+  RenderFlexibleBox {DIV} at (546,2) size 45x11 [color=#FFFFFF]
+    RenderBlock (anonymous) at (6,0) size 32x11
+      RenderText {#text} at (0,0) size 32x11
+        text run at (0,0) width 32: "-00:09"
diff --git a/LayoutTests/platform/win/media/video-empty-source-expected.txt b/LayoutTests/platform/win/media/video-empty-source-expected.txt
new file mode 100644 (file)
index 0000000..a430332
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 430x18
+          text run at (0,0) width 430: "Slider drawing with no source. The controls should render correctly."
+      RenderBlock (anonymous) at (0,34) size 784x152
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,42) size 302x152
+  RenderVideo {VIDEO} at (0,0) size 302x152 [border: (1px solid #000000)]
+layer at (9,43) size 300x150
+  RenderBlock (relative positioned) {DIV} at (1,1) size 300x150
+layer at (9,177) size 300x16
+  RenderFlexibleBox (positioned) {DIV} at (0,134) size 300x16
+    RenderButton {INPUT} at (0,0) size 16x16
+    RenderFlexibleBox {DIV} at (16,0) size 252x16
+      RenderSlider {INPUT} at (0,0) size 252x16
+        RenderBlock {DIV} at (2,1) size 13x14
+    RenderButton {INPUT} at (268,0) size 16x16
+    RenderButton {INPUT} at (284,0) size 16x16
diff --git a/LayoutTests/platform/win/media/video-no-audio-expected.txt b/LayoutTests/platform/win/media/video-no-audio-expected.txt
new file mode 100644 (file)
index 0000000..f0872fc
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 413x18
+          text run at (0,0) width 413: "Movie with no audio track. The volume button should not render."
+      RenderBlock (anonymous) at (0,34) size 784x480
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,42) size 640x480
+  RenderVideo {VIDEO} at (0,0) size 640x480
+layer at (8,42) size 640x480
+  RenderBlock (relative positioned) {DIV} at (0,0) size 640x480
+layer at (8,506) size 640x16
+  RenderFlexibleBox (positioned) {DIV} at (0,464) size 640x16
+    RenderButton {INPUT} at (0,0) size 16x16
+    RenderFlexibleBox {DIV} at (16,0) size 592x16
+      RenderSlider {INPUT} at (0,0) size 592x16
+        RenderBlock {DIV} at (2,1) size 13x14
+    RenderButton {INPUT} at (608,0) size 16x16
+    RenderButton {INPUT} at (624,0) size 16x16
index 798eaff69688f767e5f7df8edd95177350b3609a..3dc5705eef775e0b6f6e5a2854495a06b0e35777 100644 (file)
@@ -1,3 +1,66 @@
+2009-08-19  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Eric Seidel.
+
+        Sound button appears in controller with movies that have no audio
+        https://bugs.webkit.org/show_bug.cgi?id=28464
+
+        Test: media/video-no-audio.html
+
+        * html/HTMLMediaElement.cpp:
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::hasAudio):
+            Added hasAudio.
+
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::NullMediaPlayerPrivate::hasAudio):
+        (WebCore::MediaPlayer::hasVideo):
+            Make const.
+        (WebCore::MediaPlayer::hasAudio):
+            Added hasAudio.
+
+        * platform/graphics/MediaPlayerPrivate.h:
+            Add hasAudio.
+
+        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h:
+        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivate::hasAudio):
+            Ditto.
+
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivate::hasAudio):
+            Ditto.
+
+        * platform/graphics/qt/MediaPlayerPrivatePhonon.h:
+        * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
+        (WebCore::MediaPlayerPrivate::hasAudio):
+            Ditto.
+
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h:
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
+        (WebCore::MediaPlayerPrivate::hasAudio):
+            Ditto.
+
+        * platform/graphics/win/QTMovieWin.h:
+        * platform/graphics/win/QTMovieWin.cpp:
+        (QTMovieWin::hasAudio):
+            Ditto.
+
+        * rendering/MediaControlElements.cpp:
+        (WebCore::MediaControlMuteButtonElement::disabled):
+            New, return true if media element doesn't have audio.
+        (WebCore::MediaControlMuteButtonElement::rendererIsNeeded):
+            Renderer is not needed if element has no audio.
+        * rendering/MediaControlElements.h:
+        (WebCore::MediaControlInputElement::disabled):
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::getMediaUIPartStateFlags):
+            Return MediaUIPartDisabledFlag if node is disabled.
+            
+
 2009-08-19  Michelangelo De Simone  <micdesim@gmail.com>
 
         Reviewed by Darin Adler.
index 5187ca4024344bae8dfe0d82aff450c0dc82fe90..17fe6226aec8089d6568c4ed1895e63eb3fb7cea 100644 (file)
@@ -916,6 +916,11 @@ MediaPlayer::MovieLoadType HTMLMediaElement::movieLoadType() const
     return m_player ? m_player->movieLoadType() : MediaPlayer::Unknown;
 }
 
+bool HTMLMediaElement::hasAudio() const
+{
+    return m_player ? m_player->hasAudio() : false;
+}
+
 bool HTMLMediaElement::seeking() const
 {
     return m_seeking;
index 27b48eaa765acee100f6966dfa01ed6974c5bc2b..4b798c3c587b920d6f640b95ee7652668ac74d0f 100644 (file)
@@ -65,6 +65,7 @@ public:
     
     virtual bool isVideo() const { return false; }
     virtual bool hasVideo() const { return false; }
+    virtual bool hasAudio() const;
 
     void rewind(float timeDelta);
     void returnToRealtime();
index d7d8cef6fef8974c318a15438b7c6fbd4be6f124..13ab3fb6189f188dded2c2e714e6e0c08e709032 100644 (file)
@@ -69,6 +69,7 @@ public:
     virtual IntSize naturalSize() const { return IntSize(0, 0); }
 
     virtual bool hasVideo() const { return false; }
+    virtual bool hasAudio() const { return false; }
 
     virtual void setVisible(bool) { }
 
@@ -318,11 +319,16 @@ IntSize MediaPlayer::naturalSize()
     return m_private->naturalSize();
 }
 
-bool MediaPlayer::hasVideo()
+bool MediaPlayer::hasVideo() const
 {
     return m_private->hasVideo();
 }
 
+bool MediaPlayer::hasAudio() const
+{
+    return m_private->hasAudio();
+}
+
 bool MediaPlayer::inMediaDocument()
 {
     Frame* frame = m_frameView ? m_frameView->frame() : 0;
index 7f5f2a04b1d1a1a78486518ab6b6c1bba79fef01..7476360d8d01faabf0617715e591fdfd68c1178e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -110,7 +110,8 @@ public:
     bool supportsFullscreen() const;
     bool supportsSave() const;
     IntSize naturalSize();
-    bool hasVideo();
+    bool hasVideo() const;
+    bool hasAudio() const;
     
     void setFrameView(FrameView* frameView) { m_frameView = frameView; }
     FrameView* frameView() { return m_frameView; }
index 6d1359b3508844be6cce6d0c3689bcc51493bc7c..63adac6473d46995e85e87fd67de24e085beebe3 100644 (file)
@@ -52,6 +52,7 @@ public:
     virtual IntSize naturalSize() const = 0;
 
     virtual bool hasVideo() const = 0;
+    virtual bool hasAudio() const = 0;
 
     virtual void setVisible(bool) = 0;
 
index 4e4bda906b8936de823fed790cdeabb02d6ecb20..b3e7f7d45ce1dc2dee91c3eb8e8e38ebae8085f7 100644 (file)
@@ -325,6 +325,14 @@ bool MediaPlayerPrivate::hasVideo() const
     return currentVideo > -1;
 }
 
+bool MediaPlayerPrivate::hasAudio() const
+{
+    gint currentAudio = -1;
+    if (m_playBin)
+        g_object_get(G_OBJECT(m_playBin), "current-audio", &currentAudio, 0);
+    return currentAudio > -1;
+}
+
 void MediaPlayerPrivate::setVolume(float volume)
 {
     m_volume = volume;
index 8842f8411b636a0239d09b1a7bf014b6873db291..f7571e02a37006e202f6c02783f9b6102fbc16e7 100644 (file)
@@ -56,6 +56,7 @@ namespace WebCore {
 
             IntSize naturalSize() const;
             bool hasVideo() const;
+            bool hasAudio() const;
 
             void load(const String &url);
             void cancelLoad();
index 54eea0081ee64235b34d8025403b6735d617c05a..974dbeba642f4ac616492550bb8b499d80f1a395 100644 (file)
@@ -79,6 +79,7 @@ private:
 
     IntSize naturalSize() const;
     bool hasVideo() const;
+    bool hasAudio() const;
     
     void load(const String& url);
     void cancelLoad();
index c1d7fcb6939422ba73f2c0a522727550d2d138f1..b028815179315ee76791837abb21dd3bf3bd5436 100644 (file)
@@ -84,6 +84,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieAskUnresolvedDataRefsAttribute, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieDataSizeAttribute, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieDidEndNotification, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieHasVideoAttribute, NSString *)
+SOFT_LINK_POINTER(QTKit, QTMovieHasAudioAttribute, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieIsActiveAttribute, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieLoadStateAttribute, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieLoadStateDidChangeNotification, NSString *)
@@ -119,6 +120,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieApertureModeAttribute, NSString *)
 #define QTMovieDataSizeAttribute getQTMovieDataSizeAttribute()
 #define QTMovieDidEndNotification getQTMovieDidEndNotification()
 #define QTMovieHasVideoAttribute getQTMovieHasVideoAttribute()
+#define QTMovieHasAudioAttribute getQTMovieHasAudioAttribute()
 #define QTMovieIsActiveAttribute getQTMovieIsActiveAttribute()
 #define QTMovieLoadStateAttribute getQTMovieLoadStateAttribute()
 #define QTMovieLoadStateDidChangeNotification getQTMovieLoadStateDidChangeNotification()
@@ -719,6 +721,13 @@ bool MediaPlayerPrivate::hasVideo() const
     return [[m_qtMovie.get() attributeForKey:QTMovieHasVideoAttribute] boolValue];
 }
 
+bool MediaPlayerPrivate::hasAudio() const
+{
+    if (!m_qtMovie)
+        return false;
+    return [[m_qtMovie.get() attributeForKey:QTMovieHasAudioAttribute] boolValue];
+}
+
 void MediaPlayerPrivate::setVolume(float volume)
 {
     if (!metaDataAvailable())
index 76b14943a174c50646ef49142e53fe83c2b83f09..ea50299920813179cc47e3151d6704724666b49a 100644 (file)
@@ -160,6 +160,13 @@ bool MediaPlayerPrivate::hasVideo() const
     return hasVideo;
 }
 
+bool MediaPlayerPrivate::hasAudio() const
+{
+    bool hasAudio = m_mediaObject->hasAudio();
+    LOG(Media, "MediaPlayerPrivatePhonon::hasAudio() -> %s", hasAudio ? "true" : "false");
+    return hasAudio;
+}
+
 void MediaPlayerPrivate::load(const String& url)
 {
     LOG(Media, "MediaPlayerPrivatePhonon::load(\"%s\")", url.utf8().data());
index 9572d61518d1268d41c831a33720397b48a05f7a..042f5b2b811bba2fc4d553a28eaea8eee3cf6bfb 100644 (file)
@@ -80,6 +80,7 @@ namespace WebCore {
 
         IntSize naturalSize() const;
         bool hasVideo() const;
+        bool hasAudio() const;
 
         void load(const String &url);
         void cancelLoad();
index eb7334e1347f18a6481d0a96a058246943ecbf5a..ca063818bf376d4d2a9bcb506c545f14291434d6 100644 (file)
@@ -241,6 +241,13 @@ bool MediaPlayerPrivate::hasVideo() const
     return m_qtMovie->hasVideo();
 }
 
+bool MediaPlayerPrivate::hasAudio() const
+{
+    if (!m_qtMovie)
+        return false;
+    return m_qtMovie->hasAudio();
+}
+
 void MediaPlayerPrivate::setVolume(float volume)
 {
     if (!m_qtMovie)
index f58414857fa2b2dbb10b9b51445c69e4d541f9e2..0c99ea64ae22cc7f6949e5917603e23921cb2568 100644 (file)
@@ -52,7 +52,8 @@ public:
     
     IntSize naturalSize() const;
     bool hasVideo() const;
-    
+    bool hasAudio() const;
+
     void load(const String& url);
     void cancelLoad();
     
index aaa61f166589983c4819cf18059665b97966789a..1ac0fb5398d958d844386c138c83f63697e3daa2 100644 (file)
@@ -867,6 +867,13 @@ bool QTMovieWin::hasVideo() const
     return (GetMovieIndTrackType(m_private->m_movie, 1, VisualMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly));
 }
 
+bool QTMovieWin::hasAudio() const
+{
+    if (!m_private->m_movie)
+        return false;
+    return (GetMovieIndTrackType(m_private->m_movie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly));
+}
+
 pascal OSErr movieDrawingCompleteProc(Movie movie, long data)
 {
     UppParam param;
index f46efd33a42af80387a0494cc03694256d30ec78..d6d946843e16ad39eea45935c67909abff5d33cf 100644 (file)
@@ -91,6 +91,7 @@ public:
     void setDisabled(bool);
 
     bool hasVideo() const;
+    bool hasAudio() const;
 
     static unsigned countSupportedTypes();
     static void getSupportedType(unsigned index, const UChar*& str, unsigned& len);
index 6715111da5251ba180259c7f66bf33d7f0869284..0e5884b0a99a3233f88ec60d2f0010c4a9722e1a 100644 (file)
@@ -347,6 +347,16 @@ void MediaControlMuteButtonElement::updateDisplayType()
     setDisplayType(m_mediaElement->muted() ? MediaUnMuteButton : MediaMuteButton);
 }
 
+bool MediaControlMuteButtonElement::disabled() const
+{
+    return !m_mediaElement->hasAudio();
+}
+
+bool MediaControlMuteButtonElement::rendererIsNeeded(RenderStyle* style)
+{
+    return MediaControlInputElement::rendererIsNeeded(style) && !disabled();
+}
+
 // ----------------------------
 
 MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* document, HTMLMediaElement* element)
index d5fa5d2feeff367d52e0ddef76973f35b28e8a0b..95348b2a9e04d9a6a9d32bdb6d3629c5d5c91782 100644 (file)
@@ -130,6 +130,9 @@ public:
     bool hitTest(const IntPoint& absPoint);
     MediaControlElementType displayType() const { return m_displayType; }
 
+    // Some elements are disabled by movie state (eg. mute if no audio).
+    virtual bool disabled() const  { return false; }
+
 protected:
     virtual void updateDisplayType() { }
     void setDisplayType(MediaControlElementType);
@@ -146,6 +149,8 @@ public:
     MediaControlMuteButtonElement(Document*, HTMLMediaElement*);
     virtual void defaultEventHandler(Event*);
     virtual void updateDisplayType();
+    virtual bool disabled() const;
+    virtual bool rendererIsNeeded(RenderStyle*);
 };
 
 // ----------------------------
index 6315f9f76269d94ff00c4d45bfa41e7fd1be4ffb..8a6464ed4f631037fad4fee3fd6eb8d70a152316 100644 (file)
@@ -1500,7 +1500,9 @@ static unsigned getMediaUIPartStateFlags(Node* node)
 {
     unsigned flags = 0;
 
-    if (node->active())
+    if (node->disabled())
+        flags |= MediaUIPartDisabledFlag;
+    else if (node->active())
         flags |= MediaUIPartPressedFlag;
     return flags;
 }