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
+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.
</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>
--- /dev/null
+<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>
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
--- /dev/null
+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
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
--- /dev/null
+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"
--- /dev/null
+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
--- /dev/null
+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
+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.
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;
virtual bool isVideo() const { return false; }
virtual bool hasVideo() const { return false; }
+ virtual bool hasAudio() const;
void rewind(float timeDelta);
void returnToRealtime();
virtual IntSize naturalSize() const { return IntSize(0, 0); }
virtual bool hasVideo() const { return false; }
+ virtual bool hasAudio() const { return false; }
virtual void setVisible(bool) { }
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;
/*
- * 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
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; }
virtual IntSize naturalSize() const = 0;
virtual bool hasVideo() const = 0;
+ virtual bool hasAudio() const = 0;
virtual void setVisible(bool) = 0;
return currentVideo > -1;
}
+bool MediaPlayerPrivate::hasAudio() const
+{
+ gint currentAudio = -1;
+ if (m_playBin)
+ g_object_get(G_OBJECT(m_playBin), "current-audio", ¤tAudio, 0);
+ return currentAudio > -1;
+}
+
void MediaPlayerPrivate::setVolume(float volume)
{
m_volume = volume;
IntSize naturalSize() const;
bool hasVideo() const;
+ bool hasAudio() const;
void load(const String &url);
void cancelLoad();
IntSize naturalSize() const;
bool hasVideo() const;
+ bool hasAudio() const;
void load(const String& url);
void cancelLoad();
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 *)
#define QTMovieDataSizeAttribute getQTMovieDataSizeAttribute()
#define QTMovieDidEndNotification getQTMovieDidEndNotification()
#define QTMovieHasVideoAttribute getQTMovieHasVideoAttribute()
+#define QTMovieHasAudioAttribute getQTMovieHasAudioAttribute()
#define QTMovieIsActiveAttribute getQTMovieIsActiveAttribute()
#define QTMovieLoadStateAttribute getQTMovieLoadStateAttribute()
#define QTMovieLoadStateDidChangeNotification getQTMovieLoadStateDidChangeNotification()
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())
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());
IntSize naturalSize() const;
bool hasVideo() const;
+ bool hasAudio() const;
void load(const String &url);
void cancelLoad();
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)
IntSize naturalSize() const;
bool hasVideo() const;
-
+ bool hasAudio() const;
+
void load(const String& url);
void cancelLoad();
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;
void setDisabled(bool);
bool hasVideo() const;
+ bool hasAudio() const;
static unsigned countSupportedTypes();
static void getSupportedType(unsigned index, const UChar*& str, unsigned& len);
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)
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);
MediaControlMuteButtonElement(Document*, HTMLMediaElement*);
virtual void defaultEventHandler(Event*);
virtual void updateDisplayType();
+ virtual bool disabled() const;
+ virtual bool rendererIsNeeded(RenderStyle*);
};
// ----------------------------
{
unsigned flags = 0;
- if (node->active())
+ if (node->disabled())
+ flags |= MediaUIPartDisabledFlag;
+ else if (node->active())
flags |= MediaUIPartPressedFlag;
return flags;
}