Changeset 47515 in webkit


Ignore:
Timestamp:
Aug 19, 2009 11:10:44 AM (15 years ago)
Author:
eric.carlson@apple.com
Message:

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 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.
Location:
trunk
Files:
5 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r47512 r47515  
     12009-08-19  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Sound button appears in controller with movies that have no audio
     6        https://bugs.webkit.org/show_bug.cgi?id=28464
     7
     8        * media/video-controls-visible-audio-only.html:
     9        * media/video-no-audio.html: Added.
     10        * platform/mac-leopard/media/video-empty-source-expected.txt:
     11        * platform/mac-leopard/media/video-no-audio-expected.txt: Added.
     12        * platform/mac/media/video-empty-source-expected.txt:
     13        * platform/mac/media/video-no-audio-expected.txt: Added.
     14        * platform/win/media/video-empty-source-expected.txt: Added.
     15        * platform/win/media/video-no-audio-expected.txt: Added.
     16
    1172009-08-19  Alexey Proskuryakov  <ap@apple.com>
    218
  • trunk/LayoutTests/media/video-controls-visible-audio-only.html

    r47140 r47515  
    5959        </script>
    6060    </head>
    61     <body onload="start()">
     61    <body >
    6262
    6363        <p>Test video element control visibility when mouse is not over element.</p>
     
    6666        <p><span id="mouse-parking">mouse parks here, am I blue?</span></p>
    6767
    68         <video id="no-video-media" controls loop src="content/test.wav"></video>
     68        <video id="no-video-media" controls loop src="content/test.wav" onload="start()"></video>
    6969        <br><br><div id="console"></div>
    7070    </body>
  • trunk/LayoutTests/platform/mac-leopard/media/video-empty-source-expected.txt

    r47140 r47515  
    1818  RenderFlexibleBox (positioned) {DIV} at (0,134) size 300x16
    1919    RenderButton {INPUT} at (0,0) size 16x16
    20     RenderButton {INPUT} at (16,0) size 16x16
    21     RenderFlexibleBox {DIV} at (32,0) size 236x16
    22       RenderSlider {INPUT} at (0,0) size 236x16
     20    RenderFlexibleBox {DIV} at (16,0) size 252x16
     21      RenderSlider {INPUT} at (0,0) size 252x16
    2322        RenderBlock {DIV} at (2,1) size 13x14
    2423    RenderButton {INPUT} at (268,0) size 16x16
  • trunk/LayoutTests/platform/mac/media/video-empty-source-expected.txt

    r47140 r47515  
    1818  RenderFlexibleBox (positioned) {DIV} at (0,125) size 300x25
    1919    RenderButton {INPUT} at (6,3) size 18x18
    20     RenderButton {INPUT} at (277,5) size 15x14
    2120    RenderButton {INPUT} at (32,4) size 16x16
  • trunk/WebCore/ChangeLog

    r47514 r47515  
     12009-08-19  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Sound button appears in controller with movies that have no audio
     6        https://bugs.webkit.org/show_bug.cgi?id=28464
     7
     8        Test: media/video-no-audio.html
     9
     10        * html/HTMLMediaElement.cpp:
     11        * html/HTMLMediaElement.h:
     12        (WebCore::HTMLMediaElement::hasAudio):
     13            Added hasAudio.
     14
     15        * platform/graphics/MediaPlayer.h:
     16        * platform/graphics/MediaPlayer.cpp:
     17        (WebCore::NullMediaPlayerPrivate::hasAudio):
     18        (WebCore::MediaPlayer::hasVideo):
     19            Make const.
     20        (WebCore::MediaPlayer::hasAudio):
     21            Added hasAudio.
     22
     23        * platform/graphics/MediaPlayerPrivate.h:
     24            Add hasAudio.
     25
     26        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h:
     27        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
     28        (WebCore::MediaPlayerPrivate::hasAudio):
     29            Ditto.
     30
     31        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
     32        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
     33        (WebCore::MediaPlayerPrivate::hasAudio):
     34            Ditto.
     35
     36        * platform/graphics/qt/MediaPlayerPrivatePhonon.h:
     37        * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
     38        (WebCore::MediaPlayerPrivate::hasAudio):
     39            Ditto.
     40
     41        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h:
     42        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
     43        (WebCore::MediaPlayerPrivate::hasAudio):
     44            Ditto.
     45
     46        * platform/graphics/win/QTMovieWin.h:
     47        * platform/graphics/win/QTMovieWin.cpp:
     48        (QTMovieWin::hasAudio):
     49            Ditto.
     50
     51        * rendering/MediaControlElements.cpp:
     52        (WebCore::MediaControlMuteButtonElement::disabled):
     53            New, return true if media element doesn't have audio.
     54        (WebCore::MediaControlMuteButtonElement::rendererIsNeeded):
     55            Renderer is not needed if element has no audio.
     56        * rendering/MediaControlElements.h:
     57        (WebCore::MediaControlInputElement::disabled):
     58
     59        * rendering/RenderThemeMac.mm:
     60        (WebCore::getMediaUIPartStateFlags):
     61            Return MediaUIPartDisabledFlag if node is disabled.
     62           
     63
    1642009-08-19  Michelangelo De Simone  <micdesim@gmail.com>
    265
  • trunk/WebCore/html/HTMLMediaElement.cpp

    r47459 r47515  
    917917}
    918918
     919bool HTMLMediaElement::hasAudio() const
     920{
     921    return m_player ? m_player->hasAudio() : false;
     922}
     923
    919924bool HTMLMediaElement::seeking() const
    920925{
  • trunk/WebCore/html/HTMLMediaElement.h

    r45894 r47515  
    6666    virtual bool isVideo() const { return false; }
    6767    virtual bool hasVideo() const { return false; }
     68    virtual bool hasAudio() const;
    6869
    6970    void rewind(float timeDelta);
  • trunk/WebCore/platform/graphics/MediaPlayer.cpp

    r46590 r47515  
    7070
    7171    virtual bool hasVideo() const { return false; }
     72    virtual bool hasAudio() const { return false; }
    7273
    7374    virtual void setVisible(bool) { }
     
    319320}
    320321
    321 bool MediaPlayer::hasVideo()
     322bool MediaPlayer::hasVideo() const
    322323{
    323324    return m_private->hasVideo();
     325}
     326
     327bool MediaPlayer::hasAudio() const
     328{
     329    return m_private->hasAudio();
    324330}
    325331
  • trunk/WebCore/platform/graphics/MediaPlayer.h

    r45891 r47515  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    111111    bool supportsSave() const;
    112112    IntSize naturalSize();
    113     bool hasVideo();
     113    bool hasVideo() const;
     114    bool hasAudio() const;
    114115   
    115116    void setFrameView(FrameView* frameView) { m_frameView = frameView; }
  • trunk/WebCore/platform/graphics/MediaPlayerPrivate.h

    r45875 r47515  
    5353
    5454    virtual bool hasVideo() const = 0;
     55    virtual bool hasAudio() const = 0;
    5556
    5657    virtual void setVisible(bool) = 0;
  • trunk/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp

    r46588 r47515  
    326326}
    327327
     328bool MediaPlayerPrivate::hasAudio() const
     329{
     330    gint currentAudio = -1;
     331    if (m_playBin)
     332        g_object_get(G_OBJECT(m_playBin), "current-audio", &currentAudio, 0);
     333    return currentAudio > -1;
     334}
     335
    328336void MediaPlayerPrivate::setVolume(float volume)
    329337{
  • trunk/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h

    r46588 r47515  
    5757            IntSize naturalSize() const;
    5858            bool hasVideo() const;
     59            bool hasAudio() const;
    5960
    6061            void load(const String &url);
  • trunk/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h

    r45986 r47515  
    8080    IntSize naturalSize() const;
    8181    bool hasVideo() const;
     82    bool hasAudio() const;
    8283   
    8384    void load(const String& url);
  • trunk/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

    r45986 r47515  
    8585SOFT_LINK_POINTER(QTKit, QTMovieDidEndNotification, NSString *)
    8686SOFT_LINK_POINTER(QTKit, QTMovieHasVideoAttribute, NSString *)
     87SOFT_LINK_POINTER(QTKit, QTMovieHasAudioAttribute, NSString *)
    8788SOFT_LINK_POINTER(QTKit, QTMovieIsActiveAttribute, NSString *)
    8889SOFT_LINK_POINTER(QTKit, QTMovieLoadStateAttribute, NSString *)
     
    120121#define QTMovieDidEndNotification getQTMovieDidEndNotification()
    121122#define QTMovieHasVideoAttribute getQTMovieHasVideoAttribute()
     123#define QTMovieHasAudioAttribute getQTMovieHasAudioAttribute()
    122124#define QTMovieIsActiveAttribute getQTMovieIsActiveAttribute()
    123125#define QTMovieLoadStateAttribute getQTMovieLoadStateAttribute()
     
    718720        return false;
    719721    return [[m_qtMovie.get() attributeForKey:QTMovieHasVideoAttribute] boolValue];
     722}
     723
     724bool MediaPlayerPrivate::hasAudio() const
     725{
     726    if (!m_qtMovie)
     727        return false;
     728    return [[m_qtMovie.get() attributeForKey:QTMovieHasAudioAttribute] boolValue];
    720729}
    721730
  • trunk/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp

    r46170 r47515  
    159159    LOG(Media, "MediaPlayerPrivatePhonon::hasVideo() -> %s", hasVideo ? "true" : "false");
    160160    return hasVideo;
     161}
     162
     163bool MediaPlayerPrivate::hasAudio() const
     164{
     165    bool hasAudio = m_mediaObject->hasAudio();
     166    LOG(Media, "MediaPlayerPrivatePhonon::hasAudio() -> %s", hasAudio ? "true" : "false");
     167    return hasAudio;
    161168}
    162169
  • trunk/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.h

    r41907 r47515  
    8181        IntSize naturalSize() const;
    8282        bool hasVideo() const;
     83        bool hasAudio() const;
    8384
    8485        void load(const String &url);
  • trunk/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp

    r45758 r47515  
    242242}
    243243
     244bool MediaPlayerPrivate::hasAudio() const
     245{
     246    if (!m_qtMovie)
     247        return false;
     248    return m_qtMovie->hasAudio();
     249}
     250
    244251void MediaPlayerPrivate::setVolume(float volume)
    245252{
  • trunk/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h

    r45060 r47515  
    5353    IntSize naturalSize() const;
    5454    bool hasVideo() const;
    55    
     55    bool hasAudio() const;
     56
    5657    void load(const String& url);
    5758    void cancelLoad();
  • trunk/WebCore/platform/graphics/win/QTMovieWin.cpp

    r45891 r47515  
    868868}
    869869
     870bool QTMovieWin::hasAudio() const
     871{
     872    if (!m_private->m_movie)
     873        return false;
     874    return (GetMovieIndTrackType(m_private->m_movie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly));
     875}
     876
    870877pascal OSErr movieDrawingCompleteProc(Movie movie, long data)
    871878{
  • trunk/WebCore/platform/graphics/win/QTMovieWin.h

    r44999 r47515  
    9292
    9393    bool hasVideo() const;
     94    bool hasAudio() const;
    9495
    9596    static unsigned countSupportedTypes();
  • trunk/WebCore/rendering/MediaControlElements.cpp

    r47374 r47515  
    348348}
    349349
     350bool MediaControlMuteButtonElement::disabled() const
     351{
     352    return !m_mediaElement->hasAudio();
     353}
     354
     355bool MediaControlMuteButtonElement::rendererIsNeeded(RenderStyle* style)
     356{
     357    return MediaControlInputElement::rendererIsNeeded(style) && !disabled();
     358}
     359
    350360// ----------------------------
    351361
  • trunk/WebCore/rendering/MediaControlElements.h

    r47140 r47515  
    131131    MediaControlElementType displayType() const { return m_displayType; }
    132132
     133    // Some elements are disabled by movie state (eg. mute if no audio).
     134    virtual bool disabled() const  { return false; }
     135
    133136protected:
    134137    virtual void updateDisplayType() { }
     
    147150    virtual void defaultEventHandler(Event*);
    148151    virtual void updateDisplayType();
     152    virtual bool disabled() const;
     153    virtual bool rendererIsNeeded(RenderStyle*);
    149154};
    150155
  • trunk/WebCore/rendering/RenderThemeMac.mm

    r46815 r47515  
    15011501    unsigned flags = 0;
    15021502
    1503     if (node->active())
     1503    if (node->disabled())
     1504        flags |= MediaUIPartDisabledFlag;
     1505    else if (node->active())
    15041506        flags |= MediaUIPartPressedFlag;
    15051507    return flags;
Note: See TracChangeset for help on using the changeset viewer.