Captions sometimes render at the wrong size when in fullscreen and PiP
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Feb 2020 22:07:37 +0000 (22:07 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Feb 2020 22:07:37 +0000 (22:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=207389
<rdar://problem/58677864>

Reviewed by Jer Noble.

The TextTrackRepresentation, used to render captions when in fullscreen and PiP on
iOS and and in PiP on macOS, frequently rendered captions before layout completed
immediately after it was created. Fix this by having it not render until a layout
happens. Additionally, make the code more efficient by hiding the TextTrackRepresentation's
backing layer when cues are not visible instead of destroying the whole object.
Drive by: RELEASE_LOG_DISABLED is always defined for PLATFORM(COCOA), so remove it
from the macOS/iOS media players to make it easier to add logging to VideoFullscreenLayerManagerObjC.

* html/HTMLMediaElement.cpp:
(WebCore::convertEnumerationToString):
(WebCore::HTMLMediaElement::configureTextTrackDisplay):
* html/HTMLMediaElementEnums.h:
(WTF::LogArgument<WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType>::toString):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement):
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):
(WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
(WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation):
(WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle):
(WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary):
(WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize):
(WebCore::MediaControlTextTrackContainerElement::updateSizes):
(WebCore::MediaControlTextTrackContainerElement::updateCueStyles):
(WebCore::MediaControlTextTrackContainerElement::logger const):
(WebCore::MediaControlTextTrackContainerElement::logIdentifier const):
(WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Deleted.
(WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Deleted.
* platform/graphics/TextTrackRepresentation.h:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::logChannel const):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const):
* platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
* platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
(WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
(WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
(WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
(WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
(WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
(WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
(WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
(WebCore::VideoFullscreenLayerManagerObjC::logChannel const):
* platform/graphics/cocoa/TextTrackRepresentationCocoa.h:
* platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
(-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]):
(TextTrackRepresentationCocoa::setHidden const):
(TextTrackRepresentationCocoa::boundsChanged):
* rendering/RenderMediaControlElements.cpp:
(WebCore::RenderTextTrackContainerElement::layout):

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

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElementEnums.h
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/MediaControlElements.h
Source/WebCore/platform/graphics/TextTrackRepresentation.cpp
Source/WebCore/platform/graphics/TextTrackRepresentation.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm
Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h
Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm
Source/WebCore/rendering/RenderMediaControlElements.cpp

index 565af23..6f5398c 100644 (file)
@@ -1,3 +1,79 @@
+2020-02-07  Eric Carlson  <eric.carlson@apple.com>
+
+        Captions sometimes render at the wrong size when in fullscreen and PiP
+        https://bugs.webkit.org/show_bug.cgi?id=207389
+        <rdar://problem/58677864>
+
+        Reviewed by Jer Noble.
+
+        The TextTrackRepresentation, used to render captions when in fullscreen and PiP on
+        iOS and and in PiP on macOS, frequently rendered captions before layout completed
+        immediately after it was created. Fix this by having it not render until a layout
+        happens. Additionally, make the code more efficient by hiding the TextTrackRepresentation's
+        backing layer when cues are not visible instead of destroying the whole object.
+        Drive by: RELEASE_LOG_DISABLED is always defined for PLATFORM(COCOA), so remove it
+        from the macOS/iOS media players to make it easier to add logging to VideoFullscreenLayerManagerObjC.
+        
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::convertEnumerationToString):
+        (WebCore::HTMLMediaElement::configureTextTrackDisplay):
+        * html/HTMLMediaElementEnums.h:
+        (WTF::LogArgument<WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType>::toString):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement):
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
+        (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
+        (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation):
+        (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle):
+        (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary):
+        (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize):
+        (WebCore::MediaControlTextTrackContainerElement::updateSizes):
+        (WebCore::MediaControlTextTrackContainerElement::updateCueStyles):
+        (WebCore::MediaControlTextTrackContainerElement::logger const):
+        (WebCore::MediaControlTextTrackContainerElement::logIdentifier const):
+        (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Deleted.
+        (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Deleted.
+        * platform/graphics/TextTrackRepresentation.h:
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
+        (WebCore::MediaPlayerPrivateAVFoundation::logChannel const):
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
+        (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::mediaPlayerLogger):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::logChannel const):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
+        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const):
+        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
+        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
+        (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
+        (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
+        (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
+        (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
+        (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
+        (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
+        (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
+        (WebCore::VideoFullscreenLayerManagerObjC::logChannel const):
+        * platform/graphics/cocoa/TextTrackRepresentationCocoa.h:
+        * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
+        (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]):
+        (TextTrackRepresentationCocoa::setHidden const):
+        (TextTrackRepresentationCocoa::boundsChanged):
+        * rendering/RenderMediaControlElements.cpp:
+        (WebCore::RenderTextTrackContainerElement::layout):
+
 2020-02-07  Sam Weinig  <weinig@apple.com>
 
         Move trivial definitions from FeatureDefines.xcconfig to PlatformEnableCocoa.h
index c5f49da..da14277 100644 (file)
@@ -274,6 +274,18 @@ String convertEnumerationToString(HTMLMediaElement::AutoplayEventPlaybackState e
     return values[static_cast<size_t>(enumerationValue)];
 }
 
+String convertEnumerationToString(HTMLMediaElement::TextTrackVisibilityCheckType enumerationValue)
+{
+    static const NeverDestroyed<String> values[] = {
+        MAKE_STATIC_STRING_IMPL("CheckTextTrackVisibility"),
+        MAKE_STATIC_STRING_IMPL("AssumeTextTrackVisibilityChanged"),
+    };
+    static_assert(static_cast<size_t>(HTMLMediaElement::TextTrackVisibilityCheckType::CheckTextTrackVisibility) == 0, "TextTrackVisibilityCheckType::CheckTextTrackVisibility is not 0 as expected");
+    static_assert(static_cast<size_t>(HTMLMediaElement::TextTrackVisibilityCheckType::AssumeTextTrackVisibilityChanged) == 1, "TextTrackVisibilityCheckType::AssumeTextTrackVisibilityChanged is not 1 as expected");
+    ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+    return values[static_cast<size_t>(enumerationValue)];
+}
+
 #if ENABLE(VIDEO_TRACK)
 
 class TrackDisplayUpdateScope {
@@ -6534,7 +6546,7 @@ void HTMLMediaElement::configureMediaControls()
 #if ENABLE(VIDEO_TRACK)
 void HTMLMediaElement::configureTextTrackDisplay(TextTrackVisibilityCheckType checkType)
 {
-    ALWAYS_LOG(LOGIDENTIFIER);
+    ALWAYS_LOG(LOGIDENTIFIER, checkType);
     ASSERT(m_textTracks);
 
     if (m_processingPreferenceChange)
index 0d8a93d..95fe30f 100644 (file)
@@ -47,6 +47,7 @@ public:
 
 String convertEnumerationToString(HTMLMediaElementEnums::ReadyState);
 String convertEnumerationToString(HTMLMediaElementEnums::NetworkState);
+String convertEnumerationToString(HTMLMediaElementEnums::TextTrackVisibilityCheckType);
 
 } // namespace WebCore
 
@@ -71,5 +72,13 @@ struct LogArgument<WebCore::HTMLMediaElementEnums::NetworkState> {
     }
 };
 
+template <>
+struct LogArgument<WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType> {
+    static String toString(const WebCore::HTMLMediaElementEnums::TextTrackVisibilityCheckType type)
+    {
+        return convertEnumerationToString(type);
+    }
+};
+
 }; // namespace WTF
 
index f6bbfad..733376c 100644 (file)
@@ -1093,10 +1093,6 @@ static const AtomString& getMediaControlCurrentTimeDisplayElementShadowPseudoId(
 
 MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Document& document)
     : MediaControlDivElement(document, MediaTextTrackDisplayContainer)
-    , m_updateTimer(*this, &MediaControlTextTrackContainerElement::updateTimerFired)
-    , m_fontSize(0)
-    , m_fontSizeIsImportant(false)
-    , m_updateTextTrackRepresentationStyle(false)
 {
     setPseudo(AtomString("-webkit-media-text-track-container", AtomString::ConstructFromLiteral));
 }
@@ -1205,13 +1201,13 @@ void MediaControlTextTrackContainerElement::updateDisplay()
     }
 
     // 11. Return output.
-    if (hasChildNodes()) {
+    if (hasChildNodes())
         show();
-        updateTextTrackRepresentation();
-    } else {
+    else
         hide();
-        clearTextTrackRepresentation();
-    }
+
+    if (m_textTrackRepresentation || video.requiresTextTrackRepresentation())
+        updateTextTrackRepresentation();
 }
 
 void MediaControlTextTrackContainerElement::processActiveVTTCue(VTTCue& cue)
@@ -1293,50 +1289,39 @@ void MediaControlTextTrackContainerElement::updateTextStrokeStyle()
         setInlineStyleProperty(CSSPropertyStrokeWidth, strokeWidth, CSSUnitType::CSS_PX, important);
 }
 
-void MediaControlTextTrackContainerElement::updateTimerFired()
-{
-    if (!document().page())
-        return;
-
-    auto mediaElement = parentMediaElement(this);
-    if (!mediaElement)
-        return;
-
-    for (auto& activeCue : mediaElement->currentlyActiveCues())
-        activeCue.data()->recalculateStyles();
-
-    if (m_textTrackRepresentation)
-        updateStyleForTextTrackRepresentation();
-
-    updateActiveCuesFontSize();
-    updateDisplay();
-    updateTextStrokeStyle();
-}
-
 void MediaControlTextTrackContainerElement::updateTextTrackRepresentation()
 {
     auto mediaElement = parentMediaElement(this);
     if (!mediaElement)
         return;
 
-    if (!mediaElement->requiresTextTrackRepresentation()) {
+    auto requiresTextTrackRepresentation = mediaElement->requiresTextTrackRepresentation();
+    if (!hasChildNodes() || !requiresTextTrackRepresentation) {
         if (m_textTrackRepresentation) {
-            clearTextTrackRepresentation();
-            updateSizes(ForceUpdate::Yes);
+            if (!requiresTextTrackRepresentation) {
+                clearTextTrackRepresentation();
+                updateSizes(ForceUpdate::Yes);
+            } else
+                m_textTrackRepresentation->setHidden(true);
         }
         return;
     }
 
     if (!m_textTrackRepresentation) {
+        ALWAYS_LOG(LOGIDENTIFIER);
+
+        m_waitingForFirstLayout = true;
         m_textTrackRepresentation = TextTrackRepresentation::create(*this);
         if (document().page())
             m_textTrackRepresentation->setContentScale(document().page()->deviceScaleFactor());
-        m_updateTextTrackRepresentationStyle = true;
         mediaElement->setTextTrackRepresentation(m_textTrackRepresentation.get());
+        updateSizes();
+        updateTextTrackRepresentationStyle();
     }
 
-    m_textTrackRepresentation->update();
-    updateStyleForTextTrackRepresentation();
+    m_textTrackRepresentation->setHidden(false);
+    if (!m_waitingForFirstLayout)
+        m_textTrackRepresentation->update();
 }
 
 void MediaControlTextTrackContainerElement::clearTextTrackRepresentation()
@@ -1344,21 +1329,18 @@ void MediaControlTextTrackContainerElement::clearTextTrackRepresentation()
     if (!m_textTrackRepresentation)
         return;
 
+    ALWAYS_LOG(LOGIDENTIFIER);
+
+    m_waitingForFirstLayout = true;
     m_textTrackRepresentation = nullptr;
-    m_updateTextTrackRepresentationStyle = true;
     if (auto mediaElement = parentMediaElement(this))
         mediaElement->setTextTrackRepresentation(nullptr);
-    updateStyleForTextTrackRepresentation();
+    updateTextTrackRepresentationStyle();
     updateActiveCuesFontSize();
 }
 
-void MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation()
+void MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle()
 {
-    if (!m_updateTextTrackRepresentationStyle)
-        return;
-
-    m_updateTextTrackRepresentationStyle = false;
-
     if (m_textTrackRepresentation) {
         setInlineStyleProperty(CSSPropertyWidth, m_videoDisplaySize.size().width(), CSSUnitType::CSS_PX);
         setInlineStyleProperty(CSSPropertyHeight, m_videoDisplaySize.size().height(), CSSUnitType::CSS_PX);
@@ -1388,14 +1370,31 @@ void MediaControlTextTrackContainerElement::exitedFullscreen()
     updateSizes(ForceUpdate::Yes);
 }
 
-void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force)
+void MediaControlTextTrackContainerElement::layoutIfNecessary()
 {
-    auto mediaElement = parentMediaElement(this);
-    if (!mediaElement)
+    m_waitingForFirstLayout = false;
+
+    auto sizeChanged = updateVideoDisplaySize();
+    if (m_textTrackRepresentation)
+        m_textTrackRepresentation->update();
+
+    if (!sizeChanged)
         return;
 
+    // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately.
+    m_taskQueue.enqueueTask([this] () {
+        updateCueStyles();
+    });
+}
+
+bool MediaControlTextTrackContainerElement::updateVideoDisplaySize()
+{
     if (!document().page())
-        return;
+        return false;
+
+    auto mediaElement = parentMediaElement(this);
+    if (!mediaElement)
+        return false;
 
     IntRect videoBox;
     if (m_textTrackRepresentation) {
@@ -1405,19 +1404,42 @@ void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force)
         videoBox.setHeight(videoBox.height() * deviceScaleFactor);
     } else {
         if (!is<RenderVideo>(mediaElement->renderer()))
-            return;
+            return false;
         videoBox = downcast<RenderVideo>(*mediaElement->renderer()).videoBox();
     }
 
-    if (force == ForceUpdate::No && m_videoDisplaySize == videoBox)
-        return;
+    if (m_videoDisplaySize == videoBox)
+        return false;
 
     m_videoDisplaySize = videoBox;
-    m_updateTextTrackRepresentationStyle = true;
+    updateTextTrackRepresentationStyle();
+
+    return true;
+}
+
+void MediaControlTextTrackContainerElement::updateSizes(ForceUpdate force)
+{
+    if (updateVideoDisplaySize() || force == ForceUpdate::Yes)
+        updateCueStyles();
+}
+
+void MediaControlTextTrackContainerElement::updateCueStyles()
+{
+    if (!document().page())
+        return;
+
+    auto mediaElement = parentMediaElement(this);
+    if (!mediaElement)
+        return;
+
     mediaElement->syncTextTrackBounds();
 
-    // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately.
-    m_updateTimer.startOneShot(0_s);
+    for (auto& activeCue : mediaElement->currentlyActiveCues())
+        activeCue.data()->recalculateStyles();
+
+    updateActiveCuesFontSize();
+    updateDisplay();
+    updateTextStrokeStyle();
 }
 
 RefPtr<Image> MediaControlTextTrackContainerElement::createTextTrackRepresentationImage()
@@ -1466,14 +1488,20 @@ void MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged
 #if !RELEASE_LOG_DISABLED
 const Logger& MediaControlTextTrackContainerElement::logger() const
 {
-    return document().logger();
+    if (!m_logger)
+        m_logger = &document().logger();
+
+    return *m_logger;
 }
 
 const void* MediaControlTextTrackContainerElement::logIdentifier() const
 {
-    if (auto mediaElement = parentMediaElement(this))
-        return mediaElement->logIdentifier();
-    return nullptr;
+    if (!m_logIdentifier) {
+        if (auto mediaElement = parentMediaElement(this))
+            m_logIdentifier = mediaElement->logIdentifier();
+    }
+
+    return m_logIdentifier;
 }
 
 WTFLogChannel& MediaControlTextTrackContainerElement::logChannel() const
index eab558f..23307b6 100644 (file)
@@ -31,6 +31,7 @@
 
 #if ENABLE(VIDEO)
 
+#include "GenericTaskQueue.h"
 #include "MediaControlElementTypes.h"
 #include "TextTrackRepresentation.h"
 #include <wtf/LoggerHelper.h>
@@ -482,40 +483,44 @@ public:
 
     enum class ForceUpdate { Yes, No };
     void updateSizes(ForceUpdate force = ForceUpdate::No);
+    void layoutIfNecessary();
 
     void updateDisplay();
     void enteredFullscreen();
     void exitedFullscreen();
 
 private:
-    void updateTimerFired();
+    explicit MediaControlTextTrackContainerElement(Document&);
+
+    bool updateVideoDisplaySize();
+    void updateCueStyles();
     void updateActiveCuesFontSize();
     void updateTextStrokeStyle();
     void processActiveVTTCue(VTTCue&);
+    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
+
+    RefPtr<Image> createTextTrackRepresentationImage() override;
+    void textTrackRepresentationBoundsChanged(const IntRect&) override;
+    void updateTextTrackRepresentation();
+    void clearTextTrackRepresentation();
+    void updateTextTrackRepresentationStyle();
 
 #if !RELEASE_LOG_DISABLED
     const Logger& logger() const final;
     const void* logIdentifier() const final;
     WTFLogChannel& logChannel() const final;
     const char* logClassName() const final { return "MediaControlTextTrackContainerElement"; }
+    mutable RefPtr<Logger> m_logger;
+    mutable const void* m_logIdentifier { nullptr };
 #endif
 
-    explicit MediaControlTextTrackContainerElement(Document&);
-
-    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
-
-    RefPtr<Image> createTextTrackRepresentationImage() override;
-    void textTrackRepresentationBoundsChanged(const IntRect&) override;
-    void updateTextTrackRepresentation();
-    void clearTextTrackRepresentation();
-    void updateStyleForTextTrackRepresentation();
     std::unique_ptr<TextTrackRepresentation> m_textTrackRepresentation;
 
-    Timer m_updateTimer;
+    GenericTaskQueue<Timer> m_taskQueue;
     IntRect m_videoDisplaySize;
-    int m_fontSize;
-    bool m_fontSizeIsImportant;
-    bool m_updateTextTrackRepresentationStyle;
+    int m_fontSize { 0 };
+    bool m_fontSizeIsImportant { false };
+    bool m_waitingForFirstLayout { true };
 };
 
 #endif
index 6939f91..a3265e0 100644 (file)
@@ -36,10 +36,11 @@ namespace WebCore {
 class NullTextTrackRepresentation : public TextTrackRepresentation {
 public:
     virtual ~NullTextTrackRepresentation() = default;
-    void update() override { }
-    PlatformLayer* platformLayer() override { return nullptr; }
-    void setContentScale(float) override { }
-    IntRect bounds() const override { return IntRect(); }
+    void update() final { }
+    PlatformLayer* platformLayer() final { return nullptr; }
+    void setContentScale(float) final { }
+    IntRect bounds() const final { return IntRect(); }
+    void setHidden(bool) const final { }
 };
 
 #if !(PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)))
index 5dc255d..8b1f7f6 100644 (file)
@@ -55,6 +55,7 @@ public:
     virtual PlatformLayer* platformLayer() = 0;
     virtual void setContentScale(float) = 0;
     virtual IntRect bounds() const = 0;
+    virtual void setHidden(bool) const = 0;
 };
 
 }
index 94a1ae4..1ead5cf 100644 (file)
@@ -404,7 +404,7 @@ void MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins(const String&
 
 MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player)
     : MediaPlayerPrivateAVFoundation(player)
-    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())
+    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(logger(), logIdentifier()))
     , m_videoFullscreenGravity(MediaPlayer::VideoGravity::ResizeAspect)
     , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithPlayer:makeWeakPtr(*this)]))
     , m_videoFrameHasDrawn(false)
