Changeset 55682 in webkit


Ignore:
Timestamp:
Mar 8, 2010 2:16:00 PM (14 years ago)
Author:
Darin Adler
Message:

2010-03-08 Darin Adler <Darin Adler>

Reviewed by Jon Honeycutt.

https://bugs.webkit.org/show_bug.cgi?id=35876

Fix minor style issues in HTMLMediaElement and classes derived from it.
Made many public members private and protected.

  • html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::screenRect): Got rid of a stray "const" and retstructured the function to use early return and get rid of a local.
  • html/HTMLMediaElement.h: Made lots of members private and some protected. Also use private inheritance instead of public. Removed some unneeded includes.
  • html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::parseMappedAttribute): Use player() instead of m_player; HTMLMediaElement data members are now private, not protected. (WebCore::HTMLVideoElement::supportsFullscreen): Ditto. (WebCore::HTMLVideoElement::videoWidth): Ditto. (WebCore::HTMLVideoElement::videoHeight): Ditto. (WebCore::HTMLVideoElement::hasAvailableVideoFrame): Ditto. (WebCore::HTMLVideoElement::webkitEnterFullScreen): Use isFullscreen() instead of m_isFullscreen; same reason. (WebCore::HTMLVideoElement::webkitExitFullScreen): Ditto. (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Ditto.
  • html/HTMLVideoElement.h: Removed an unneeded include. Made many public functions private. Got rid of unused paint function, which was replaced with paintCurrentFrameInContext a while back.
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55680 r55682  
     12010-03-08  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Jon Honeycutt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=35876
     6
     7        Fix minor style issues in HTMLMediaElement and classes derived from it.
     8        Made many public members private and protected.
     9
     10        * html/HTMLMediaElement.cpp:
     11        (WebCore::HTMLMediaElement::screenRect): Got rid of a stray "const" and
     12        retstructured the function to use early return and get rid of a local.
     13
     14        * html/HTMLMediaElement.h: Made lots of members private and some
     15        protected. Also use private inheritance instead of public. Removed
     16        some unneeded includes.
     17
     18        * html/HTMLVideoElement.cpp:
     19        (WebCore::HTMLVideoElement::parseMappedAttribute): Use player() instead
     20        of m_player; HTMLMediaElement data members are now private, not protected.
     21        (WebCore::HTMLVideoElement::supportsFullscreen): Ditto.
     22        (WebCore::HTMLVideoElement::videoWidth): Ditto.
     23        (WebCore::HTMLVideoElement::videoHeight): Ditto.
     24        (WebCore::HTMLVideoElement::hasAvailableVideoFrame): Ditto.
     25        (WebCore::HTMLVideoElement::webkitEnterFullScreen): Use isFullscreen()
     26        instead of m_isFullscreen; same reason.
     27        (WebCore::HTMLVideoElement::webkitExitFullScreen): Ditto.
     28        (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Ditto.
     29
     30        * html/HTMLVideoElement.h: Removed an unneeded include. Made many
     31        public functions private. Got rid of unused paint function, which was
     32        replaced with paintCurrentFrameInContext a while back.
     33
    1342010-03-08  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
    235
  • trunk/WebCore/html/HTMLMediaElement.cpp

    r55587 r55682  
    18131813}
    18141814
    1815 const IntRect HTMLMediaElement::screenRect()
    1816 {
    1817     IntRect elementRect;
    1818     if (renderer())
    1819         elementRect = renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect());
    1820     return elementRect;
     1815IntRect HTMLMediaElement::screenRect()
     1816{
     1817    if (!renderer())
     1818        return IntRect();
     1819    return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRect());
    18211820}
    18221821   
  • trunk/WebCore/html/HTMLMediaElement.h

    r55463 r55682  
    3131#include "HTMLElement.h"
    3232#include "MediaPlayer.h"
    33 #include "Timer.h"
    34 
    35 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    36 #include "MediaPlayerProxy.h"
    37 #endif
    3833
    3934namespace WebCore {
     
    4540class TimeRanges;
    4641
     42// FIXME: The inheritance from MediaPlayerClient here should be private inheritance.
     43// But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it
     44// no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement.
     45
    4746class HTMLMediaElement : public HTMLElement, public MediaPlayerClient {
    4847public:
    49     virtual ~HTMLMediaElement();
    50 
    51     bool checkDTD(const Node* newChild);
    52    
    53     void attributeChanged(Attribute*, bool preserveDecls);
    54     void parseMappedAttribute(MappedAttribute *);
    55 
    56     virtual bool rendererIsNeeded(RenderStyle*);
    57     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    58     virtual void insertedIntoDocument();
    59     virtual void removedFromDocument();
    60     virtual void attach();
    61     virtual void recalcStyle(StyleChange);
    62    
    6348    MediaPlayer* player() const { return m_player.get(); }
    6449   
     
    8065
    8166    void scheduleLoad();
    82    
    83     virtual void defaultEventHandler(Event*);
    84    
    85     // Pauses playback without changing any states or generating events
    86     void setPausedInternal(bool);
    8767   
    8868    MediaPlayer::MovieLoadType movieLoadType() const;
     
    152132    void endScrubbing();
    153133
    154     const IntRect screenRect();
     134    IntRect screenRect();
    155135
    156136    bool canPlay() const;
     
    160140#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    161141    void setNeedWidgetUpdate(bool needWidgetUpdate) { m_needWidgetUpdate = needWidgetUpdate; }
    162     void deliverNotification(MediaPlayerProxyNotificationType notification);
    163     void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);
     142    void deliverNotification(MediaPlayerProxyNotificationType);
     143    void setMediaPlayerProxy(WebMediaPlayerProxy*);
    164144    String initialURL();
    165145    virtual void finishParsingChildren();
     
    168148    bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSingleSecurityOrigin(); }
    169149   
     150    bool isFullscreen() const { return m_isFullscreen; }
    170151    void enterFullscreen();
    171152    void exitFullscreen();
     
    179160protected:
    180161    HTMLMediaElement(const QualifiedName&, Document*);
    181 
     162    virtual ~HTMLMediaElement();
     163
     164    virtual void parseMappedAttribute(MappedAttribute *);
     165    virtual void attach();
     166
     167private:
     168    virtual bool checkDTD(const Node* newChild);   
     169    virtual void attributeChanged(Attribute*, bool preserveDecls);
     170    virtual bool rendererIsNeeded(RenderStyle*);
     171    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     172    virtual void insertedIntoDocument();
     173    virtual void removedFromDocument();
     174    virtual void recalcStyle(StyleChange);
     175   
     176    virtual void defaultEventHandler(Event*);
     177   
    182178    float getTimeOffsetAttribute(const QualifiedName&, float valueOnError) const;
    183179    void setTimeOffsetAttribute(const QualifiedName&, float value);
     
    194190    virtual void didMoveToNewOwnerDocument();
    195191
    196 private: // MediaPlayerClient
    197192    virtual Document* mediaPlayerOwningDocument();
    198193    virtual void mediaPlayerNetworkStateChanged(MediaPlayer*);
     
    211206#endif
    212207
    213 private:
    214208    void loadTimerFired(Timer<HTMLMediaElement>*);
    215209    void asyncEventTimerFired(Timer<HTMLMediaElement>*);
     
    266260    float maxTimeSeekable() const;
    267261
    268     // Restrictions to change default behaviors. This is a effectively a compile time choice at the moment
    269     //  because there are no accessor methods.
     262    // Pauses playback without changing any states or generating events
     263    void setPausedInternal(bool);
     264
     265    // Restrictions to change default behaviors. This is effectively a compile time choice at the moment
     266    // because there are no accessor functions.
    270267    enum BehaviorRestrictions {
    271268        NoRestrictions = 0,
     
    274271    };
    275272
    276 protected:
    277273    Timer<HTMLMediaElement> m_loadTimer;
    278274    Timer<HTMLMediaElement> m_asyncEventTimer;
     
    306302    enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElement };
    307303    LoadState m_loadState;
    308     HTMLSourceElement *m_currentSourceNode;
     304    HTMLSourceElement* m_currentSourceNode;
    309305   
    310306    OwnPtr<MediaPlayer> m_player;
  • trunk/WebCore/html/HTMLVideoElement.cpp

    r54182 r55682  
    105105            m_imageLoader->updateFromElementIgnoringPreviousError();
    106106#else
    107             if (m_player)
    108                 m_player->setPoster(poster());
     107            if (player())
     108                player()->setPoster(poster());
    109109#endif
    110110        }
     
    123123        return false;
    124124
    125     if (!m_player || !m_player->supportsFullscreen() || !m_player->hasVideo())
     125    if (!player() || !player()->supportsFullscreen() || !player()->hasVideo())
    126126        return false;
    127127
     
    132132unsigned HTMLVideoElement::videoWidth() const
    133133{
    134     if (!m_player)
     134    if (!player())
    135135        return 0;
    136     return m_player->naturalSize().width();
     136    return player()->naturalSize().width();
    137137}
    138138
    139139unsigned HTMLVideoElement::videoHeight() const
    140140{
    141     if (!m_player)
     141    if (!player())
    142142        return 0;
    143     return m_player->naturalSize().height();
     143    return player()->naturalSize().height();
    144144}
    145145
     
    197197}
    198198
    199 void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& destRect)
     199void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)
    200200{
    201201    MediaPlayer* player = HTMLMediaElement::player();
    202202    if (!player)
    203203        return;
    204 
    205     player->setVisible(true); // Make player visible or it won't draw.
    206     player->paint(context, destRect);
    207 }
    208 
    209 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)
    210 {
    211     MediaPlayer* player = HTMLMediaElement::player();
    212     if (!player)
    213         return;
    214204   
    215205    player->setVisible(true); // Make player visible or it won't draw.
     
    219209bool HTMLVideoElement::hasAvailableVideoFrame() const
    220210{
    221     if (!m_player)
     211    if (!player())
    222212        return false;
    223213   
    224     return m_player->hasAvailableVideoFrame();
     214    return player()->hasAvailableVideoFrame();
    225215}
    226216
    227217void HTMLVideoElement::webkitEnterFullScreen(bool isUserGesture, ExceptionCode& ec)
    228218{
    229     if (m_isFullscreen)
     219    if (isFullscreen())
    230220        return;
    231221
     
    242232void HTMLVideoElement::webkitExitFullScreen()
    243233{
    244     if (m_isFullscreen)
     234    if (isFullscreen())
    245235        exitFullscreen();
    246236}
     
    253243bool HTMLVideoElement::webkitDisplayingFullscreen()
    254244{
    255     return m_isFullscreen;
    256 }
    257 
    258 
    259 }
    260 #endif
     245    return isFullscreen();
     246}
     247
     248
     249}
     250#endif
  • trunk/WebCore/html/HTMLVideoElement.h

    r54828 r55682  
    3030
    3131#include "HTMLMediaElement.h"
    32 #include <wtf/OwnPtr.h>
    3332
    3433namespace WebCore {
     
    3938public:
    4039    HTMLVideoElement(const QualifiedName&, Document*);
    41 
    42     virtual int tagPriority() const { return 5; }
    43     virtual bool rendererIsNeeded(RenderStyle*);
    44 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    45     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    46 #endif
    47     virtual void attach();
    48     virtual void detach();
    49     virtual void parseMappedAttribute(MappedAttribute* attr);
    50     virtual bool isVideo() const { return true; }
    51     virtual bool hasVideo() const { return player() && player()->hasVideo(); }
    52     virtual bool supportsFullscreen() const;
    53     virtual bool isURLAttribute(Attribute*) const;
    54     virtual const QualifiedName& imageSourceAttributeName() const;
    5540
    5641    unsigned width() const;
     
    7358    bool shouldDisplayPosterImage() const { return m_shouldDisplayPosterImage; }
    7459
    75     void paint(GraphicsContext*, const IntRect&);
    7660    // Used by canvas to gain raw pixel access
    7761    void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
    7862
    7963private:
     64    virtual int tagPriority() const { return 5; }
     65    virtual bool rendererIsNeeded(RenderStyle*);
     66#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     67    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     68#endif
     69    virtual void attach();
     70    virtual void detach();
     71    virtual void parseMappedAttribute(MappedAttribute*);
     72    virtual bool isVideo() const { return true; }
     73    virtual bool hasVideo() const { return player() && player()->hasVideo(); }
     74    virtual bool supportsFullscreen() const;
     75    virtual bool isURLAttribute(Attribute*) const;
     76    virtual const QualifiedName& imageSourceAttributeName() const;
     77
    8078    virtual bool hasAvailableVideoFrame() const;
    8179    virtual void updatePosterImage();
Note: See TracChangeset for help on using the changeset viewer.