Title: [174505] trunk/Source/WebCore
Revision
174505
Author
carlo...@webkit.org
Date
2014-10-09 09:18:46 -0700 (Thu, 09 Oct 2014)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174504 => 174505)


--- trunk/Source/WebCore/ChangeLog	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/ChangeLog	2014-10-09 16:18:46 UTC (rev 174505)
@@ -1,3 +1,36 @@
+2014-10-09  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        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.
+
 2014-10-09  Christophe Dumez  <cdu...@apple.com>
 
         Use is<>() / downcast<>() for RenderBlockFlow

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (174504 => 174505)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-10-09 16:18:46 UTC (rev 174505)
@@ -5708,7 +5708,12 @@
     return getRawCookies(&document(), url, cookies);
 }
 #endif
-    
+
+bool HTMLMediaElement::mediaPlayerIsInMediaDocument() const
+{
+    return document().isMediaDocument();
+}
+
 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
 {
     m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequireUserGestureForLoad);

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (174504 => 174505)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2014-10-09 16:18:46 UTC (rev 174505)
@@ -583,6 +583,8 @@
     virtual bool mediaPlayerGetRawCookies(const URL&, Vector<Cookie>&) const override;
 #endif
 
+    virtual bool mediaPlayerIsInMediaDocument() const override final;
+
     void loadTimerFired(Timer<HTMLMediaElement>&);
     void progressEventTimerFired(Timer<HTMLMediaElement>&);
     void playbackProgressTimerFired(Timer<HTMLMediaElement>&);

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (174504 => 174505)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2014-10-09 16:18:46 UTC (rev 174505)
@@ -30,8 +30,6 @@
 
 #include "ContentType.h"
 #include "Document.h"
-#include "Frame.h"
-#include "FrameView.h"
 #include "IntRect.h"
 #include "Logging.h"
 #include "MIMETypeRegistry.h"
@@ -312,7 +310,6 @@
     , m_reloadTimer(this, &MediaPlayer::reloadTimerFired)
     , m_private(createNullMediaPlayer(this))
     , m_currentMediaEngine(0)
-    , m_frameView(0)
     , m_preload(Auto)
     , m_visible(false)
     , m_rate(1.0f)
@@ -589,12 +586,9 @@
     return m_private->hasAudio();
 }
 
-bool MediaPlayer::inMediaDocument()
+bool MediaPlayer::inMediaDocument() const
 {
-    if (!m_frameView)
-        return false;
-    Document* document = m_frameView->frame().document();
-    return document && document->isMediaDocument();
+    return m_visible && m_mediaPlayerClient && m_mediaPlayerClient->mediaPlayerIsInMediaDocument();
 }
 
 PlatformMedia MediaPlayer::platformMedia() const

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (174504 => 174505)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2014-10-09 16:18:46 UTC (rev 174505)
@@ -129,7 +129,6 @@
 
 class CachedResourceLoader;
 class ContentType;
-class FrameView;
 class GraphicsContext;
 class GraphicsContext3D;
 class IntRect;
@@ -264,6 +263,8 @@
     virtual void mediaPlayerHandlePlaybackCommand(MediaSession::RemoteControlCommandType) { }
 
     virtual String mediaPlayerSourceApplicationIdentifier() const { return emptyString(); }
+
+    virtual bool mediaPlayerIsInMediaDocument() const { return false; }
 };
 
 class MediaPlayerSupportsTypeClient {
@@ -316,9 +317,7 @@
     bool hasVideo() const;
     bool hasAudio() const;
 
-    void setFrameView(FrameView* frameView) { m_frameView = frameView; }
-    FrameView* frameView() { return m_frameView; }
-    bool inMediaDocument();
+    bool inMediaDocument() const;
 
     IntSize size() const { return m_size; }
     void setSize(const IntSize& size);
@@ -594,7 +593,6 @@
     String m_contentMIMEType;
     String m_contentTypeCodecs;
     String m_keySystem;
-    FrameView* m_frameView;
     IntSize m_size;
     Preload m_preload;
     bool m_visible;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (174504 => 174505)


--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2014-10-09 16:18:46 UTC (rev 174505)
@@ -31,8 +31,6 @@
 
 #include "DocumentLoader.h"
 #include "FloatConversion.h"
-#include "Frame.h"
-#include "FrameView.h"
 #include "GraphicsContext.h"
 #include "InbandTextTrackPrivateAVF.h"
 #include "InbandTextTrackPrivateClient.h"
@@ -104,7 +102,7 @@
 
 MediaPlayerPrivateAVFoundation::MediaRenderingMode MediaPlayerPrivateAVFoundation::preferredRenderingMode() const
 {
-    if (!m_player->visible() || !m_player->frameView() || assetStatus() == MediaPlayerAVAssetStatusUnknown)
+    if (!m_player->visible() || assetStatus() == MediaPlayerAVAssetStatusUnknown)
         return MediaRenderingNone;
 
     if (supportsAcceleratedRendering() && m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player))

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (174504 => 174505)


--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp	2014-10-09 16:18:46 UTC (rev 174505)
@@ -35,7 +35,6 @@
 #include "CDMSessionAVFoundationCF.h"
 #include "COMPtr.h"
 #include "FloatConversion.h"
-#include "FrameView.h"
 #include "GraphicsContext.h"
 #if HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
 #include "InbandTextTrackPrivateAVCF.h"

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (174504 => 174505)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-10-09 16:18:46 UTC (rev 174505)
@@ -38,7 +38,6 @@
 #import "ExceptionCodePlaceholder.h"
 #import "FloatConversion.h"
 #import "FloatConversion.h"
-#import "FrameView.h"
 #import "GraphicsContext.h"
 #import "GraphicsContextCG.h"
 #import "InbandMetadataTextTrackPrivateAVF.h"

Modified: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (174504 => 174505)


--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-10-09 16:18:46 UTC (rev 174505)
@@ -31,8 +31,6 @@
 
 #import "BlockExceptions.h"
 #import "DocumentLoader.h"
-#import "Frame.h"
-#import "HostWindow.h"
 #import "GraphicsContext.h"
 #import "URL.h"
 #import "Logging.h"

Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (174504 => 174505)


--- trunk/Source/WebCore/rendering/RenderVideo.cpp	2014-10-09 16:17:06 UTC (rev 174504)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp	2014-10-09 16:18:46 UTC (rev 174505)
@@ -56,10 +56,8 @@
 
 RenderVideo::~RenderVideo()
 {
-    if (MediaPlayer* player = videoElement().player()) {
+    if (MediaPlayer* player = videoElement().player())
         player->setVisible(false);
-        player->setFrameView(0);
-    }
 }
 
 IntSize RenderVideo::defaultSize()
@@ -233,7 +231,6 @@
     contentChanged(VideoChanged);
     
     IntRect videoBounds = videoBox(); 
-    mediaPlayer->setFrameView(&view().frameView());
     mediaPlayer->setSize(IntSize(videoBounds.width(), videoBounds.height()));
     mediaPlayer->setVisible(true);
     mediaPlayer->setShouldMaintainAspectRatio(style().objectFit() != ObjectFitFill);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to