@@ -1091,6 +1091,7 @@ void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer(PlatformLayer*
 
 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame(FloatRect frame)
 {
+    ALWAYS_LOG(LOGIDENTIFIER, "width = ", frame.size().width(), ", height = ", frame.size().height());
     m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
 }
 
@@ -1558,17 +1559,13 @@ RetainPtr<CGImageRef> MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRe
         createImageGenerator();
     ASSERT(m_imageGenerator);
 
-#if !RELEASE_LOG_DISABLED
     MonotonicTime start = MonotonicTime::now();
-#endif
 
     [m_imageGenerator.get() setMaximumSize:CGSize(rect.size())];
     RetainPtr<CGImageRef> rawImage = adoptCF([m_imageGenerator.get() copyCGImageAtTime:CMTimeMakeWithSeconds(time, 600) actualTime:nil error:nil]);
     RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawImage.get(), sRGBColorSpaceRef()));
 
-#if !RELEASE_LOG_DISABLED
     INFO_LOG(LOGIDENTIFIER, "creating image took ", (MonotonicTime::now() - start).seconds());
-#endif
 
     return image;
 }
@@ -2015,9 +2012,7 @@ void determineChangedTracksFromNewTracksAndOldItems(MediaSelectionGroupAVFObjC*
 
 void MediaPlayerPrivateAVFoundationObjC::updateAudioTracks()
 {
-#if !RELEASE_LOG_DISABLED
     size_t count = m_audioTracks.size();
-#endif
 
     Vector<String> characteristics = player()->preferredAudioCharacteristics();
     if (!m_audibleGroup) {
@@ -2033,16 +2028,12 @@ void MediaPlayerPrivateAVFoundationObjC::updateAudioTracks()
     for (auto& track : m_audioTracks)
         track->resetPropertiesFromTrack();
 
-#if !RELEASE_LOG_DISABLED
     ALWAYS_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_audioTracks.size());
-#endif
 }
 
 void MediaPlayerPrivateAVFoundationObjC::updateVideoTracks()
 {
-#if !RELEASE_LOG_DISABLED
     size_t count = m_videoTracks.size();
-#endif
 
     determineChangedTracksFromNewTracksAndOldItems(m_cachedTracks.get(), AVMediaTypeVideo, m_videoTracks, &VideoTrackPrivateAVFObjC::create, player(), &MediaPlayer::removeVideoTrack, &MediaPlayer::addVideoTrack);
 
@@ -2057,9 +2048,7 @@ void MediaPlayerPrivateAVFoundationObjC::updateVideoTracks()
     for (auto& track : m_audioTracks)
         track->resetPropertiesFromTrack();
 
-#if !RELEASE_LOG_DISABLED
     ALWAYS_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_videoTracks.size());
-#endif
 }
 
 bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const
