<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170920] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170920">170920</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2014-07-09 10:17:16 -0700 (Wed, 09 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] caption size is sometimes incorrect in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=134740

Reviewed by Jer Noble.

Captions on iOS are displayed in fullscreen with a TextTrackRepresentation object. Because
the fullscreen video presentation is controlled by code in the UI process running on the
UI thread, WebCore is notified of changes to fullscreen state asynchronously. This resulted
in the TextTrackRepresentation object being created and/or destroyed too late some of the 
time, which caused us to sometimes display captions incorrectly. Fix this by setting up and
tearing down the TextTrackRepresentation object when WebCore's 'webkitfullscreenchange'
event fires.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::enteredFullscreen): Notify text track container.
(WebCore::MediaControlsHost::exitedFullscreen): Ditto.
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.handleFullscreenChange): Notify host of fullscreen change.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::requiresTextTrackRepresentation): Only return true when in
    fullscreen.
(WebCore::HTMLMediaElement::setVideoFullscreenLayer): Call updateTextTrackDisplay.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): Initialize
    m_updateTextTrackRepresentationStyle to false.
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Move logic for creating
    TextTrackRepresentation to updateTextTrackRepresentation.
(WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize): New, split out of updateTimerFired.
(WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Move code to force immediate
    font size change to updateActiveCuesFontSize.
(WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): New, update
    text track representation, creating first if necessary.
(WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): Add an early
    return if we don't have a text track representation.
(WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Early
    return if there is nothing to be done.
(WebCore::MediaControlTextTrackContainerElement::enteredFullscreen): Force a caption update
    if there are visible captions.
(WebCore::MediaControlTextTrackContainerElement::updateSizes): Set m_updateTextTrackRepresentationStyle
    to true.
(WebCore::MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged):  Force a 
    caption update if there are visible captions.
* html/shadow/MediaControlElements.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl">trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowMediaControlElementscpp">trunk/Source/WebCore/html/shadow/MediaControlElements.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowMediaControlElementsh">trunk/Source/WebCore/html/shadow/MediaControlElements.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/ChangeLog        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2014-07-09  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        [iOS] caption size is sometimes incorrect in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=134740
+
+        Reviewed by Jer Noble.
+
+        Captions on iOS are displayed in fullscreen with a TextTrackRepresentation object. Because
+        the fullscreen video presentation is controlled by code in the UI process running on the
+        UI thread, WebCore is notified of changes to fullscreen state asynchronously. This resulted
+        in the TextTrackRepresentation object being created and/or destroyed too late some of the 
+        time, which caused us to sometimes display captions incorrectly. Fix this by setting up and
+        tearing down the TextTrackRepresentation object when WebCore's 'webkitfullscreenchange'
+        event fires.
+
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::enteredFullscreen): Notify text track container.
+        (WebCore::MediaControlsHost::exitedFullscreen): Ditto.
+        * Modules/mediacontrols/MediaControlsHost.h:
+        * Modules/mediacontrols/MediaControlsHost.idl:
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.handleFullscreenChange): Notify host of fullscreen change.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::requiresTextTrackRepresentation): Only return true when in
+            fullscreen.
+        (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Call updateTextTrackDisplay.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): Initialize
+            m_updateTextTrackRepresentationStyle to false.
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Move logic for creating
+            TextTrackRepresentation to updateTextTrackRepresentation.
+        (WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize): New, split out of updateTimerFired.
+        (WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Move code to force immediate
+            font size change to updateActiveCuesFontSize.
+        (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): New, update
+            text track representation, creating first if necessary.
+        (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation): Add an early
+            return if we don't have a text track representation.
+        (WebCore::MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation): Early
+            return if there is nothing to be done.
+        (WebCore::MediaControlTextTrackContainerElement::enteredFullscreen): Force a caption update
+            if there are visible captions.
+        (WebCore::MediaControlTextTrackContainerElement::updateSizes): Set m_updateTextTrackRepresentationStyle
+            to true.
+        (WebCore::MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged):  Force a 
+            caption update if there are visible captions.
+        * html/shadow/MediaControlElements.h:
+
</ins><span class="cx"> 2014-07-09  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [MSE] http/tests/media/media-source/mediasource-endofstream-invaliderror.html is failing.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -150,6 +150,18 @@
</span><span class="cx">         m_textTrackContainer-&gt;updateDisplay();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MediaControlsHost::enteredFullscreen()
+{
+    if (m_textTrackContainer)
+        m_textTrackContainer-&gt;enteredFullscreen();
+}
+
+void MediaControlsHost::exitedFullscreen()
+{
+    if (m_textTrackContainer)
+        m_textTrackContainer-&gt;exitedFullscreen();
+}
+
</ins><span class="cx"> void MediaControlsHost::updateCaptionDisplaySizes()
</span><span class="cx"> {
</span><span class="cx">     if (m_textTrackContainer)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.h        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx">     bool userGestureRequired() const;
</span><span class="cx"> 
</span><span class="cx">     void updateCaptionDisplaySizes();
</span><ins>+    void enteredFullscreen();
+    void exitedFullscreen();
</ins><span class="cx"> 
</span><span class="cx">     String externalDeviceDisplayName() const;
</span><span class="cx">     String externalDeviceType() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsMediaControlsHostidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx">     readonly attribute DOMString captionDisplayMode;
</span><span class="cx">     void setSelectedTextTrack(TextTrack track);
</span><span class="cx">     readonly attribute HTMLElement textTrackContainer;
</span><del>-    void updateTextTrackContainer();
</del><span class="cx">     readonly attribute boolean mediaPlaybackAllowsInline;
</span><span class="cx">     readonly attribute boolean supportsFullscreen;
</span><span class="cx">     readonly attribute boolean userGestureRequired;
</span><span class="lines">@@ -50,4 +49,8 @@
</span><span class="cx">     readonly attribute DeviceType externalDeviceType;
</span><span class="cx"> 
</span><span class="cx">     attribute boolean controlsDependOnPageScaleFactor;
</span><ins>+    
+    void updateTextTrackContainer();
+    void enteredFullscreen();
+    void exitedFullscreen();
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -624,9 +624,11 @@
</span><span class="cx">         if (this.isFullScreen()) {
</span><span class="cx">             this.controls.fullscreenButton.classList.add(this.ClassNames.exit);
</span><span class="cx">             this.controls.fullscreenButton.setAttribute('aria-label', this.UIString('Exit Full Screen'));
</span><ins>+            this.host.enteredFullscreen();
</ins><span class="cx">         } else {
</span><span class="cx">             this.controls.fullscreenButton.classList.remove(this.ClassNames.exit);
</span><span class="cx">             this.controls.fullscreenButton.setAttribute('aria-label', this.UIString('Display Full Screen'));
</span><ins>+            this.host.exitedFullscreen();
</ins><span class="cx">         }
</span><span class="cx">     },
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -4773,7 +4773,7 @@
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> bool HTMLMediaElement::requiresTextTrackRepresentation() const
</span><span class="cx"> {
</span><del>-    return m_player ? m_player-&gt;requiresTextTrackRepresentation() : 0;
</del><ins>+    return m_isFullscreen &amp;&amp; m_player ? m_player-&gt;requiresTextTrackRepresentation() : false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::setTextTrackRepresentation(TextTrackRepresentation* representation)
</span><span class="lines">@@ -4961,6 +4961,10 @@
</span><span class="cx">     
</span><span class="cx">     m_player-&gt;setVideoFullscreenLayer(platformLayer);
</span><span class="cx">     setNeedsStyleRecalc(SyntheticStyleChange);
</span><ins>+#if ENABLE(VIDEO_TRACK)
+    if (RuntimeEnabledFeatures::sharedFeatures().webkitVideoTrackEnabled())
+        updateTextTrackDisplay();
+#endif
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> void HTMLMediaElement::setVideoFullscreenFrame(FloatRect frame)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowMediaControlElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -1228,6 +1228,7 @@
</span><span class="cx">     , m_updateTimer(this, &amp;MediaControlTextTrackContainerElement::updateTimerFired)
</span><span class="cx">     , m_fontSize(0)
</span><span class="cx">     , m_fontSizeIsImportant(false)
</span><ins>+    , m_updateTextTrackRepresentationStyle(false)
</ins><span class="cx"> {
</span><span class="cx">     setPseudo(shadowPseudoId());
</span><span class="cx"> }
</span><span class="lines">@@ -1353,28 +1354,18 @@
</span><span class="cx">     // 11. Return output.
</span><span class="cx">     if (hasChildNodes()) {
</span><span class="cx">         show();
</span><del>-        if (mediaElement-&gt;requiresTextTrackRepresentation()) {
-            if (!m_textTrackRepresentation)
-                m_textTrackRepresentation = TextTrackRepresentation::create(this);
-            mediaElement-&gt;setTextTrackRepresentation(m_textTrackRepresentation.get());
-
-            m_textTrackRepresentation-&gt;update();
-            updateStyleForTextTrackRepresentation();
-        }
</del><ins>+        updateTextTrackRepresentation();
</ins><span class="cx">     } else {
</span><span class="cx">         hide();
</span><span class="cx">         clearTextTrackRepresentation();
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaControlTextTrackContainerElement::updateTimerFired(Timer&lt;MediaControlTextTrackContainerElement&gt;&amp;)
</del><ins>+void MediaControlTextTrackContainerElement::updateActiveCuesFontSize()
</ins><span class="cx"> {
</span><span class="cx">     if (!document().page())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (m_textTrackRepresentation)
-        updateStyleForTextTrackRepresentation();
-
</del><span class="cx">     HTMLMediaElement* mediaElement = parentMediaElement(this);
</span><span class="cx">     if (!mediaElement)
</span><span class="cx">         return;
</span><span class="lines">@@ -1391,36 +1382,79 @@
</span><span class="cx"> 
</span><span class="cx">         toVTTCue(cue)-&gt;setFontSize(m_fontSize, m_videoDisplaySize.size(), m_fontSizeIsImportant);
</span><span class="cx">     }
</span><ins>+
+}
+
+void MediaControlTextTrackContainerElement::updateTimerFired(Timer&lt;MediaControlTextTrackContainerElement&gt;&amp;)
+{
+    if (!document().page())
+        return;
+
+    if (m_textTrackRepresentation)
+        updateStyleForTextTrackRepresentation();
+
+    updateActiveCuesFontSize();
</ins><span class="cx">     updateDisplay();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MediaControlTextTrackContainerElement::updateTextTrackRepresentation()
+{
+    HTMLMediaElement* mediaElement = parentMediaElement(this);
+    if (!mediaElement)
+        return;
+
+    if (!mediaElement-&gt;requiresTextTrackRepresentation())
+        return;
+
+    if (!m_textTrackRepresentation) {
+        m_textTrackRepresentation = TextTrackRepresentation::create(this);
+        m_updateTextTrackRepresentationStyle = true;
+        mediaElement-&gt;setTextTrackRepresentation(m_textTrackRepresentation.get());
+    }
+
+    m_textTrackRepresentation-&gt;update();
+    updateStyleForTextTrackRepresentation();
+}
+
</ins><span class="cx"> void MediaControlTextTrackContainerElement::clearTextTrackRepresentation()
</span><span class="cx"> {
</span><ins>+    if (!m_textTrackRepresentation)
+        return;
+
+    m_textTrackRepresentation = nullptr;
+    m_updateTextTrackRepresentationStyle = true;
</ins><span class="cx">     if (HTMLMediaElement* mediaElement = parentMediaElement(this))
</span><span class="cx">         mediaElement-&gt;setTextTrackRepresentation(nullptr);
</span><del>-    m_textTrackRepresentation = nullptr;
</del><span class="cx">     updateStyleForTextTrackRepresentation();
</span><ins>+    updateActiveCuesFontSize();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaControlTextTrackContainerElement::updateStyleForTextTrackRepresentation()
</span><span class="cx"> {
</span><ins>+    if (!m_updateTextTrackRepresentationStyle)
+        return;
+    m_updateTextTrackRepresentationStyle = false;
+
</ins><span class="cx">     if (m_textTrackRepresentation) {
</span><span class="cx">         setInlineStyleProperty(CSSPropertyWidth, m_videoDisplaySize.size().width(), CSSPrimitiveValue::CSS_PX);
</span><span class="cx">         setInlineStyleProperty(CSSPropertyHeight, m_videoDisplaySize.size().height(), CSSPrimitiveValue::CSS_PX);
</span><span class="cx">         setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
</span><span class="cx">         setInlineStyleProperty(CSSPropertyLeft, 0, CSSPrimitiveValue::CSS_PX);
</span><span class="cx">         setInlineStyleProperty(CSSPropertyTop, 0, CSSPrimitiveValue::CSS_PX);
</span><del>-    } else {
-        removeInlineStyleProperty(CSSPropertyPosition);
-        removeInlineStyleProperty(CSSPropertyWidth);
-        removeInlineStyleProperty(CSSPropertyHeight);
-        removeInlineStyleProperty(CSSPropertyLeft);
-        removeInlineStyleProperty(CSSPropertyTop);
</del><ins>+        return;
</ins><span class="cx">     }
</span><ins>+
+    removeInlineStyleProperty(CSSPropertyPosition);
+    removeInlineStyleProperty(CSSPropertyWidth);
+    removeInlineStyleProperty(CSSPropertyHeight);
+    removeInlineStyleProperty(CSSPropertyLeft);
+    removeInlineStyleProperty(CSSPropertyTop);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaControlTextTrackContainerElement::enteredFullscreen()
</span><span class="cx"> {
</span><ins>+    if (hasChildNodes())
+        updateTextTrackRepresentation();
</ins><span class="cx">     updateSizes(true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1442,7 +1476,6 @@
</span><span class="cx">     mediaElement-&gt;syncTextTrackBounds();
</span><span class="cx"> 
</span><span class="cx">     IntRect videoBox;
</span><del>-
</del><span class="cx">     if (m_textTrackRepresentation)
</span><span class="cx">         videoBox = m_textTrackRepresentation-&gt;bounds();
</span><span class="cx">     else {
</span><span class="lines">@@ -1453,7 +1486,9 @@
</span><span class="cx"> 
</span><span class="cx">     if (!forceUpdate &amp;&amp; m_videoDisplaySize == videoBox)
</span><span class="cx">         return;
</span><ins>+
</ins><span class="cx">     m_videoDisplaySize = videoBox;
</span><ins>+    m_updateTextTrackRepresentationStyle = true;
</ins><span class="cx"> 
</span><span class="cx">     // FIXME (121170): This function is called during layout, and should lay out the text tracks immediately.
</span><span class="cx">     m_updateTimer.startOneShot(0);
</span><span class="lines">@@ -1496,6 +1531,8 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged(const IntRect&amp;)
</span><span class="cx"> {
</span><ins>+    if (hasChildNodes())
+        updateTextTrackRepresentation();
</ins><span class="cx">     updateSizes();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowMediaControlElementsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.h (170919 => 170920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/MediaControlElements.h        2014-07-09 17:12:39 UTC (rev 170919)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.h        2014-07-09 17:17:16 UTC (rev 170920)
</span><span class="lines">@@ -478,6 +478,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void updateTimerFired(Timer&lt;MediaControlTextTrackContainerElement&gt;&amp;);
</span><ins>+    void updateActiveCuesFontSize();
</ins><span class="cx"> 
</span><span class="cx">     explicit MediaControlTextTrackContainerElement(Document&amp;);
</span><span class="cx">     virtual const AtomicString&amp; shadowPseudoId() const override;
</span><span class="lines">@@ -486,6 +487,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual PassRefPtr&lt;Image&gt; createTextTrackRepresentationImage() override;
</span><span class="cx">     virtual void textTrackRepresentationBoundsChanged(const IntRect&amp;) override;
</span><ins>+    void updateTextTrackRepresentation();
</ins><span class="cx">     void clearTextTrackRepresentation();
</span><span class="cx">     void updateStyleForTextTrackRepresentation();
</span><span class="cx">     OwnPtr&lt;TextTrackRepresentation&gt; m_textTrackRepresentation;
</span><span class="lines">@@ -494,6 +496,7 @@
</span><span class="cx">     IntRect m_videoDisplaySize;
</span><span class="cx">     int m_fontSize;
</span><span class="cx">     bool m_fontSizeIsImportant;
</span><ins>+    bool m_updateTextTrackRepresentationStyle;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>