Title: [293618] trunk/Source/WebCore
Revision
293618
Author
[email protected]
Date
2022-04-29 09:26:38 -0700 (Fri, 29 Apr 2022)

Log Message

[iOS] Video on twitch.tv shifts to top of screen when toggling playback in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=239884
<rdar://92367060>

Reviewed by Eric Carlson.

Twitch will cause the HTMLMediaElement to recreate the MediaPlayer when resuming playback
after pausing. If this happens in fullscreen, VideoLayerManagerObjC::setVideoLayer() will
be called with the new video layer, however it will be laid out pinned to the top-left
corner of the screen (rather than centered), as setVideoLayer() will call -setFrame with
an explicit 0,0 position argument.

Rather than pin the layer to the top-left, use the full value of m_videoFullscreenFrame
when setting the video layer frame, both in setVideoLayer() as well as
setVideoFullscreenLayer().

Its currently impossible to write an test for this behavior, as TestWebKitAPI is not a UI
application, and therefore cannot enter fullscreen mode.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293617 => 293618)


--- trunk/Source/WebCore/ChangeLog	2022-04-29 15:59:03 UTC (rev 293617)
+++ trunk/Source/WebCore/ChangeLog	2022-04-29 16:26:38 UTC (rev 293618)
@@ -1,3 +1,28 @@
+2022-04-29  Jer Noble  <[email protected]>
+
+        [iOS] Video on twitch.tv shifts to top of screen when toggling playback in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=239884
+        <rdar://92367060>
+
+        Reviewed by Eric Carlson.
+
+        Twitch will cause the HTMLMediaElement to recreate the MediaPlayer when resuming playback
+        after pausing. If this happens in fullscreen, VideoLayerManagerObjC::setVideoLayer() will
+        be called with the new video layer, however it will be laid out pinned to the top-left
+        corner of the screen (rather than centered), as setVideoLayer() will call -setFrame with
+        an explicit 0,0 position argument.
+
+        Rather than pin the layer to the top-left, use the full value of m_videoFullscreenFrame
+        when setting the video layer frame, both in setVideoLayer() as well as
+        setVideoFullscreenLayer().
+
+        Its currently impossible to write an test for this behavior, as TestWebKitAPI is not a UI
+        application, and therefore cannot enter fullscreen mode.
+
+        * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
+        (WebCore::VideoLayerManagerObjC::setVideoLayer):
+        (WebCore::VideoLayerManagerObjC::setVideoFullscreenLayer):
+
 2022-04-29  Tim Nguyen  <[email protected]>
 
         Add background-clip: text to CSSProperties.json

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2022-04-29 15:59:03 UTC (rev 293617)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2022-04-29 16:26:38 UTC (rev 293618)
@@ -77,7 +77,7 @@
 
 #if ENABLE(VIDEO_PRESENTATION_MODE)
     if (m_videoFullscreenLayer) {
-        [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
+        [m_videoLayer setFrame:m_videoFullscreenFrame];
         [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
     } else
 #endif
@@ -125,7 +125,7 @@
             [m_videoInlineLayer setContents:(__bridge id)currentImage.get()];
 
         if (m_videoFullscreenLayer) {
-            [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())];
+            [m_videoLayer setFrame:m_videoFullscreenFrame];
             [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
         } else if (m_videoInlineLayer) {
             [m_videoLayer setFrame:[m_videoInlineLayer bounds]];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to