@@ -2228,15 +2217,11 @@ void MediaPlayerPrivateAVFoundationObjC::updateLastImage(UpdateType type)
         m_pixelBufferConformer = makeUnique<PixelBufferConformerCV>((__bridge CFDictionaryRef)attributes);
     }
 
-#if !RELEASE_LOG_DISABLED
     MonotonicTime start = MonotonicTime::now();
-#endif
 
     m_lastImage = m_pixelBufferConformer->createImageFromPixelBuffer(m_lastPixelBuffer.get());
 
-#if !RELEASE_LOG_DISABLED
     INFO_LOG(LOGIDENTIFIER, "creating buffer took ", (MonotonicTime::now() - start).seconds());
-#endif
 #endif // HAVE(CORE_VIDEO)
 }
 
@@ -3450,7 +3435,6 @@ NSArray* playerKVOProperties()
 #endif
             }
 
-#if !RELEASE_LOG_DISABLED
             if (player->logger().willLog(player->logChannel(), WTFLogLevel::Debug) && !([keyPath isEqualToString:@"loadedTimeRanges"] || [keyPath isEqualToString:@"seekableTimeRanges"])) {
                 auto identifier = Logger::LogSiteIdentifier("MediaPlayerPrivateAVFoundation", "observeValueForKeyPath", player->logIdentifier());
 
@@ -3464,7 +3448,6 @@ NSArray* playerKVOProperties()
                 } else
                     player->logger().debug(player->logChannel(), identifier, willChange ? "will" : "did", " change '", [keyPath UTF8String], "'");
             }
