Title: [267573] trunk/Source/WebCore
Revision
267573
Author
[email protected]
Date
2020-09-25 09:24:33 -0700 (Fri, 25 Sep 2020)

Log Message

Clean up VideoLayerManagerObjC
https://bugs.webkit.org/show_bug.cgi?id=216946

Reviewed by Eric Carlson.

Remove m_videoInlineFrame. Also, change the order of some variables
and functions to put related things together.

No new tests since no functional changes.

* platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h:
* platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
(WebCore::VideoLayerManagerObjC::setVideoLayer):
(WebCore::VideoLayerManagerObjC::didDestroyVideoLayer):
(WebCore::VideoLayerManagerObjC::setVideoFullscreenLayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (267572 => 267573)


--- trunk/Source/WebCore/ChangeLog	2020-09-25 16:05:45 UTC (rev 267572)
+++ trunk/Source/WebCore/ChangeLog	2020-09-25 16:24:33 UTC (rev 267573)
@@ -1,3 +1,21 @@
+2020-09-25  Peng Liu  <[email protected]>
+
+        Clean up VideoLayerManagerObjC
+        https://bugs.webkit.org/show_bug.cgi?id=216946
+
+        Reviewed by Eric Carlson.
+
+        Remove m_videoInlineFrame. Also, change the order of some variables
+        and functions to put related things together.
+
+        No new tests since no functional changes.
+
+        * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h:
+        * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
+        (WebCore::VideoLayerManagerObjC::setVideoLayer):
+        (WebCore::VideoLayerManagerObjC::didDestroyVideoLayer):
+        (WebCore::VideoLayerManagerObjC::setVideoFullscreenLayer):
+
 2020-09-25  Zalan Bujtas  <[email protected]>
 
         [LFC][Out-of-flow] ASSERTION FAILED: !layoutBox.isOutOfFlowPositioned() in WebCore::Layout::FormattingContext::Geometry::computedHeightValue

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h (267572 => 267573)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h	2020-09-25 16:05:45 UTC (rev 267572)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h	2020-09-25 16:24:33 UTC (rev 267573)
@@ -46,15 +46,16 @@
     VideoLayerManagerObjC(const Logger&, const void*);
 
     PlatformLayer *videoInlineLayer() const { return m_videoInlineLayer.get(); }
+
     void setVideoLayer(PlatformLayer *, IntSize contentSize);
     void didDestroyVideoLayer();
 
 #if ENABLE(VIDEO_PRESENTATION_MODE)
     PlatformLayer *videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); }
+    void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler, NativeImagePtr);
     FloatRect videoFullscreenFrame() const { return m_videoFullscreenFrame; }
-    void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler, NativeImagePtr);
+    void setVideoFullscreenFrame(FloatRect);
     void updateVideoFullscreenInlineImage(NativeImagePtr);
-    void setVideoFullscreenFrame(FloatRect);
 #endif
 
     bool requiresTextTrackRepresentation() const;
@@ -70,13 +71,13 @@
     Ref<const Logger> m_logger;
     const void* m_logIdentifier;
 
-    RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
     RetainPtr<WebVideoContainerLayer> m_videoInlineLayer;
-    FloatRect m_videoInlineFrame;
 #if ENABLE(VIDEO_PRESENTATION_MODE)
     RetainPtr<PlatformLayer> m_videoFullscreenLayer;
     FloatRect m_videoFullscreenFrame;
 #endif
+    RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
+
     RetainPtr<PlatformLayer> m_videoLayer;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm (267572 => 267573)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2020-09-25 16:05:45 UTC (rev 267572)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2020-09-25 16:24:33 UTC (rev 267573)
@@ -58,8 +58,7 @@
 
     m_videoInlineLayer = adoptNS([[WebVideoContainerLayer alloc] init]);
     [m_videoInlineLayer setName:@"WebVideoContainerLayer"];
-    m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height());
-    [m_videoInlineLayer setFrame:m_videoInlineFrame];
+    [m_videoInlineLayer setFrame:CGRectMake(0, 0, contentSize.width(), contentSize.height())];
     [m_videoInlineLayer setContentsGravity:kCAGravityResizeAspect];
     if (PAL::isAVFoundationFrameworkAvailable() && [videoLayer isKindOfClass:PAL::getAVPlayerLayerClass()])
         [m_videoInlineLayer setPlayerLayer:(AVPlayerLayer *)videoLayer];
@@ -71,11 +70,21 @@
     } else
 #endif
     {
+        [m_videoLayer setFrame:m_videoInlineLayer.get().bounds];
         [m_videoInlineLayer insertSublayer:m_videoLayer.get() atIndex:0];
-        [m_videoLayer setFrame:m_videoInlineLayer.get().bounds];
     }
 }
 
+void VideoLayerManagerObjC::didDestroyVideoLayer()
+{
+    ALWAYS_LOG(LOGIDENTIFIER);
+
+    [m_videoLayer removeFromSuperlayer];
+
+    m_videoInlineLayer = nil;
+    m_videoLayer = nil;
+}
+
 #if ENABLE(VIDEO_PRESENTATION_MODE)
 
 void VideoLayerManagerObjC::updateVideoFullscreenInlineImage(NativeImagePtr image)
@@ -105,8 +114,8 @@
             [m_videoInlineLayer setContents:(__bridge id)currentImage.get()];
 
         if (m_videoFullscreenLayer) {
+            [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
             [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];
@@ -145,16 +154,6 @@
 
 #endif
 
-void VideoLayerManagerObjC::didDestroyVideoLayer()
-{
-    ALWAYS_LOG(LOGIDENTIFIER);
-
-    [m_videoLayer removeFromSuperlayer];
-
-    m_videoInlineLayer = nil;
-    m_videoLayer = nil;
-}
-
 bool VideoLayerManagerObjC::requiresTextTrackRepresentation() const
 {
 #if ENABLE(VIDEO_PRESENTATION_MODE)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to