Changeset 174505 in webkit


Ignore:
Timestamp:
Oct 9, 2014 9:18:46 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

Layering violation: MediaPlayer should not reference/use FrameView
https://bugs.webkit.org/show_bug.cgi?id=21562

Reviewed by Darin Adler.

Remove FrameView dependency from MediaPlayer.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::mediaPlayerIsInMediaDocument): Check if
the element document is a media document.

  • html/HTMLMediaElement.h:
  • platform/graphics/MediaPlayer.cpp:

(WebCore::MediaPlayer::MediaPlayer): Remove m_frameView initialization.
(WebCore::MediaPlayer::inMediaDocument): Use the MediaPlayerClient
to check if the media player is in a media document.

  • platform/graphics/MediaPlayer.h:

(WebCore::MediaPlayerClient::mediaPlayerIsInMediaDocument):
(WebCore::MediaPlayer::setFrameView): Deleted.
(WebCore::MediaPlayer::frameView): Deleted.

  • platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:

(WebCore::MediaPlayerPrivateAVFoundation::preferredRenderingMode):
Do not check if the media player has a frame view, checking whether it's visible
is enough.

  • platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:

Remove unneeded header include.

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
  • platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Ditto.
  • rendering/RenderVideo.cpp:

(WebCore::RenderVideo::~RenderVideo): Do not call MediaPlayer::setFrameView().
(WebCore::RenderVideo::updatePlayer): Ditto.

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r174504 r174505  
     12014-10-09  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Layering violation: MediaPlayer should not reference/use FrameView
     4        https://bugs.webkit.org/show_bug.cgi?id=21562
     5
     6        Reviewed by Darin Adler.
     7
     8        Remove FrameView dependency from MediaPlayer.
     9
     10        * html/HTMLMediaElement.cpp:
     11        (WebCore::HTMLMediaElement::mediaPlayerIsInMediaDocument): Check if
     12        the element document is a media document.
     13        * html/HTMLMediaElement.h:
     14        * platform/graphics/MediaPlayer.cpp:
     15        (WebCore::MediaPlayer::MediaPlayer): Remove m_frameView initialization.
     16        (WebCore::MediaPlayer::inMediaDocument): Use the MediaPlayerClient
     17        to check if the media player is in a media document.
     18        * platform/graphics/MediaPlayer.h:
     19        (WebCore::MediaPlayerClient::mediaPlayerIsInMediaDocument):
     20        (WebCore::MediaPlayer::setFrameView): Deleted.
     21        (WebCore::MediaPlayer::frameView): Deleted.
     22        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
     23        (WebCore::MediaPlayerPrivateAVFoundation::preferredRenderingMode):
     24        Do not check if the media player has a frame view, checking whether it's visible
     25        is enough.
     26        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
     27        Remove unneeded header include.
     28        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
     29        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: Ditto.
     30        * rendering/RenderVideo.cpp:
     31        (WebCore::RenderVideo::~RenderVideo): Do not call MediaPlayer::setFrameView().
     32        (WebCore::RenderVideo::updatePlayer): Ditto.
     33
    1342014-10-09  Christophe Dumez  <cdumez@apple.com>
    235
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r174353 r174505  
    57095709}
    57105710#endif
    5711    
     5711
     5712bool HTMLMediaElement::mediaPlayerIsInMediaDocument() const
     5713{
     5714    return document().isMediaDocument();
     5715}
     5716
    57125717void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
    57135718{
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r174353 r174505  
    584584#endif
    585585
     586    virtual bool mediaPlayerIsInMediaDocument() const override final;
     587
    586588    void loadTimerFired(Timer<HTMLMediaElement>&);
    587589    void progressEventTimerFired(Timer<HTMLMediaElement>&);
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r174071 r174505  
    3131#include "ContentType.h"
    3232#include "Document.h"
    33 #include "Frame.h"
    34 #include "FrameView.h"
    3533#include "IntRect.h"
    3634#include "Logging.h"
     
    313311    , m_private(createNullMediaPlayer(this))
    314312    , m_currentMediaEngine(0)
    315     , m_frameView(0)
    316313    , m_preload(Auto)
    317314    , m_visible(false)
     
    590587}
    591588
    592 bool MediaPlayer::inMediaDocument()
    593 {
    594     if (!m_frameView)
    595         return false;
    596     Document* document = m_frameView->frame().document();
    597     return document && document->isMediaDocument();
     589bool MediaPlayer::inMediaDocument() const
     590{
     591    return m_visible && m_mediaPlayerClient && m_mediaPlayerClient->mediaPlayerIsInMediaDocument();
    598592}
    599593
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.h

    r174071 r174505  
    130130class CachedResourceLoader;
    131131class ContentType;
    132 class FrameView;
    133132class GraphicsContext;
    134133class GraphicsContext3D;
     
    265264
    266265    virtual String mediaPlayerSourceApplicationIdentifier() const { return emptyString(); }
     266
     267    virtual bool mediaPlayerIsInMediaDocument() const { return false; }
    267268};
    268269
     
    317318    bool hasAudio() const;
    318319
    319     void setFrameView(FrameView* frameView) { m_frameView = frameView; }
    320     FrameView* frameView() { return m_frameView; }
    321     bool inMediaDocument();
     320    bool inMediaDocument() const;
    322321
    323322    IntSize size() const { return m_size; }
     
    595594    String m_contentTypeCodecs;
    596595    String m_keySystem;
    597     FrameView* m_frameView;
    598596    IntSize m_size;
    599597    Preload m_preload;
  • trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp

    r173453 r174505  
    3232#include "DocumentLoader.h"
    3333#include "FloatConversion.h"
    34 #include "Frame.h"
    35 #include "FrameView.h"
    3634#include "GraphicsContext.h"
    3735#include "InbandTextTrackPrivateAVF.h"
     
    105103MediaPlayerPrivateAVFoundation::MediaRenderingMode MediaPlayerPrivateAVFoundation::preferredRenderingMode() const
    106104{
    107     if (!m_player->visible() || !m_player->frameView() || assetStatus() == MediaPlayerAVAssetStatusUnknown)
     105    if (!m_player->visible() || assetStatus() == MediaPlayerAVAssetStatusUnknown)
    108106        return MediaRenderingNone;
    109107
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp

    r174350 r174505  
    3636#include "COMPtr.h"
    3737#include "FloatConversion.h"
    38 #include "FrameView.h"
    3938#include "GraphicsContext.h"
    4039#if HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r174277 r174505  
    3939#import "FloatConversion.h"
    4040#import "FloatConversion.h"
    41 #import "FrameView.h"
    4241#import "GraphicsContext.h"
    4342#import "GraphicsContextCG.h"
  • trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

    r174106 r174505  
    3232#import "BlockExceptions.h"
    3333#import "DocumentLoader.h"
    34 #import "Frame.h"
    35 #import "HostWindow.h"
    3634#import "GraphicsContext.h"
    3735#import "URL.h"
  • trunk/Source/WebCore/rendering/RenderVideo.cpp

    r173893 r174505  
    5757RenderVideo::~RenderVideo()
    5858{
    59     if (MediaPlayer* player = videoElement().player()) {
     59    if (MediaPlayer* player = videoElement().player())
    6060        player->setVisible(false);
    61         player->setFrameView(0);
    62     }
    6361}
    6462
     
    234232   
    235233    IntRect videoBounds = videoBox();
    236     mediaPlayer->setFrameView(&view().frameView());
    237234    mediaPlayer->setSize(IntSize(videoBounds.width(), videoBounds.height()));
    238235    mediaPlayer->setVisible(true);
Note: See TracChangeset for help on using the changeset viewer.