-#endif
         });
     });
 }
index c7887b2..14ddfbf 100644 (file)
@@ -63,9 +63,7 @@ class WebCoreDecompressionSession;
 class MediaPlayerPrivateMediaSourceAVFObjC
     : public CanMakeWeakPtr<MediaPlayerPrivateMediaSourceAVFObjC>
     , public MediaPlayerPrivateInterface
-#if !RELEASE_LOG_DISABLED
     , private LoggerHelper
-#endif
 {
 public:
     explicit MediaPlayerPrivateMediaSourceAVFObjC(MediaPlayer*);
@@ -150,7 +148,6 @@ public:
     const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const;
     bool shouldCheckHardwareSupport() const;
 
-#if !RELEASE_LOG_DISABLED
     const Logger& logger() const final { return m_logger.get(); }
     const char* logClassName() const override { return "MediaPlayerPrivateMediaSourceAVFObjC"; }
     const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); }
@@ -158,7 +155,6 @@ public:
 
     const void* mediaPlayerLogIdentifier() { return logIdentifier(); }
     const Logger& mediaPlayerLogger() { return logger(); }
-#endif
 
     enum SeekState {
         Seeking,
@@ -327,14 +323,11 @@ private:
     RefPtr<MediaPlaybackTarget> m_playbackTarget;
     bool m_shouldPlayToTarget { false };
 #endif
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
     std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
 
     Ref<EffectiveRateChangedListener> m_effectiveRateChangedListener;
-
-#if !RELEASE_LOG_DISABLED
-    Ref<const Logger> m_logger;
-    const void* m_logIdentifier;
-#endif
 };
 
 String convertEnumerationToString(MediaPlayerPrivateMediaSourceAVFObjC::SeekState);
