Captions are sized incorrectly in PiP mode
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 May 2018 01:02:44 +0000 (01:02 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 May 2018 01:02:44 +0000 (01:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186005
<rdar://problem/39729718>

Reviewed by Dean Jackson.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateSizes): Only sync text track bounds
when the size actually changes.

* platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
(WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): Call syncTextTrackBounds.
(WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): Set the text track layer size
to m_videoFullscreenFrame, it is always set the size of the PiP/Fullscreen layer.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232220 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm

index d967e65..c0617d4 100644 (file)
@@ -1,3 +1,20 @@
+2018-05-25  Eric Carlson  <eric.carlson@apple.com>
+
+        Captions are sized incorrectly in PiP mode
+        https://bugs.webkit.org/show_bug.cgi?id=186005
+        <rdar://problem/39729718>
+
+        Reviewed by Dean Jackson.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::updateSizes): Only sync text track bounds 
+        when the size actually changes.
+
+        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
+        (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): Call syncTextTrackBounds.
+        (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): Set the text track layer size
+        to m_videoFullscreenFrame, it is always set the size of the PiP/Fullscreen layer.
+
 2018-05-25  Timothy Hatcher  <timothy@apple.com>
 
         Setting drawsBackground to YES on a WKView doesn't take effect immediately
index 109321c..c41025f 100644 (file)
@@ -1382,8 +1382,6 @@ void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate)
     if (!document().page())
         return;
 
-    mediaElement->syncTextTrackBounds();
-
     IntRect videoBox;
     if (m_textTrackRepresentation) {
         videoBox = m_textTrackRepresentation->bounds();
@@ -1401,6 +1399,7 @@ void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate)
 
     m_videoDisplaySize = videoBox;
     m_updateTextTrackRepresentationStyle = true;
+    mediaElement->syncTextTrackBounds();
 
     // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately.
     m_updateTimer.startOneShot(0_s);
index f9ff45d..1f71d43 100644 (file)
@@ -144,6 +144,7 @@ void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFul
         return;
 
     [m_videoLayer setFrame:m_videoFullscreenFrame];
+    syncTextTrackBounds();
 }
 
 void VideoFullscreenLayerManagerObjC::didDestroyVideoLayer()
@@ -167,8 +168,7 @@ void VideoFullscreenLayerManagerObjC::syncTextTrackBounds()
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
-    CGRect textFrame = m_videoLayer ? m_videoInlineFrame : m_videoFullscreenFrame;
-    [m_textTrackRepresentationLayer setFrame:textFrame];
+    [m_textTrackRepresentationLayer setFrame:m_videoFullscreenFrame];
 
     [CATransaction commit];
 }