Diff
Modified: trunk/Source/WebCore/ChangeLog (229823 => 229824)
--- trunk/Source/WebCore/ChangeLog 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/ChangeLog 2018-03-21 21:13:58 UTC (rev 229824)
@@ -1,3 +1,60 @@
+2018-03-21 Eric Carlson <[email protected]>
+
+ Clean up platform VideoFullscreenLayerManager
+ https://bugs.webkit.org/show_bug.cgi?id=183859
+ <rdar://problem/38715419>
+
+ Reviewed by Jer Noble.
+
+ No new tests, no functional change.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
+ (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
+ (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame):
+ * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
+ * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm.
+ (-[WebVideoContainerLayer setBounds:]):
+ (-[WebVideoContainerLayer setPosition:]):
+ (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
+ (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
+ (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
+ (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
+ (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
+ (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const):
+ (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
+ (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
+
2018-03-21 Antoine Quint <[email protected]>
[Web Animations] Dispatch DOM events for CSS Transitions and CSS Animations implemented as Web Animations
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (229823 => 229824)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-03-21 21:13:58 UTC (rev 229824)
@@ -126,6 +126,7 @@
074E82BB18A69F0E007EF54C /* PlatformTimeRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = 074E82B918A69F0E007EF54C /* PlatformTimeRanges.h */; settings = {ATTRIBUTES = (Private, ); }; };
0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0753860014489E9800B78452 /* CachedTextTrack.cpp */; };
0753860314489E9800B78452 /* CachedTextTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 0753860114489E9800B78452 /* CachedTextTrack.h */; };
+ 075BA84920618AA500FCB4AD /* VideoFullscreenLayerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */; };
07638A991884487200E15A1B /* MediaSessionManagerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 07638A971884487200E15A1B /* MediaSessionManagerIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07638A981884487200E15A1B /* MediaSessionManagerIOS.mm */; };
076970861463AD8700F502CF /* TextTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 076970841463AD8700F502CF /* TextTrackList.cpp */; };
@@ -1525,7 +1526,7 @@
52B0D4BE1C57FD1E0077CE53 /* PlatformView.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */; settings = {ATTRIBUTES = (Private, ); }; };
52B0D4C01C57FD660077CE53 /* VideoFullscreenChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
52B0D4C21C57FF910077CE53 /* VideoFullscreenInterfaceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */; };
+ 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManagerObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */; };
52D5A1A71C57489D00DE34A3 /* VideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A41C57488900DE34A3 /* VideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; };
52D5A1A81C5748A300DE34A3 /* VideoFullscreenModelVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A51C57488900DE34A3 /* VideoFullscreenModelVideoElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
52E2CAFC19FF0207001EEB4F /* MediaProducer.h in Headers */ = {isa = PBXBuildFile; fileRef = 52E2CAFB19FF0207001EEB4F /* MediaProducer.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5262,6 +5263,7 @@
074E82B918A69F0E007EF54C /* PlatformTimeRanges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformTimeRanges.h; sourceTree = "<group>"; };
0753860014489E9800B78452 /* CachedTextTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedTextTrack.cpp; sourceTree = "<group>"; };
0753860114489E9800B78452 /* CachedTextTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedTextTrack.h; sourceTree = "<group>"; };
+ 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManager.h; sourceTree = "<group>"; };
07638A971884487200E15A1B /* MediaSessionManagerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerIOS.h; sourceTree = "<group>"; };
07638A981884487200E15A1B /* MediaSessionManagerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSessionManagerIOS.mm; sourceTree = "<group>"; };
076970841463AD8700F502CF /* TextTrackList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextTrackList.cpp; sourceTree = "<group>"; };
@@ -8086,8 +8088,8 @@
52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformView.h; sourceTree = "<group>"; };
52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenChangeObserver.h; sourceTree = "<group>"; };
52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenInterfaceMac.h; sourceTree = "<group>"; };
- 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManager.mm; sourceTree = "<group>"; };
- 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManager.h; sourceTree = "<group>"; };
+ 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManagerObjC.mm; sourceTree = "<group>"; };
+ 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManagerObjC.h; sourceTree = "<group>"; };
52D5A1A41C57488900DE34A3 /* VideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenModel.h; sourceTree = "<group>"; };
52D5A1A51C57488900DE34A3 /* VideoFullscreenModelVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenModelVideoElement.h; sourceTree = "<group>"; };
52D5A1A61C57488900DE34A3 /* VideoFullscreenModelVideoElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenModelVideoElement.mm; sourceTree = "<group>"; };
@@ -23411,6 +23413,7 @@
076E11BE1F683E0D00177395 /* TrackPrivateBase.cpp */,
BE913D7F181EF8E500DCB09E /* TrackPrivateBase.h */,
E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */,
+ 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */,
BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */,
1411DCB0164C39A800D49BC1 /* WidthCache.h */,
939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */,
@@ -24628,8 +24631,8 @@
7A29F57118C69514004D0F81 /* OutOfBandTextTrackPrivateAVF.h */,
CDC8B5A918047FF10016E685 /* SourceBufferPrivateAVFObjC.h */,
CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */,
- 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManager.h */,
- 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */,
+ 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */,
+ 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */,
CD336F6517FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.cpp */,
CD336F6617FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.h */,
CD8B5A41180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h */,
@@ -30398,6 +30401,7 @@
52B0D4C01C57FD660077CE53 /* VideoFullscreenChangeObserver.h in Headers */,
3FBC4AF4189881560046EE38 /* VideoFullscreenInterfaceAVKit.h in Headers */,
52B0D4C21C57FF910077CE53 /* VideoFullscreenInterfaceMac.h in Headers */,
+ 075BA84920618AA500FCB4AD /* VideoFullscreenLayerManager.h in Headers */,
52D5A1A71C57489D00DE34A3 /* VideoFullscreenModel.h in Headers */,
52D5A1A81C5748A300DE34A3 /* VideoFullscreenModelVideoElement.h in Headers */,
CDE83DB2183C44060031EAA3 /* VideoPlaybackQuality.h in Headers */,
@@ -31769,7 +31773,7 @@
7C73FB07191EF417007DE061 /* UserMessageHandlersNamespace.cpp in Sources */,
837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */,
3FBC4AF3189881560046EE38 /* VideoFullscreenInterfaceAVKit.mm in Sources */,
- 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManager.mm in Sources */,
+ 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManagerObjC.mm in Sources */,
BE88E0DE1715D2A200658D98 /* VideoTrack.cpp in Sources */,
BE88E0E11715D2A200658D98 /* VideoTrackList.cpp in Sources */,
CD336F6717FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.cpp in Sources */,
Copied: trunk/Source/WebCore/platform/graphics/VideoFullscreenLayerManager.h (from rev 229823, trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h) (0 => 229824)
--- trunk/Source/WebCore/platform/graphics/VideoFullscreenLayerManager.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/VideoFullscreenLayerManager.h 2018-03-21 21:13:58 UTC (rev 229824)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "PlatformLayer.h"
+#include <wtf/Function.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class FloatRect;
+class IntSize;
+class TextTrackRepresentation;
+
+class VideoFullscreenLayerManager {
+ WTF_MAKE_NONCOPYABLE(VideoFullscreenLayerManager);
+public:
+ VideoFullscreenLayerManager() = default;
+ virtual ~VideoFullscreenLayerManager() { }
+
+ virtual PlatformLayer *videoInlineLayer() const = 0;
+ virtual PlatformLayer *videoFullscreenLayer() const = 0;
+ virtual FloatRect videoFullscreenFrame() const = 0;
+ virtual void setVideoLayer(PlatformLayer*, IntSize) = 0;
+ virtual void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) = 0;
+ virtual void setVideoFullscreenFrame(FloatRect) = 0;
+ virtual void didDestroyVideoLayer() = 0;
+
+ virtual bool requiresTextTrackRepresentation() const = 0;
+ virtual void setTextTrackRepresentation(TextTrackRepresentation*) = 0;
+ virtual void syncTextTrackBounds() = 0;
+};
+
+}
+
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2018-03-21 21:13:58 UTC (rev 229824)
@@ -72,12 +72,9 @@
class VideoTrackPrivateAVFObjC;
class WebCoreAVFResourceLoader;
class TextureCacheCV;
+class VideoFullscreenLayerManagerObjC;
class VideoTextureCopierCV;
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-class VideoFullscreenLayerManager;
-#endif
-
class MediaPlayerPrivateAVFoundationObjC : public MediaPlayerPrivateAVFoundation {
public:
explicit MediaPlayerPrivateAVFoundationObjC(MediaPlayer*);
@@ -188,12 +185,10 @@
void paint(GraphicsContext&, const FloatRect&) override;
void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&) override;
PlatformLayer* platformLayer() const override;
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override;
void setVideoFullscreenFrame(FloatRect) override;
void setVideoFullscreenGravity(MediaPlayer::VideoGravity) override;
void setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode) override;
-#endif
#if PLATFORM(IOS)
NSArray *timedMetadata() const override;
@@ -343,11 +338,8 @@
RetainPtr<AVPlayer> m_avPlayer;
RetainPtr<AVPlayerItem> m_avPlayerItem;
RetainPtr<AVPlayerLayer> m_videoLayer;
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;
+ std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
MediaPlayer::VideoGravity m_videoFullscreenGravity;
- RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
-#endif
RetainPtr<WebCoreAVFMovieObserver> m_objcObserver;
RetainPtr<id> m_timeObserver;
mutable String m_languageOfPrimaryAudioTrack;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2018-03-21 21:13:58 UTC (rev 229824)
@@ -60,6 +60,7 @@
#import "TextTrackRepresentation.h"
#import "TextureCacheCV.h"
#import "URL.h"
+#import "VideoFullscreenLayerManagerObjC.h"
#import "VideoTextureCopierCV.h"
#import "VideoTrackPrivateAVFObjC.h"
#import "WebCoreAVFResourceLoader.h"
@@ -98,10 +99,6 @@
#import <AVFoundation/AVPlayerLayer.h>
#import <AVFoundation/AVTime.h>
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-#import "VideoFullscreenLayerManager.h"
-#endif
-
#if PLATFORM(IOS)
#import "WAKAppKitStubs.h"
#import <CoreImage/CoreImage.h>
@@ -488,10 +485,8 @@
MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player)
: MediaPlayerPrivateAVFoundation(player)
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>())
+ , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>())
, m_videoFullscreenGravity(MediaPlayer::VideoGravityResizeAspect)
-#endif
, m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithCallback:this]))
, m_videoFrameHasDrawn(false)
, m_haveCheckedPlayability(false)
@@ -707,7 +702,6 @@
IntSize defaultSize = snappedIntRect(player()->client().mediaPlayerContentBoxRect()).size();
INFO_LOG(LOGIDENTIFIER);
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
m_videoFullscreenLayerManager->setVideoLayer(m_videoLayer.get(), defaultSize);
#if PLATFORM(IOS) && !ENABLE(EXTRA_ZOOM_MODE)
@@ -714,9 +708,6 @@
if ([m_videoLayer respondsToSelector:@selector(setPIPModeEnabled:)])
[m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)];
#endif
-#else
- [m_videoLayer setFrame:CGRectMake(0, 0, defaultSize.width(), defaultSize.height())];
-#endif
}
void MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer()
@@ -728,10 +719,7 @@
[m_videoLayer removeObserver:m_objcObserver.get() forKeyPath:@"readyForDisplay"];
[m_videoLayer setPlayer:nil];
-
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
m_videoFullscreenLayerManager->didDestroyVideoLayer();
-#endif
m_videoLayer = nil;
}
@@ -1172,33 +1160,12 @@
PlatformLayer* MediaPlayerPrivateAVFoundationObjC::platformLayer() const
{
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- return m_haveBeenAskedToCreateLayer ? m_videoFullscreenLayerManager->videoInlineLayer() : nullptr;
-#else
- return m_haveBeenAskedToCreateLayer ? m_videoLayer.get() : nullptr;
-#endif
+ return m_videoFullscreenLayerManager->videoInlineLayer();
}
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer(PlatformLayer* videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
{
- if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {
- completionHandler();
- return;
- }
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
-
- if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
- syncTextTrackBounds();
- [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
- }
-
- [CATransaction commit];
-
updateDisableExternalPlayback();
}
@@ -1205,7 +1172,6 @@
void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame(FloatRect frame)
{
m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
- syncTextTrackBounds();
}
void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity(MediaPlayer::VideoGravity gravity)
@@ -1243,8 +1209,6 @@
#endif
}
-#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-
#if PLATFORM(IOS)
NSArray *MediaPlayerPrivateAVFoundationObjC::timedMetadata() const
{
@@ -1877,12 +1841,10 @@
if (!m_videoLayer)
return;
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
// Do not attempt to change the video gravity while in full screen mode.
// See setVideoFullscreenGravity().
if (m_videoFullscreenLayerManager->videoFullscreenLayer())
return;
-#endif
[CATransaction begin];
[CATransaction setDisableActions:YES];
@@ -2177,57 +2139,17 @@
bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const
{
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- if (m_videoFullscreenLayerManager->videoFullscreenLayer())
- return true;
-#endif
- return false;
+ return m_videoFullscreenLayerManager->requiresTextTrackRepresentation();
}
void MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds()
{
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- if (!m_videoFullscreenLayerManager->videoFullscreenLayer() || !m_textTrackRepresentationLayer)
- return;
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
- FloatRect videoFullscreenFrame = m_videoFullscreenLayerManager->videoFullscreenFrame();
- CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height());
- [m_textTrackRepresentationLayer setFrame:textFrame];
-
- [CATransaction commit];
-#endif
+ m_videoFullscreenLayerManager->syncTextTrackBounds();
}
void MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
{
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
- if (representationLayer == m_textTrackRepresentationLayer) {
- syncTextTrackBounds();
- return;
- }
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
- if (m_textTrackRepresentationLayer)
- [m_textTrackRepresentationLayer removeFromSuperlayer];
-
- m_textTrackRepresentationLayer = representationLayer;
-
- if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
- syncTextTrackBounds();
- [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
- }
-
- [CATransaction commit];
-
-#else
- UNUSED_PARAM(representation);
-#endif
+ m_videoFullscreenLayerManager->setTextTrackRepresentation(representation);
}
#endif // ENABLE(VIDEO_TRACK)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2018-03-21 21:13:58 UTC (rev 229824)
@@ -52,12 +52,10 @@
class PixelBufferConformerCV;
class PlatformClockCM;
class TextureCacheCV;
+class VideoFullscreenLayerManagerObjC;
class VideoTextureCopierCV;
class WebCoreDecompressionSession;
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
-class VideoFullscreenLayerManager;
-#endif
class MediaPlayerPrivateMediaSourceAVFObjC : public MediaPlayerPrivateInterface {
public:
@@ -108,16 +106,12 @@
AVSampleBufferDisplayLayer* sampleBufferDisplayLayer() const { return m_sampleBufferDisplayLayer.get(); }
WebCoreDecompressionSession* decompressionSession() const { return m_decompressionSession.get(); }
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override;
void setVideoFullscreenFrame(FloatRect) override;
-#endif
-#if ENABLE(VIDEO_TRACK)
bool requiresTextTrackRepresentation() const override;
void setTextTrackRepresentation(TextTrackRepresentation*) override;
void syncTextTrackBounds() override;
-#endif
#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
bool hasStreamSession() { return m_streamSession; }
@@ -308,7 +302,6 @@
bool m_hasBeenAskedToPaintGL { false };
bool m_hasAvailableVideoFrame { false };
bool m_allRenderersHaveAvailableSamples { false };
- RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
std::unique_ptr<TextureCacheCV> m_textureCache;
std::unique_ptr<VideoTextureCopierCV> m_videoTextureCopier;
RetainPtr<CVOpenGLTextureRef> m_lastTexture;
@@ -316,9 +309,7 @@
RefPtr<MediaPlaybackTarget> m_playbackTarget;
bool m_shouldPlayToTarget { false };
#endif
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
- std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;
-#endif
+ std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
#if ENABLE(ENCRYPTED_MEDIA)
RefPtr<CDMInstance> m_cdmInstance;
#endif
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2018-03-21 21:13:58 UTC (rev 229824)
@@ -41,6 +41,7 @@
#import "PixelBufferConformerCV.h"
#import "TextTrackRepresentation.h"
#import "TextureCacheCV.h"
+#import "VideoFullscreenLayerManagerObjC.h"
#import "VideoTextureCopierCV.h"
#import "WebCoreDecompressionSession.h"
#import <AVFoundation/AVAsset.h>
@@ -53,10 +54,6 @@
#import <wtf/MainThread.h>
#import <wtf/NeverDestroyed.h>
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
-#import "VideoFullscreenLayerManager.h"
-#endif
-
#pragma mark - Soft Linking
#import <pal/cf/CoreMediaSoftLink.h>
@@ -134,9 +131,7 @@
, m_playing(0)
, m_seeking(false)
, m_loadingProgressed(false)
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
- , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>())
-#endif
+ , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>())
{
CMTimebaseRef timebase = [m_synchronizer timebase];
CMNotificationCenterRef nc = CMNotificationCenterGetDefaultLocalCenter();
@@ -290,11 +285,7 @@
PlatformLayer* MediaPlayerPrivateMediaSourceAVFObjC::platformLayer() const
{
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
return m_videoFullscreenLayerManager->videoInlineLayer();
-#else
- return m_sampleBufferDisplayLayer.get();
-#endif
}
void MediaPlayerPrivateMediaSourceAVFObjC::play()
@@ -713,9 +704,7 @@
[m_synchronizer addRenderer:m_sampleBufferDisplayLayer.get()];
if (m_mediaSourcePrivate)
m_mediaSourcePrivate->setVideoLayer(m_sampleBufferDisplayLayer.get());
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
m_videoFullscreenLayerManager->setVideoLayer(m_sampleBufferDisplayLayer.get(), snappedIntRect(m_player->client().mediaPlayerContentBoxRect()).size());
-#endif
m_player->client().mediaPlayerRenderingModeChanged(m_player);
}
@@ -731,9 +720,7 @@
if (m_mediaSourcePrivate)
m_mediaSourcePrivate->setVideoLayer(nullptr);
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
m_videoFullscreenLayerManager->didDestroyVideoLayer();
-#endif
m_sampleBufferDisplayLayer = nullptr;
setHasAvailableVideoFrame(false);
m_player->client().mediaPlayerRenderingModeChanged(m_player);
@@ -1079,90 +1066,30 @@
m_player->characteristicChanged();
}
-#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
void MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
{
- if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {
- completionHandler();
- return;
- }
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
-
- if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
- syncTextTrackBounds();
- [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
- }
-
- [CATransaction commit];
}
void MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame(FloatRect frame)
{
m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
- syncTextTrackBounds();
}
-#endif
-
+
bool MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation() const
{
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- if (m_videoFullscreenLayerManager->videoFullscreenLayer())
- return true;
-#endif
- return false;
+ return m_videoFullscreenLayerManager->videoFullscreenLayer();
}
void MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds()
{
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- if (!m_videoFullscreenLayerManager->videoFullscreenLayer() || !m_textTrackRepresentationLayer)
- return;
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
- auto videoFullscreenFrame = m_videoFullscreenLayerManager->videoFullscreenFrame();
- auto videoRect = [m_sampleBufferDisplayLayer bounds];
- auto textFrame = m_sampleBufferDisplayLayer ? videoRect : CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height());
- [m_textTrackRepresentationLayer setFrame:textFrame];
-
- [CATransaction commit];
-#endif
+ m_videoFullscreenLayerManager->syncTextTrackBounds();
}
void MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
{
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
- if (representationLayer == m_textTrackRepresentationLayer) {
- syncTextTrackBounds();
- return;
- }
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
- if (m_textTrackRepresentationLayer)
- [m_textTrackRepresentationLayer removeFromSuperlayer];
-
- m_textTrackRepresentationLayer = representationLayer;
-
- if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
- syncTextTrackBounds();
- [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
- }
-
- [CATransaction commit];
-
-#else
- UNUSED_PARAM(representation);
-#endif
+ m_videoFullscreenLayerManager->setTextTrackRepresentation(representation);
}
-
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
void MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& target)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h 2018-03-21 21:13:58 UTC (rev 229824)
@@ -54,12 +54,9 @@
class AVVideoCaptureSource;
class MediaSourcePrivateClient;
class PixelBufferConformerCV;
+class VideoFullscreenLayerManagerObjC;
class VideoTrackPrivateMediaStream;
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-class VideoFullscreenLayerManager;
-#endif
-
class MediaPlayerPrivateMediaStreamAVFObjC final : public MediaPlayerPrivateInterface, private MediaStreamPrivate::Observer, private MediaStreamTrackPrivate::Observer
#if !RELEASE_LOG_DISABLED
, private LoggerHelper
@@ -223,10 +220,8 @@
void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) override;
void readyStateChanged(MediaStreamTrackPrivate&) override;
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override;
void setVideoFullscreenFrame(FloatRect) override;
-#endif
MediaTime streamTime() const;
@@ -269,6 +264,13 @@
PlaybackState m_playbackState { PlaybackState::None };
MediaSample::VideoRotation m_videoRotation { MediaSample::VideoRotation::None };
CGAffineTransform m_videoTransform;
+ std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
+
+#if !RELEASE_LOG_DISABLED
+ Ref<const Logger> m_logger;
+ const void* m_logIdentifier;
+#endif
+
bool m_videoMirrored { false };
bool m_playing { false };
bool m_muted { false };
@@ -279,16 +281,6 @@
bool m_transformIsValid { false };
bool m_visible { false };
bool m_haveSeenMetadata { false };
-
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;
-#endif
-
-#if !RELEASE_LOG_DISABLED
- Ref<const Logger> m_logger;
- const void* m_logIdentifier;
-#endif
-
};
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2018-03-21 21:13:58 UTC (rev 229824)
@@ -33,6 +33,7 @@
#import "Logging.h"
#import "MediaStreamPrivate.h"
#import "PixelBufferConformerCV.h"
+#import "VideoFullscreenLayerManagerObjC.h"
#import "VideoTrackPrivateMediaStream.h"
#import <AVFoundation/AVSampleBufferDisplayLayer.h>
#import <QuartzCore/CALayer.h>
@@ -45,9 +46,6 @@
#import <wtf/MainThread.h>
#import <wtf/NeverDestroyed.h>
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-#import "VideoFullscreenLayerManager.h"
-#endif
#pragma mark - Soft Linking
@@ -191,9 +189,7 @@
: m_player(player)
, m_statusChangeListener(adoptNS([[WebAVSampleBufferStatusChangeListener alloc] initWithParent:this]))
, m_clock(PAL::Clock::create())
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
- , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>())
-#endif
+ , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>())
#if !RELEASE_LOG_DISABLED
, m_logger(player->mediaPlayerLogger())
, m_logIdentifier(player->mediaPlayerLogIdentifier())
@@ -500,9 +496,7 @@
updateRenderingMode();
updateDisplayLayer();
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
m_videoFullscreenLayerManager->setVideoLayer(m_backgroundLayer.get(), snappedIntRect(m_player->client().mediaPlayerContentBoxRect()).size());
-#endif
}
void MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers()
@@ -518,9 +512,7 @@
updateRenderingMode();
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
m_videoFullscreenLayerManager->didDestroyVideoLayer();
-#endif
}
#pragma mark -
@@ -586,11 +578,7 @@
if (!m_backgroundLayer || m_displayMode == None)
return nullptr;
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
return m_videoFullscreenLayerManager->videoInlineLayer();
-#else
- return m_backgroundLayer.get();
-#endif
}
PlatformLayer* MediaPlayerPrivateMediaStreamAVFObjC::displayLayer()
@@ -909,14 +897,8 @@
return true;
}
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
void MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer(PlatformLayer* videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
{
- if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {
- completionHandler();
- return;
- }
-
m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
}
@@ -924,7 +906,6 @@
{
m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
}
-#endif
typedef enum {
Add,
Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h 2018-03-21 21:13:58 UTC (rev 229824)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-
-#include "FloatRect.h"
-#include "IntSize.h"
-#include "PlatformLayer.h"
-#include <wtf/Function.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/RetainPtr.h>
-
-namespace WebCore {
-
-class VideoFullscreenLayerManager {
- WTF_MAKE_NONCOPYABLE(VideoFullscreenLayerManager);
-public:
- VideoFullscreenLayerManager();
-
- PlatformLayer *videoInlineLayer() const { return m_videoInlineLayer.get(); }
- PlatformLayer *videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); }
- FloatRect videoFullscreenFrame() const { return m_videoFullscreenFrame; }
- void setVideoLayer(PlatformLayer *, IntSize contentSize);
- void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler);
- void setVideoFullscreenFrame(FloatRect);
- void didDestroyVideoLayer();
-
-private:
- RetainPtr<PlatformLayer> m_videoInlineLayer;
- RetainPtr<PlatformLayer> m_videoFullscreenLayer;
- RetainPtr<PlatformLayer> m_videoLayer;
- FloatRect m_videoFullscreenFrame;
-};
-
-}
-
-#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm (229823 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm 2018-03-21 21:10:01 UTC (rev 229823)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm 2018-03-21 21:13:58 UTC (rev 229824)
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "VideoFullscreenLayerManager.h"
-
-#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
-
-#import "Color.h"
-#import "WebCoreCALayerExtras.h"
-#import <mach/mach_init.h>
-#import <mach/mach_port.h>
-#import <pal/spi/cocoa/QuartzCoreSPI.h>
-#import <wtf/BlockPtr.h>
-
-@interface WebVideoContainerLayer : CALayer
-@end
-
-@implementation WebVideoContainerLayer
-
-- (void)setBounds:(CGRect)bounds
-{
- [super setBounds:bounds];
- for (CALayer* layer in self.sublayers)
- layer.frame = bounds;
-}
-
-- (void)setPosition:(CGPoint)position
-{
- if (!CATransform3DIsIdentity(self.transform)) {
- // Pre-apply the transform added in the WebProcess to fix <rdar://problem/18316542> to the position.
- position = CGPointApplyAffineTransform(position, CATransform3DGetAffineTransform(self.transform));
- }
- [super setPosition:position];
-}
-@end
-
-namespace WebCore {
-
-VideoFullscreenLayerManager::VideoFullscreenLayerManager()
-{
-}
-
-void VideoFullscreenLayerManager::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize)
-{
- m_videoLayer = videoLayer;
-
- [m_videoLayer web_disableAllActions];
- m_videoInlineLayer = adoptNS([[WebVideoContainerLayer alloc] init]);
-#ifndef NDEBUG
- [m_videoInlineLayer setName:@"WebVideoContainerLayer"];
-#endif
- [m_videoInlineLayer setFrame:CGRectMake(0, 0, contentSize.width(), contentSize.height())];
- if (m_videoFullscreenLayer) {
- [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
- [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
- } else {
- [m_videoInlineLayer insertSublayer:m_videoLayer.get() atIndex:0];
- [m_videoLayer setFrame:m_videoInlineLayer.get().bounds];
- }
-}
-
-void VideoFullscreenLayerManager::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
-{
- if (m_videoFullscreenLayer == videoFullscreenLayer) {
- completionHandler();
- return;
- }
-
- m_videoFullscreenLayer = videoFullscreenLayer;
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
- if (m_videoLayer) {
- CAContext *oldContext = [m_videoLayer context];
-
- if (m_videoFullscreenLayer) {
- [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
- [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
- } else if (m_videoInlineLayer) {
- [m_videoLayer setFrame:[m_videoInlineLayer bounds]];
- [m_videoInlineLayer insertSublayer:m_videoLayer.get() atIndex:0];
- } else
- [m_videoLayer removeFromSuperlayer];
-
- CAContext *newContext = [m_videoLayer context];
- if (oldContext && newContext && oldContext != newContext) {
-#if PLATFORM(MAC)
- oldContext.commitPriority = 0;
- newContext.commitPriority = 1;
-#endif
- mach_port_t fencePort = [oldContext createFencePort];
- [newContext setFencePort:fencePort];
- mach_port_deallocate(mach_task_self(), fencePort);
- }
- }
-
- [CATransaction setCompletionBlock:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler)] {
- completionHandler();
- }).get()];
-
- [CATransaction commit];
-}
-
-void VideoFullscreenLayerManager::setVideoFullscreenFrame(FloatRect videoFullscreenFrame)
-{
- m_videoFullscreenFrame = videoFullscreenFrame;
- if (!m_videoFullscreenLayer)
- return;
-
- [m_videoLayer setFrame:CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height())];
-}
-
-void VideoFullscreenLayerManager::didDestroyVideoLayer()
-{
- [m_videoLayer removeFromSuperlayer];
-
- m_videoInlineLayer = nil;
- m_videoLayer = nil;
-}
-
-}
-
-#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
Copied: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h (from rev 229823, trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h) (0 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h 2018-03-21 21:13:58 UTC (rev 229824)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "FloatRect.h"
+#include "IntSize.h"
+#include "PlatformLayer.h"
+#include "VideoFullscreenLayerManager.h"
+#include <wtf/Function.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager {
+public:
+ VideoFullscreenLayerManagerObjC();
+
+ PlatformLayer *videoInlineLayer() const final { return m_videoInlineLayer.get(); }
+ PlatformLayer *videoFullscreenLayer() const final { return m_videoFullscreenLayer.get(); }
+ FloatRect videoFullscreenFrame() const final { return m_videoFullscreenFrame; }
+ void setVideoLayer(PlatformLayer *, IntSize contentSize) final;
+ void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler) final;
+ void setVideoFullscreenFrame(FloatRect) final;
+ void didDestroyVideoLayer() final;
+
+ bool requiresTextTrackRepresentation() const final;
+ void setTextTrackRepresentation(TextTrackRepresentation*) final;
+ void syncTextTrackBounds() final;
+
+private:
+ RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
+ RetainPtr<PlatformLayer> m_videoInlineLayer;
+ RetainPtr<PlatformLayer> m_videoFullscreenLayer;
+ RetainPtr<PlatformLayer> m_videoLayer;
+ FloatRect m_videoFullscreenFrame;
+ FloatRect m_videoInlineFrame;
+};
+
+}
+
Copied: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm (from rev 229823, trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm) (0 => 229824)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm 2018-03-21 21:13:58 UTC (rev 229824)
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "VideoFullscreenLayerManagerObjC.h"
+
+#import "Color.h"
+#import "TextTrackRepresentation.h"
+#import "WebCoreCALayerExtras.h"
+#import <mach/mach_init.h>
+#import <mach/mach_port.h>
+#import <pal/spi/cocoa/QuartzCoreSPI.h>
+#import <wtf/BlockPtr.h>
+
+@interface WebVideoContainerLayer : CALayer
+@end
+
+@implementation WebVideoContainerLayer
+
+- (void)setBounds:(CGRect)bounds
+{
+ [super setBounds:bounds];
+ for (CALayer* layer in self.sublayers)
+ layer.frame = bounds;
+}
+
+- (void)setPosition:(CGPoint)position
+{
+ if (!CATransform3DIsIdentity(self.transform)) {
+ // Pre-apply the transform added in the WebProcess to fix <rdar://problem/18316542> to the position.
+ position = CGPointApplyAffineTransform(position, CATransform3DGetAffineTransform(self.transform));
+ }
+ [super setPosition:position];
+}
+@end
+
+namespace WebCore {
+
+VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC()
+ : VideoFullscreenLayerManager()
+{
+}
+
+void VideoFullscreenLayerManagerObjC::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize)
+{
+ m_videoLayer = videoLayer;
+ m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height());
+
+ [m_videoLayer web_disableAllActions];
+ m_videoInlineLayer = adoptNS([[WebVideoContainerLayer alloc] init]);
+#ifndef NDEBUG
+ [m_videoInlineLayer setName:@"WebVideoContainerLayer"];
+#endif
+ [m_videoInlineLayer setFrame:m_videoInlineFrame];
+ if (m_videoFullscreenLayer) {
+ [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
+ [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
+ } else {
+ [m_videoInlineLayer insertSublayer:m_videoLayer.get() atIndex:0];
+ [m_videoLayer setFrame:m_videoInlineLayer.get().bounds];
+ }
+}
+
+void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
+{
+ if (m_videoFullscreenLayer == videoFullscreenLayer) {
+ completionHandler();
+ return;
+ }
+
+ m_videoFullscreenLayer = videoFullscreenLayer;
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
+ if (m_videoLayer) {
+ CAContext *oldContext = [m_videoLayer context];
+
+ if (m_videoFullscreenLayer) {
+ [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
+ [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
+ } else if (m_videoInlineLayer) {
+ [m_videoLayer setFrame:[m_videoInlineLayer bounds]];
+ [m_videoInlineLayer insertSublayer:m_videoLayer.get() atIndex:0];
+ } else
+ [m_videoLayer removeFromSuperlayer];
+
+ CAContext *newContext = [m_videoLayer context];
+ if (oldContext && newContext && oldContext != newContext) {
+#if PLATFORM(MAC)
+ oldContext.commitPriority = 0;
+ newContext.commitPriority = 1;
+#endif
+ mach_port_t fencePort = [oldContext createFencePort];
+ [newContext setFencePort:fencePort];
+ mach_port_deallocate(mach_task_self(), fencePort);
+ }
+ }
+
+ [CATransaction setCompletionBlock:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler)] {
+ completionHandler();
+ }).get()];
+
+ [CATransaction commit];
+}
+
+void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFullscreenFrame)
+{
+ m_videoFullscreenFrame = videoFullscreenFrame;
+ if (!m_videoFullscreenLayer)
+ return;
+
+ [m_videoLayer setFrame:m_videoFullscreenFrame];
+}
+
+void VideoFullscreenLayerManagerObjC::didDestroyVideoLayer()
+{
+ [m_videoLayer removeFromSuperlayer];
+
+ m_videoInlineLayer = nil;
+ m_videoLayer = nil;
+}
+
+bool VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation() const
+{
+ return m_videoFullscreenLayer;
+}
+
+void VideoFullscreenLayerManagerObjC::syncTextTrackBounds()
+{
+ if (!m_videoFullscreenLayer || !m_textTrackRepresentationLayer)
+ return;
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
+ CGRect textFrame = m_videoLayer ? m_videoInlineFrame : m_videoFullscreenFrame;
+ [m_textTrackRepresentationLayer setFrame:textFrame];
+
+ [CATransaction commit];
+}
+
+void VideoFullscreenLayerManagerObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
+{
+ PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
+ if (representationLayer == m_textTrackRepresentationLayer) {
+ syncTextTrackBounds();
+ return;
+ }
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
+ if (m_textTrackRepresentationLayer)
+ [m_textTrackRepresentationLayer removeFromSuperlayer];
+
+ m_textTrackRepresentationLayer = representationLayer;
+
+ if (m_videoFullscreenLayer && m_textTrackRepresentationLayer) {
+ syncTextTrackBounds();
+ [m_videoFullscreenLayer addSublayer:m_textTrackRepresentationLayer.get()];
+ }
+
+ [CATransaction commit];
+
+}
+
+}
+