index 4e48f73..7029ff9 100644 (file)
@@ -137,12 +137,10 @@ MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC(Media
     , m_playing(0)
     , m_seeking(false)
     , m_loadingProgressed(false)
-    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())
-    , m_effectiveRateChangedListener(EffectiveRateChangedListener::create(*this, [m_synchronizer timebase]))
-#if !RELEASE_LOG_DISABLED
     , m_logger(player->mediaPlayerLogger())
     , m_logIdentifier(player->mediaPlayerLogIdentifier())
-#endif
+    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(m_logger, m_logIdentifier))
+    , m_effectiveRateChangedListener(EffectiveRateChangedListener::create(*this, [m_synchronizer timebase]))
 {
     auto logSiteIdentifier = LOGIDENTIFIER;
     ALWAYS_LOG(logSiteIdentifier);
@@ -1221,12 +1219,10 @@ bool MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime(WTF::Function<
     return true;
 }
 
-#if !RELEASE_LOG_DISABLED
 WTFLogChannel& MediaPlayerPrivateMediaSourceAVFObjC::logChannel() const
 {
     return LogMediaSource;
 }
-#endif
 
 }
 
index 5baec56..909eb49 100644 (file)
@@ -52,9 +52,7 @@ class VideoFullscreenLayerManagerObjC;
 class VideoTrackPrivateMediaStream;
 
 class MediaPlayerPrivateMediaStreamAVFObjC final : public MediaPlayerPrivateInterface, private MediaStreamPrivate::Observer, private MediaStreamTrackPrivate::Observer, public SampleBufferDisplayLayer::Client
