Title: [224574] trunk/Source/WebCore
Revision
224574
Author
[email protected]
Date
2017-11-08 01:49:03 -0800 (Wed, 08 Nov 2017)

Log Message

Disable implicit animations when adding or removing text track representation layers.
https://bugs.webkit.org/show_bug.cgi?id=179406
rdar://problem/34369835

Patch by Jeremy Jones <[email protected]> on 2017-11-08
Reviewed by Simon Fraser.

No new tests because this has no effect on the DOM.

This change prevents implicit animations when the text track layer is added or removed from
the video layer.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
* platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
(WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224573 => 224574)


--- trunk/Source/WebCore/ChangeLog	2017-11-08 08:47:20 UTC (rev 224573)
+++ trunk/Source/WebCore/ChangeLog	2017-11-08 09:49:03 UTC (rev 224574)
@@ -1,3 +1,27 @@
+2017-11-08  Jeremy Jones  <[email protected]>
+
+        Disable implicit animations when adding or removing text track representation layers.
+        https://bugs.webkit.org/show_bug.cgi?id=179406
+        rdar://problem/34369835
+
+        Reviewed by Simon Fraser.
+
+        No new tests because this has no effect on the DOM.
+
+        This change prevents implicit animations when the text track layer is added or removed from
+        the video layer.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
+        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
+        (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
+
 2017-11-07  Maciej Stachowiak  <[email protected]>
 
         Get rid of unsightly hex numbers from unified build object files

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2017-11-08 08:47:20 UTC (rev 224573)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2017-11-08 09:49:03 UTC (rev 224574)
@@ -1234,6 +1234,9 @@
         return;
     }
 
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
+
     m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
 
     if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
@@ -1241,6 +1244,8 @@
         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
     }
 
+    [CATransaction commit];
+
     updateDisableExternalPlayback();
 }
 
@@ -2234,9 +2239,14 @@
     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
 }
 
@@ -2249,6 +2259,9 @@
         return;
     }
 
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
+
     if (m_textTrackRepresentationLayer)
         [m_textTrackRepresentationLayer removeFromSuperlayer];
 
@@ -2259,6 +2272,8 @@
         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
     }
 
+    [CATransaction commit];
+
 #else
     UNUSED_PARAM(representation);
 #endif

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (224573 => 224574)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-11-08 08:47:20 UTC (rev 224573)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-11-08 09:49:03 UTC (rev 224574)
@@ -1047,7 +1047,10 @@
         completionHandler();
         return;
     }
-    
+
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
+
     m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler));
     
     if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {
@@ -1054,6 +1057,8 @@
         syncTextTrackBounds();
         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
     }
+
+    [CATransaction commit];
 }
 
 void MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame(FloatRect frame)
@@ -1077,11 +1082,16 @@
 #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
 }
     
@@ -1093,7 +1103,10 @@
         syncTextTrackBounds();
         return;
     }
-    
+
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
+
     if (m_textTrackRepresentationLayer)
         [m_textTrackRepresentationLayer removeFromSuperlayer];
     
@@ -1103,6 +1116,8 @@
         syncTextTrackBounds();
         [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];
     }
+
+    [CATransaction commit];
     
 #else
     UNUSED_PARAM(representation);

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm (224573 => 224574)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm	2017-11-08 08:47:20 UTC (rev 224573)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm	2017-11-08 09:49:03 UTC (rev 224574)
@@ -121,16 +121,12 @@
             [newContext setFencePort:fencePort];
             mach_port_deallocate(mach_task_self(), fencePort);
         }
-
-        [CATransaction setCompletionBlock:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler)] {
-            completionHandler();
-        }).get()];
-    } else {
-        [CATransaction setCompletionBlock:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler)] {
-            completionHandler();
-        }).get()];
     }
 
+    [CATransaction setCompletionBlock:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler)] {
+        completionHandler();
+    }).get()];
+
     [CATransaction commit];
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to