Changeset 229824 in webkit


Ignore:
Timestamp:
Mar 21, 2018 2:13:58 PM (6 years ago)
Author:
eric.carlson@apple.com
Message:

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):

Location:
trunk/Source/WebCore
Files:
8 edited
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r229818 r229824  
     12018-03-21  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Clean up platform VideoFullscreenLayerManager
     4        https://bugs.webkit.org/show_bug.cgi?id=183859
     5        <rdar://problem/38715419>
     6
     7        Reviewed by Jer Noble.
     8
     9        No new tests, no functional change.
     10
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
     13        (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager):
     14        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
     15        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     16        (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
     17        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
     18        (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
     19        (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const):
     20        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
     21        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
     22        (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
     23        (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const):
     24        (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
     25        (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
     26        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
     27        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
     28        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
     29        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
     30        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
     31        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
     32        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
     33        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
     34        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const):
     35        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
     36        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
     37        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
     38        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
     39        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
     40        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
     41        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
     42        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
     43        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
     44        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame):
     45        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
     46        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm.
     47        (-[WebVideoContainerLayer setBounds:]):
     48        (-[WebVideoContainerLayer setPosition:]):
     49        (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
     50        (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
     51        (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
     52        (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
     53        (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
     54        (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const):
     55        (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
     56        (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
     57
    1582018-03-21  Antoine Quint  <graouts@apple.com>
    259
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r229768 r229824  
    127127                0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0753860014489E9800B78452 /* CachedTextTrack.cpp */; };
    128128                0753860314489E9800B78452 /* CachedTextTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 0753860114489E9800B78452 /* CachedTextTrack.h */; };
     129                075BA84920618AA500FCB4AD /* VideoFullscreenLayerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */; };
    129130                07638A991884487200E15A1B /* MediaSessionManagerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 07638A971884487200E15A1B /* MediaSessionManagerIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
    130131                07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07638A981884487200E15A1B /* MediaSessionManagerIOS.mm */; };
     
    15261527                52B0D4C01C57FD660077CE53 /* VideoFullscreenChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15271528                52B0D4C21C57FF910077CE53 /* VideoFullscreenInterfaceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1528                 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */; };
     1529                52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManagerObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */; };
    15291530                52D5A1A71C57489D00DE34A3 /* VideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A41C57488900DE34A3 /* VideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15301531                52D5A1A81C5748A300DE34A3 /* VideoFullscreenModelVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A51C57488900DE34A3 /* VideoFullscreenModelVideoElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    52635264                0753860014489E9800B78452 /* CachedTextTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedTextTrack.cpp; sourceTree = "<group>"; };
    52645265                0753860114489E9800B78452 /* CachedTextTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedTextTrack.h; sourceTree = "<group>"; };
     5266                075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManager.h; sourceTree = "<group>"; };
    52655267                07638A971884487200E15A1B /* MediaSessionManagerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerIOS.h; sourceTree = "<group>"; };
    52665268                07638A981884487200E15A1B /* MediaSessionManagerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSessionManagerIOS.mm; sourceTree = "<group>"; };
     
    80878089                52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenChangeObserver.h; sourceTree = "<group>"; };
    80888090                52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenInterfaceMac.h; sourceTree = "<group>"; };
    8089                 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManager.mm; sourceTree = "<group>"; };
    8090                 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManager.h; sourceTree = "<group>"; };
     8091                52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManagerObjC.mm; sourceTree = "<group>"; };
     8092                52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManagerObjC.h; sourceTree = "<group>"; };
    80918093                52D5A1A41C57488900DE34A3 /* VideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenModel.h; sourceTree = "<group>"; };
    80928094                52D5A1A51C57488900DE34A3 /* VideoFullscreenModelVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenModelVideoElement.h; sourceTree = "<group>"; };
     
    2341223414                                BE913D7F181EF8E500DCB09E /* TrackPrivateBase.h */,
    2341323415                                E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */,
     23416                                075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */,
    2341423417                                BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */,
    2341523418                                1411DCB0164C39A800D49BC1 /* WidthCache.h */,
     
    2462924632                                CDC8B5A918047FF10016E685 /* SourceBufferPrivateAVFObjC.h */,
    2463024633                                CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */,
    24631                                 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManager.h */,
    24632                                 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */,
     24634                                52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */,
     24635                                52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */,
    2463324636                                CD336F6517FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.cpp */,
    2463424637                                CD336F6617FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.h */,
     
    3039930402                                3FBC4AF4189881560046EE38 /* VideoFullscreenInterfaceAVKit.h in Headers */,
    3040030403                                52B0D4C21C57FF910077CE53 /* VideoFullscreenInterfaceMac.h in Headers */,
     30404                                075BA84920618AA500FCB4AD /* VideoFullscreenLayerManager.h in Headers */,
    3040130405                                52D5A1A71C57489D00DE34A3 /* VideoFullscreenModel.h in Headers */,
    3040230406                                52D5A1A81C5748A300DE34A3 /* VideoFullscreenModelVideoElement.h in Headers */,
     
    3177031774                                837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */,
    3177131775                                3FBC4AF3189881560046EE38 /* VideoFullscreenInterfaceAVKit.mm in Sources */,
    31772                                 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManager.mm in Sources */,
     31776                                52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManagerObjC.mm in Sources */,
    3177331777                                BE88E0DE1715D2A200658D98 /* VideoTrack.cpp in Sources */,
    3177431778                                BE88E0E11715D2A200658D98 /* VideoTrackList.cpp in Sources */,
  • trunk/Source/WebCore/platform/graphics/VideoFullscreenLayerManager.h

    r229823 r229824  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    29 
    30 #include "FloatRect.h"
    31 #include "IntSize.h"
    3228#include "PlatformLayer.h"
    3329#include <wtf/Function.h>
    3430#include <wtf/Noncopyable.h>
    35 #include <wtf/RetainPtr.h>
    3631
    3732namespace WebCore {
     33
     34class FloatRect;
     35class IntSize;
     36class TextTrackRepresentation;
    3837
    3938class VideoFullscreenLayerManager {
    4039    WTF_MAKE_NONCOPYABLE(VideoFullscreenLayerManager);
    4140public:
    42     VideoFullscreenLayerManager();
     41    VideoFullscreenLayerManager() = default;
     42    virtual ~VideoFullscreenLayerManager() { }
    4343
    44     PlatformLayer *videoInlineLayer() const { return m_videoInlineLayer.get(); }
    45     PlatformLayer *videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); }
    46     FloatRect videoFullscreenFrame() const { return m_videoFullscreenFrame; }
    47     void setVideoLayer(PlatformLayer *, IntSize contentSize);
    48     void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler);
    49     void setVideoFullscreenFrame(FloatRect);
    50     void didDestroyVideoLayer();
     44    virtual PlatformLayer *videoInlineLayer() const = 0;
     45    virtual PlatformLayer *videoFullscreenLayer() const = 0;
     46    virtual FloatRect videoFullscreenFrame() const = 0;
     47    virtual void setVideoLayer(PlatformLayer*, IntSize) = 0;
     48    virtual void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) = 0;
     49    virtual void setVideoFullscreenFrame(FloatRect) = 0;
     50    virtual void didDestroyVideoLayer() = 0;
    5151
    52 private:
    53     RetainPtr<PlatformLayer> m_videoInlineLayer;
    54     RetainPtr<PlatformLayer> m_videoFullscreenLayer;
    55     RetainPtr<PlatformLayer> m_videoLayer;
    56     FloatRect m_videoFullscreenFrame;
     52    virtual bool requiresTextTrackRepresentation() const = 0;
     53    virtual void setTextTrackRepresentation(TextTrackRepresentation*) = 0;
     54    virtual void syncTextTrackBounds() = 0;
    5755};
    5856
    5957}
    6058
    61 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h

    r229790 r229824  
    7373class WebCoreAVFResourceLoader;
    7474class TextureCacheCV;
     75class VideoFullscreenLayerManagerObjC;
    7576class VideoTextureCopierCV;
    76 
    77 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    78 class VideoFullscreenLayerManager;
    79 #endif
    8077
    8178class MediaPlayerPrivateAVFoundationObjC : public MediaPlayerPrivateAVFoundation {
     
    189186    void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&) override;
    190187    PlatformLayer* platformLayer() const override;
    191 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    192188    void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override;
    193189    void setVideoFullscreenFrame(FloatRect) override;
    194190    void setVideoFullscreenGravity(MediaPlayer::VideoGravity) override;
    195191    void setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode) override;
    196 #endif
    197192
    198193#if PLATFORM(IOS)
     
    344339    RetainPtr<AVPlayerItem> m_avPlayerItem;
    345340    RetainPtr<AVPlayerLayer> m_videoLayer;
    346 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    347     std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;
     341    std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
    348342    MediaPlayer::VideoGravity m_videoFullscreenGravity;
    349     RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
    350 #endif
    351343    RetainPtr<WebCoreAVFMovieObserver> m_objcObserver;
    352344    RetainPtr<id> m_timeObserver;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r229790 r229824  
    6161#import "TextureCacheCV.h"
    6262#import "URL.h"
     63#import "VideoFullscreenLayerManagerObjC.h"
    6364#import "VideoTextureCopierCV.h"
    6465#import "VideoTrackPrivateAVFObjC.h"
     
    99100#import <AVFoundation/AVTime.h>
    100101
    101 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    102 #import "VideoFullscreenLayerManager.h"
    103 #endif
    104 
    105102#if PLATFORM(IOS)
    106103#import "WAKAppKitStubs.h"
     
    489486MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player)
    490487    : MediaPlayerPrivateAVFoundation(player)
    491 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    492     , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>())
     488    , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>())
    493489    , m_videoFullscreenGravity(MediaPlayer::VideoGravityResizeAspect)
    494 #endif
    495490    , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithCallback:this]))
    496491    , m_videoFrameHasDrawn(false)
     
    708703    INFO_LOG(LOGIDENTIFIER);
    709704
    710 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    711705    m_videoFullscreenLayerManager->setVideoLayer(m_videoLayer.get(), defaultSize);
    712706
     
    715709        [m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)];
    716710#endif
    717 #else
    718     [m_videoLayer setFrame:CGRectMake(0, 0, defaultSize.width(), defaultSize.height())];
    719 #endif
    720711}
    721712
     
    729720    [m_videoLayer removeObserver:m_objcObserver.get() forKeyPath:@"readyForDisplay"];
    730721    [m_videoLayer setPlayer:nil];
    731 
    732 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    733722    m_videoFullscreenLayerManager->didDestroyVideoLayer();
    734 #endif
    735723
    736724    m_videoLayer = nil;
     
    11731161PlatformLayer* MediaPlayerPrivateAVFoundationObjC::platformLayer() const
    11741162{
    1175 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    1176     return m_haveBeenAskedToCreateLayer ? m_videoFullscreenLayerManager->videoInlineLayer() : nullptr;
    1177 #else
    1178     return m_haveBeenAskedToCreateLayer ? m_videoLayer.get() : nullptr;
    1179 #endif
    1180 }
    1181 
    1182 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     1163    return m_videoFullscreenLayerManager->videoInlineLayer();
     1164}
     1165
    11831166void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer(PlatformLayer* videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
    11841167{
    1185     if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {
    1186         completionHandler();
    1187         return;
    1188     }
    1189 
    1190     [CATransaction begin];
    1191     [CATransaction setDisableActions:YES];
    1192 
    11931168    m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
    1194 
    1195     if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
    1196         syncTextTrackBounds();
    1197         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
    1198     }
    1199 
    1200     [CATransaction commit];
    1201 
    12021169    updateDisableExternalPlayback();
    12031170}
     
    12061173{
    12071174    m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
    1208     syncTextTrackBounds();
    12091175}
    12101176
     
    12431209#endif
    12441210}
    1245 
    1246 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    12471211
    12481212#if PLATFORM(IOS)
     
    18781842        return;
    18791843
    1880 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    18811844    // Do not attempt to change the video gravity while in full screen mode.
    18821845    // See setVideoFullscreenGravity().
    18831846    if (m_videoFullscreenLayerManager->videoFullscreenLayer())
    18841847        return;
    1885 #endif
    18861848
    18871849    [CATransaction begin];
     
    21782140bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const
    21792141{
    2180 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    2181     if (m_videoFullscreenLayerManager->videoFullscreenLayer())
    2182         return true;
    2183 #endif
    2184     return false;
     2142    return m_videoFullscreenLayerManager->requiresTextTrackRepresentation();
    21852143}
    21862144
    21872145void MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds()
    21882146{
    2189 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    2190     if (!m_videoFullscreenLayerManager->videoFullscreenLayer() || !m_textTrackRepresentationLayer)
    2191         return;
    2192 
    2193     [CATransaction begin];
    2194     [CATransaction setDisableActions:YES];
    2195 
    2196     FloatRect videoFullscreenFrame = m_videoFullscreenLayerManager->videoFullscreenFrame();
    2197     CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height());
    2198     [m_textTrackRepresentationLayer setFrame:textFrame];
    2199 
    2200     [CATransaction commit];
    2201 #endif
     2147    m_videoFullscreenLayerManager->syncTextTrackBounds();
    22022148}
    22032149
    22042150void MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
    22052151{
    2206 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    2207     PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
    2208     if (representationLayer == m_textTrackRepresentationLayer) {
    2209         syncTextTrackBounds();
    2210         return;
    2211     }
    2212 
    2213     [CATransaction begin];
    2214     [CATransaction setDisableActions:YES];
    2215 
    2216     if (m_textTrackRepresentationLayer)
    2217         [m_textTrackRepresentationLayer removeFromSuperlayer];
    2218 
    2219     m_textTrackRepresentationLayer = representationLayer;
    2220 
    2221     if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
    2222         syncTextTrackBounds();
    2223         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
    2224     }
    2225 
    2226     [CATransaction commit];
    2227 
    2228 #else
    2229     UNUSED_PARAM(representation);
    2230 #endif
     2152    m_videoFullscreenLayerManager->setTextTrackRepresentation(representation);
    22312153}
    22322154
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h

    r228709 r229824  
    5353class PlatformClockCM;
    5454class TextureCacheCV;
     55class VideoFullscreenLayerManagerObjC;
    5556class VideoTextureCopierCV;
    5657class WebCoreDecompressionSession;
    5758
    58 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    59 class VideoFullscreenLayerManager;
    60 #endif
    6159
    6260class MediaPlayerPrivateMediaSourceAVFObjC : public MediaPlayerPrivateInterface {
     
    109107    WebCoreDecompressionSession* decompressionSession() const { return m_decompressionSession.get(); }
    110108
    111 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    112109    void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override;
    113110    void setVideoFullscreenFrame(FloatRect) override;
    114 #endif
    115 
    116 #if ENABLE(VIDEO_TRACK)
     111
    117112    bool requiresTextTrackRepresentation() const override;
    118113    void setTextTrackRepresentation(TextTrackRepresentation*) override;
    119114    void syncTextTrackBounds() override;
    120 #endif
    121115   
    122116#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     
    309303    bool m_hasAvailableVideoFrame { false };
    310304    bool m_allRenderersHaveAvailableSamples { false };
    311     RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
    312305    std::unique_ptr<TextureCacheCV> m_textureCache;
    313306    std::unique_ptr<VideoTextureCopierCV> m_videoTextureCopier;
     
    317310    bool m_shouldPlayToTarget { false };
    318311#endif
    319 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    320     std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;
    321 #endif
     312    std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
    322313#if ENABLE(ENCRYPTED_MEDIA)
    323314    RefPtr<CDMInstance> m_cdmInstance;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm

    r228709 r229824  
    4242#import "TextTrackRepresentation.h"
    4343#import "TextureCacheCV.h"
     44#import "VideoFullscreenLayerManagerObjC.h"
    4445#import "VideoTextureCopierCV.h"
    4546#import "WebCoreDecompressionSession.h"
     
    5354#import <wtf/MainThread.h>
    5455#import <wtf/NeverDestroyed.h>
    55 
    56 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    57 #import "VideoFullscreenLayerManager.h"
    58 #endif
    5956
    6057#pragma mark - Soft Linking
     
    135132    , m_seeking(false)
    136133    , m_loadingProgressed(false)
    137 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    138     , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>())
    139 #endif
     134    , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>())
    140135{
    141136    CMTimebaseRef timebase = [m_synchronizer timebase];
     
    291286PlatformLayer* MediaPlayerPrivateMediaSourceAVFObjC::platformLayer() const
    292287{
    293 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    294288    return m_videoFullscreenLayerManager->videoInlineLayer();
    295 #else
    296     return m_sampleBufferDisplayLayer.get();
    297 #endif
    298289}
    299290
     
    714705    if (m_mediaSourcePrivate)
    715706        m_mediaSourcePrivate->setVideoLayer(m_sampleBufferDisplayLayer.get());
    716 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    717707    m_videoFullscreenLayerManager->setVideoLayer(m_sampleBufferDisplayLayer.get(), snappedIntRect(m_player->client().mediaPlayerContentBoxRect()).size());
    718 #endif
    719708    m_player->client().mediaPlayerRenderingModeChanged(m_player);
    720709}
     
    732721    if (m_mediaSourcePrivate)
    733722        m_mediaSourcePrivate->setVideoLayer(nullptr);
    734 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    735723    m_videoFullscreenLayerManager->didDestroyVideoLayer();
    736 #endif
    737724    m_sampleBufferDisplayLayer = nullptr;
    738725    setHasAvailableVideoFrame(false);
     
    10801067}
    10811068
    1082 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
    10831069void MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
    10841070{
    1085     if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {
    1086         completionHandler();
    1087         return;
    1088     }
    1089 
    1090     [CATransaction begin];
    1091     [CATransaction setDisableActions:YES];
    1092 
    10931071    m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
    1094    
    1095     if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
    1096         syncTextTrackBounds();
    1097         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
    1098     }
    1099 
    1100     [CATransaction commit];
    11011072}
    11021073
     
    11041075{
    11051076    m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
    1106     syncTextTrackBounds();
    1107 }
    1108 #endif
    1109    
     1077}
     1078
    11101079bool MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation() const
    11111080{
    1112 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    1113     if (m_videoFullscreenLayerManager->videoFullscreenLayer())
    1114         return true;
    1115 #endif
    1116     return false;
     1081    return m_videoFullscreenLayerManager->videoFullscreenLayer();
    11171082}
    11181083   
    11191084void MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds()
    11201085{
    1121 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    1122     if (!m_videoFullscreenLayerManager->videoFullscreenLayer() || !m_textTrackRepresentationLayer)
    1123         return;
    1124 
    1125     [CATransaction begin];
    1126     [CATransaction setDisableActions:YES];
    1127 
    1128     auto videoFullscreenFrame = m_videoFullscreenLayerManager->videoFullscreenFrame();
    1129     auto videoRect = [m_sampleBufferDisplayLayer bounds];
    1130     auto textFrame = m_sampleBufferDisplayLayer ? videoRect : CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height());
    1131     [m_textTrackRepresentationLayer setFrame:textFrame];
    1132 
    1133     [CATransaction commit];
    1134 #endif
     1086    m_videoFullscreenLayerManager->syncTextTrackBounds();
    11351087}
    11361088   
    11371089void MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
    11381090{
    1139 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    1140     PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
    1141     if (representationLayer == m_textTrackRepresentationLayer) {
    1142         syncTextTrackBounds();
    1143         return;
    1144     }
    1145 
    1146     [CATransaction begin];
    1147     [CATransaction setDisableActions:YES];
    1148 
    1149     if (m_textTrackRepresentationLayer)
    1150         [m_textTrackRepresentationLayer removeFromSuperlayer];
    1151    
    1152     m_textTrackRepresentationLayer = representationLayer;
    1153    
    1154     if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
    1155         syncTextTrackBounds();
    1156         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
    1157     }
    1158 
    1159     [CATransaction commit];
    1160    
    1161 #else
    1162     UNUSED_PARAM(representation);
    1163 #endif
    1164 }
    1165    
     1091    m_videoFullscreenLayerManager->setTextTrackRepresentation(representation);
     1092}
    11661093
    11671094#if ENABLE(WIRELESS_PLAYBACK_TARGET)
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h

    r226990 r229824  
    5555class MediaSourcePrivateClient;
    5656class PixelBufferConformerCV;
     57class VideoFullscreenLayerManagerObjC;
    5758class VideoTrackPrivateMediaStream;
    58 
    59 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    60 class VideoFullscreenLayerManager;
    61 #endif
    6259
    6360class MediaPlayerPrivateMediaStreamAVFObjC final : public MediaPlayerPrivateInterface, private MediaStreamPrivate::Observer, private MediaStreamTrackPrivate::Observer
     
    224221    void readyStateChanged(MediaStreamTrackPrivate&) override;
    225222
    226 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    227223    void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override;
    228224    void setVideoFullscreenFrame(FloatRect) override;
    229 #endif
    230225
    231226    MediaTime streamTime() const;
     
    270265    MediaSample::VideoRotation m_videoRotation { MediaSample::VideoRotation::None };
    271266    CGAffineTransform m_videoTransform;
     267    std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
     268
     269#if !RELEASE_LOG_DISABLED
     270    Ref<const Logger> m_logger;
     271    const void* m_logIdentifier;
     272#endif
     273
    272274    bool m_videoMirrored { false };
    273275    bool m_playing { false };
     
    280282    bool m_visible { false };
    281283    bool m_haveSeenMetadata { false };
    282 
    283 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    284     std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;
    285 #endif
    286 
    287 #if !RELEASE_LOG_DISABLED
    288     Ref<const Logger> m_logger;
    289     const void* m_logIdentifier;
    290 #endif
    291 
    292284};
    293285   
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm

    r228528 r229824  
    3434#import "MediaStreamPrivate.h"
    3535#import "PixelBufferConformerCV.h"
     36#import "VideoFullscreenLayerManagerObjC.h"
    3637#import "VideoTrackPrivateMediaStream.h"
    3738#import <AVFoundation/AVSampleBufferDisplayLayer.h>
     
    4647#import <wtf/NeverDestroyed.h>
    4748
    48 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    49 #import "VideoFullscreenLayerManager.h"
    50 #endif
    5149
    5250#pragma mark - Soft Linking
     
    192190    , m_statusChangeListener(adoptNS([[WebAVSampleBufferStatusChangeListener alloc] initWithParent:this]))
    193191    , m_clock(PAL::Clock::create())
    194 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    195     , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>())
    196 #endif
     192    , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>())
    197193#if !RELEASE_LOG_DISABLED
    198194    , m_logger(player->mediaPlayerLogger())
     
    501497    updateDisplayLayer();
    502498
    503 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    504499    m_videoFullscreenLayerManager->setVideoLayer(m_backgroundLayer.get(), snappedIntRect(m_player->client().mediaPlayerContentBoxRect()).size());
    505 #endif
    506500}
    507501
     
    519513    updateRenderingMode();
    520514   
    521 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    522515    m_videoFullscreenLayerManager->didDestroyVideoLayer();
    523 #endif
    524516}
    525517
     
    587579        return nullptr;
    588580
    589 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    590581    return m_videoFullscreenLayerManager->videoInlineLayer();
    591 #else
    592     return m_backgroundLayer.get();
    593 #endif
    594582}
    595583
     
    910898}
    911899
    912 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    913900void MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer(PlatformLayer* videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
    914901{
    915     if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {
    916         completionHandler();
    917         return;
    918     }
    919 
    920902    m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
    921903}
     
    925907    m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
    926908}
    927 #endif
    928909
    929910typedef enum {
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h

    r229823 r229824  
    2626#pragma once
    2727
    28 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
    29 
    3028#include "FloatRect.h"
    3129#include "IntSize.h"
    3230#include "PlatformLayer.h"
     31#include "VideoFullscreenLayerManager.h"
    3332#include <wtf/Function.h>
    3433#include <wtf/Noncopyable.h>
     
    3736namespace WebCore {
    3837
    39 class VideoFullscreenLayerManager {
    40     WTF_MAKE_NONCOPYABLE(VideoFullscreenLayerManager);
     38class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager {
    4139public:
    42     VideoFullscreenLayerManager();
     40    VideoFullscreenLayerManagerObjC();
    4341
    44     PlatformLayer *videoInlineLayer() const { return m_videoInlineLayer.get(); }
    45     PlatformLayer *videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); }
    46     FloatRect videoFullscreenFrame() const { return m_videoFullscreenFrame; }
    47     void setVideoLayer(PlatformLayer *, IntSize contentSize);
    48     void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler);
    49     void setVideoFullscreenFrame(FloatRect);
    50     void didDestroyVideoLayer();
     42    PlatformLayer *videoInlineLayer() const final { return m_videoInlineLayer.get(); }
     43    PlatformLayer *videoFullscreenLayer() const final { return m_videoFullscreenLayer.get(); }
     44    FloatRect videoFullscreenFrame() const final { return m_videoFullscreenFrame; }
     45    void setVideoLayer(PlatformLayer *, IntSize contentSize) final;
     46    void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler) final;
     47    void setVideoFullscreenFrame(FloatRect) final;
     48    void didDestroyVideoLayer() final;
     49
     50    bool requiresTextTrackRepresentation() const final;
     51    void setTextTrackRepresentation(TextTrackRepresentation*) final;
     52    void syncTextTrackBounds() final;
    5153
    5254private:
     55    RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
    5356    RetainPtr<PlatformLayer> m_videoInlineLayer;
    5457    RetainPtr<PlatformLayer> m_videoFullscreenLayer;
    5558    RetainPtr<PlatformLayer> m_videoLayer;
    5659    FloatRect m_videoFullscreenFrame;
     60    FloatRect m_videoInlineFrame;
    5761};
    5862
    5963}
    6064
    61 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm

    r229823 r229824  
    2525
    2626#import "config.h"
    27 #import "VideoFullscreenLayerManager.h"
    28 
    29 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     27#import "VideoFullscreenLayerManagerObjC.h"
    3028
    3129#import "Color.h"
     30#import "TextTrackRepresentation.h"
    3231#import "WebCoreCALayerExtras.h"
    3332#import <mach/mach_init.h>
     
    6059namespace WebCore {
    6160
    62 VideoFullscreenLayerManager::VideoFullscreenLayerManager()
     61VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC()
     62    : VideoFullscreenLayerManager()
    6363{
    6464}
    6565
    66 void VideoFullscreenLayerManager::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize)
     66void VideoFullscreenLayerManagerObjC::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize)
    6767{
    6868    m_videoLayer = videoLayer;
     69    m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height());
    6970
    7071    [m_videoLayer web_disableAllActions];
     
    7374    [m_videoInlineLayer setName:@"WebVideoContainerLayer"];
    7475#endif
    75     [m_videoInlineLayer setFrame:CGRectMake(0, 0, contentSize.width(), contentSize.height())];
     76    [m_videoInlineLayer setFrame:m_videoInlineFrame];
    7677    if (m_videoFullscreenLayer) {
    7778        [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
     
    8384}
    8485
    85 void VideoFullscreenLayerManager::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
     86void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler)
    8687{
    8788    if (m_videoFullscreenLayer == videoFullscreenLayer) {
     
    126127}
    127128
    128 void VideoFullscreenLayerManager::setVideoFullscreenFrame(FloatRect videoFullscreenFrame)
     129void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFullscreenFrame)
    129130{
    130131    m_videoFullscreenFrame = videoFullscreenFrame;
     
    132133        return;
    133134
    134     [m_videoLayer setFrame:CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height())];
     135    [m_videoLayer setFrame:m_videoFullscreenFrame];
    135136}
    136137
    137 void VideoFullscreenLayerManager::didDestroyVideoLayer()
     138void VideoFullscreenLayerManagerObjC::didDestroyVideoLayer()
    138139{
    139140    [m_videoLayer removeFromSuperlayer];
     
    143144}
    144145
     146bool VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation() const
     147{
     148    return m_videoFullscreenLayer;
    145149}
    146150
    147 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
     151void VideoFullscreenLayerManagerObjC::syncTextTrackBounds()
     152{
     153    if (!m_videoFullscreenLayer || !m_textTrackRepresentationLayer)
     154        return;
     155
     156    [CATransaction begin];
     157    [CATransaction setDisableActions:YES];
     158
     159    CGRect textFrame = m_videoLayer ? m_videoInlineFrame : m_videoFullscreenFrame;
     160    [m_textTrackRepresentationLayer setFrame:textFrame];
     161
     162    [CATransaction commit];
     163}
     164
     165void VideoFullscreenLayerManagerObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
     166{
     167    PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
     168    if (representationLayer == m_textTrackRepresentationLayer) {
     169        syncTextTrackBounds();
     170        return;
     171    }
     172
     173    [CATransaction begin];
     174    [CATransaction setDisableActions:YES];
     175
     176    if (m_textTrackRepresentationLayer)
     177        [m_textTrackRepresentationLayer removeFromSuperlayer];
     178
     179    m_textTrackRepresentationLayer = representationLayer;
     180
     181    if (m_videoFullscreenLayer && m_textTrackRepresentationLayer) {
     182        syncTextTrackBounds();
     183        [m_videoFullscreenLayer addSublayer:m_textTrackRepresentationLayer.get()];
     184    }
     185
     186    [CATransaction commit];
     187
     188}
     189
     190}
     191
Note: See TracChangeset for help on using the changeset viewer.