-#if !RELEASE_LOG_DISABLED
     , private LoggerHelper
-#endif
 {
 public:
     explicit MediaPlayerPrivateMediaStreamAVFObjC(MediaPlayer*);
@@ -75,12 +73,10 @@ public:
     void ensureLayers();
     void destroyLayers();
 
-#if !RELEASE_LOG_DISABLED
     const Logger& logger() const final { return m_logger.get(); }
     const char* logClassName() const override { return "MediaPlayerPrivateMediaStreamAVFObjC"; }
     const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); }
     WTFLogChannel& logChannel() const final;
-#endif
 
     PlatformLayer* rootLayer() const;
     void rootLayerBoundsDidChange();
@@ -243,16 +239,14 @@ private:
     MediaSample::VideoRotation m_videoRotation { MediaSample::VideoRotation::None };
     CGAffineTransform m_videoTransform;
     std::unique_ptr<SampleBufferDisplayLayer> m_sampleBufferDisplayLayer;
+
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
     std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager;
 
     // SampleBufferDisplayLayer::Client
     void sampleBufferDisplayLayerStatusDidChange(SampleBufferDisplayLayer&) final;
 
-#if !RELEASE_LOG_DISABLED
-    Ref<const Logger> m_logger;
-    const void* m_logIdentifier;
-#endif
-
     RetainPtr<WebRootSampleBufferBoundsChangeListener> m_boundsChangeListener;
 
     bool m_videoMirrored { false };
index 5b513f6..0f57441 100644 (file)
@@ -144,11 +144,9 @@ static const double rendererLatency = 0.02;
 MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC(MediaPlayer* player)
     : m_player(player)
     , m_clock(PAL::Clock::create())
-    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>())
-#if !RELEASE_LOG_DISABLED
     , m_logger(player->mediaPlayerLogger())
     , m_logIdentifier(player->mediaPlayerLogIdentifier())
-#endif
+    , m_videoFullscreenLayerManager(makeUnique<VideoFullscreenLayerManagerObjC>(m_logger, m_logIdentifier))
     , m_boundsChangeListener(adoptNS([[WebRootSampleBufferBoundsChangeListener alloc] initWithParent:this]))
 {
     INFO_LOG(LOGIDENTIFIER);
@@ -1056,12 +1054,10 @@ void MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange()
     updateDisplayLayer();
 }
 
-#if !RELEASE_LOG_DISABLED
 WTFLogChannel& MediaPlayerPrivateMediaStreamAVFObjC::logChannel() const
 {
     return LogMedia;
 }
-#endif
 
 }
 
index df03f24..1ff8bb6 100644 (file)
@@ -31,6 +31,7 @@
 #include "VideoFullscreenLayerManager.h"
 #include "WebVideoContainerLayer.h"
 #include <wtf/Function.h>
+#include <wtf/LoggerHelper.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RetainPtr.h>
 
@@ -38,10 +39,10 @@ OBJC_CLASS AVPlayerLayer;
 
 namespace WebCore {
 
-class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager {
+class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager , public LoggerHelper {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    VideoFullscreenLayerManagerObjC();
+    VideoFullscreenLayerManagerObjC(const Logger&, const void*);
 
     PlatformLayer *videoInlineLayer() const final { return m_videoInlineLayer.get(); }
     PlatformLayer *videoFullscreenLayer() const final { return m_videoFullscreenLayer.get(); }
@@ -57,6 +58,14 @@ public:
     void syncTextTrackBounds() final;
 
 private:
+    const Logger& logger() const final { return m_logger.get(); }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+    const char* logClassName() const final { return "VideoFullscreenLayerManagerObjC"; }
+    WTFLogChannel& logChannel() const final;
+
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
+
     RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;
     RetainPtr<WebVideoContainerLayer> m_videoInlineLayer;
     RetainPtr<PlatformLayer> m_videoFullscreenLayer;
index 81a3bae..6a78df4 100644 (file)
@@ -27,6 +27,7 @@
 #import "VideoFullscreenLayerManagerObjC.h"
 
 #import "Color.h"
+#import "Logging.h"
 #import "TextTrackRepresentation.h"
 #import "WebCoreCALayerExtras.h"
 #import <mach/mach_init.h>
 
 namespace WebCore {
 
-VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC()
+VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC(const Logger& logger, const void* logIdentifier)
     : VideoFullscreenLayerManager()
+    , m_logger(logger)
+    , m_logIdentifier(logIdentifier)
 {
 }
 
 void VideoFullscreenLayerManagerObjC::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize)
 {
+    ALWAYS_LOG(LOGIDENTIFIER, contentSize.width(), ", ", contentSize.height());
+
     m_videoLayer = videoLayer;
     m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height());
 
@@ -81,6 +86,8 @@ void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *vid
         return;
     }
 
+    ALWAYS_LOG(LOGIDENTIFIER);
+
     m_videoFullscreenLayer = videoFullscreenLayer;
 
     [CATransaction begin];
@@ -121,6 +128,8 @@ void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *vid
 
 void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFullscreenFrame)
 {
+    ALWAYS_LOG(LOGIDENTIFIER, videoFullscreenFrame.x(), ", ", videoFullscreenFrame.y(), ", ", videoFullscreenFrame.width(), ", ", videoFullscreenFrame.height());
+
     m_videoFullscreenFrame = videoFullscreenFrame;
     if (!m_videoFullscreenLayer)
         return;
@@ -131,6 +140,8 @@ void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFul
 
 void VideoFullscreenLayerManagerObjC::didDestroyVideoLayer()
 {
+    ALWAYS_LOG(LOGIDENTIFIER);
+
     [m_videoLayer removeFromSuperlayer];
 
     m_videoInlineLayer = nil;
@@ -147,6 +158,9 @@ void VideoFullscreenLayerManagerObjC::syncTextTrackBounds()
     if (!m_videoFullscreenLayer || !m_textTrackRepresentationLayer)
         return;
 
+    if (m_textTrackRepresentationLayer.get().bounds == m_videoFullscreenFrame)
+        return;
+
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
@@ -157,6 +171,8 @@ void VideoFullscreenLayerManagerObjC::syncTextTrackBounds()
 
 void VideoFullscreenLayerManagerObjC::setTextTrackRepresentation(TextTrackRepresentation* representation)
 {
+    ALWAYS_LOG(LOGIDENTIFIER);
+
     PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil;
     if (representationLayer == m_textTrackRepresentationLayer) {
         syncTextTrackBounds();
@@ -180,5 +196,10 @@ void VideoFullscreenLayerManagerObjC::setTextTrackRepresentation(TextTrackRepres
 
 }
 
+WTFLogChannel& VideoFullscreenLayerManagerObjC::logChannel() const
+{
+    return LogMedia;
+}
+
 }
 
index 560102c..c92db2e 100644 (file)
 
 #if (PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))) && ENABLE(VIDEO_TRACK)
 
-#import "TextTrackRepresentation.h"
-#import <QuartzCore/CALayer.h>
-#import <wtf/RetainPtr.h>
+#include "GenericTaskQueue.h"
+#include "TextTrackRepresentation.h"
+#include <QuartzCore/CALayer.h>
+#include <wtf/RetainPtr.h>
 
 @class WebCoreTextTrackRepresentationCocoaHelper;
 
@@ -43,13 +44,17 @@ public:
 
     TextTrackRepresentationClient& client() const { return m_client; }
 
-    PlatformLayer* platformLayer() override { return m_layer.get(); }
-    IntRect bounds() const override;
+    PlatformLayer* platformLayer() final { return m_layer.get(); }
+
+    IntRect bounds() const final;
+    void boundsChanged();
 
 private:
-    void update() override;
-    void setContentScale(float) override;
+    void update() final;
+    void setContentScale(float) final;
+    void setHidden(bool) const final;
 
+    GenericTaskQueue<Timer> m_taskQueue;
     TextTrackRepresentationClient& m_client;
     RetainPtr<CALayer> m_layer;
     RetainPtr<WebCoreTextTrackRepresentationCocoaHelper> m_delegate;
index 2787468..d6dbf7d 100644 (file)
@@ -92,7 +92,7 @@ using namespace WebCore;
     });
 #else
     if (_parent && [keyPath isEqual:@"bounds"] && object == _parent->platformLayer())
-        _parent->client().textTrackRepresentationBoundsChanged(_parent->bounds());
+        _parent->boundsChanged();
 #endif
 }
 
@@ -137,9 +137,21 @@ void TextTrackRepresentationCocoa::setContentScale(float scale)
     [m_layer.get() setContentsScale:scale];
 }
 
+void TextTrackRepresentationCocoa::setHidden(bool hidden) const
+{
+    [m_layer.get() setHidden:hidden];
+}
+
 IntRect TextTrackRepresentationCocoa::bounds() const
 {
     return enclosingIntRect(FloatRect([m_layer.get() bounds]));
 }
 
+void TextTrackRepresentationCocoa::boundsChanged()
+{
+    m_taskQueue.enqueueTask([this] () {
+        client().textTrackRepresentationBoundsChanged(bounds());
+    });
+}
+
 #endif // (PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))) && ENABLE(VIDEO_TRACK)
index 53cd6cd..8a08755 100644 (file)
@@ -104,7 +104,7 @@ void RenderTextTrackContainerElement::layout()
     ASSERT(mediaControlElementType(element()) == MediaTextTrackDisplayContainer);
 
     LayoutStateDisabler layoutStateDisabler(view().frameView().layoutContext());
-    static_cast<MediaControlTextTrackContainerElement*>(element())->updateSizes();
+    static_cast<MediaControlTextTrackContainerElement*>(element())->layoutIfNecessary();
 }
 
 #endif // ENABLE(VIDEO_TRACK)