<!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>[171700] 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/171700">171700</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2014-07-28 14:58:18 -0700 (Mon, 28 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Mac, iOS] Paint-on closed captions get out-of-order in Safari
https://bugs.webkit.org/show_bug.cgi?id=135332
<rdar://problem/15317278>
Reviewed by Brent Fulgham.
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): If the
number of active cues is greater than the current set of CSS boxes representing
the cues, throw away the CSS boxes and re-layout all the cues.
* html/track/InbandGenericTextTrack.cpp:
(WebCore::InbandGenericTextTrack::addGenericCue): Add some logging.
(WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGeneric::isOrderedBefore): Revise ordering rules so that we put
newer cues earlier in the layout order so they are drawn towards the bottom
of the screen. Only do this for Generic captions.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Adjust logging
messages.
(WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Add logging.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowMediaControlElementscpp">trunk/Source/WebCore/html/shadow/MediaControlElements.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackInbandGenericTextTrackcpp">trunk/Source/WebCore/html/track/InbandGenericTextTrack.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTextTrackCueGenericcpp">trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationInbandTextTrackPrivateAVFcpp">trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (171699 => 171700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-28 21:55:57 UTC (rev 171699)
+++ trunk/Source/WebCore/ChangeLog        2014-07-28 21:58:18 UTC (rev 171700)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-07-27 Brent Fulgham <bfulgham@apple.com>
+
+ [Mac, iOS] Paint-on closed captions get out-of-order in Safari
+ https://bugs.webkit.org/show_bug.cgi?id=135332
+ <rdar://problem/15317278>
+
+ Reviewed by Brent Fulgham.
+
+ * html/shadow/MediaControlElements.cpp:
+ (WebCore::MediaControlTextTrackContainerElement::updateDisplay): If the
+ number of active cues is greater than the current set of CSS boxes representing
+ the cues, throw away the CSS boxes and re-layout all the cues.
+ * html/track/InbandGenericTextTrack.cpp:
+ (WebCore::InbandGenericTextTrack::addGenericCue): Add some logging.
+ (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
+ * html/track/TextTrackCueGeneric.cpp:
+ (WebCore::TextTrackCueGeneric::isOrderedBefore): Revise ordering rules so that we put
+ newer cues earlier in the layout order so they are drawn towards the bottom
+ of the screen. Only do this for Generic captions.
+ * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+ (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Adjust logging
+ messages.
+ (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Add logging.
+
</ins><span class="cx"> 2014-07-28 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r160806): CSS zoom property doesn't work on anything inside anchors.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowMediaControlElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (171699 => 171700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-07-28 21:55:57 UTC (rev 171699)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-07-28 21:58:18 UTC (rev 171700)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include "ImageBuffer.h"
</span><span class="cx"> #include "Language.h"
</span><span class="cx"> #include "LocalizedStrings.h"
</span><ins>+#include "Logging.h"
</ins><span class="cx"> #include "MediaControls.h"
</span><span class="cx"> #include "PageGroup.h"
</span><span class="cx"> #include "RenderLayer.h"
</span><span class="lines">@@ -1303,6 +1304,13 @@
</span><span class="cx"> // within the TextTrackCue instance itself. If parameters of the cue change,
</span><span class="cx"> // the display tree is cleared.
</span><span class="cx">
</span><ins>+ // If the number of CSS boxes in the output is less than the number of cues
+ // we wish to render (e.g., we are adding another cue in a set of roll-up
+ // cues), remove all the existing CSS boxes representing the cues and re-add
+ // them so that the new cue is at the bottom.
+ if (childNodeCount() < activeCues.size())
+ removeChildren();
+
</ins><span class="cx"> // 10. For each text track cue cue in cues that has not yet had
</span><span class="cx"> // corresponding CSS boxes added to output, in text track cue order, run the
</span><span class="cx"> // following substeps:
</span><span class="lines">@@ -1320,6 +1328,8 @@
</span><span class="cx"> if (!cue->track() || !cue->track()->isRendered() || !cue->isActive() || cue->text().isEmpty())
</span><span class="cx"> continue;
</span><span class="cx">
</span><ins>+ LOG(Media, "MediaControlTextTrackContainerElement::updateDisplay(%p) - adding and positioning cue #%zu: \"%s\", start=%.2f, end=%.2f, line=%.2f", this, i, cue->text().utf8().data(), cue->startTime(), cue->endTime(), cue->line());
+
</ins><span class="cx"> RefPtr<VTTCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size());
</span><span class="cx"> #if ENABLE(WEBVTT_REGIONS)
</span><span class="cx"> if (cue->track()->mode() == TextTrack::disabledKeyword())
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackInbandGenericTextTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/InbandGenericTextTrack.cpp (171699 => 171700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/InbandGenericTextTrack.cpp        2014-07-28 21:55:57 UTC (rev 171699)
+++ trunk/Source/WebCore/html/track/InbandGenericTextTrack.cpp        2014-07-28 21:58:18 UTC (rev 171700)
</span><span class="lines">@@ -160,6 +160,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ LOG(Media, "InbandGenericTextTrack::addGenericCue added cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
+
</ins><span class="cx"> if (cueData->status() != GenericCueData::Complete)
</span><span class="cx"> m_cueMap.add(cueData.get(), cue.get());
</span><span class="cx">
</span><span class="lines">@@ -184,8 +186,10 @@
</span><span class="cx"> if (cue) {
</span><span class="cx"> LOG(Media, "InbandGenericTextTrack::removeGenericCue removing cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
</span><span class="cx"> removeCue(cue.get(), IGNORE_EXCEPTION);
</span><del>- } else
</del><ins>+ } else {
+ LOG(Media, "InbandGenericTextTrack::removeGenericCue UNABLE to find cue: start=%.2f, end=%.2f, content=\"%s\"\n", cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
</ins><span class="cx"> m_cueMap.remove(cueData);
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void InbandGenericTextTrack::removeCue(TextTrackCue* cue, ExceptionCode& ec)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTextTrackCueGenericcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp (171699 => 171700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp        2014-07-28 21:55:57 UTC (rev 171699)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp        2014-07-28 21:58:18 UTC (rev 171700)
</span><span class="lines">@@ -202,9 +202,6 @@
</span><span class="cx">
</span><span class="cx"> bool TextTrackCueGeneric::isOrderedBefore(const TextTrackCue* that) const
</span><span class="cx"> {
</span><del>- if (VTTCue::isOrderedBefore(that))
- return true;
-
</del><span class="cx"> if (that->cueType() == Generic && startTime() == that->startTime() && endTime() == that->endTime()) {
</span><span class="cx"> // Further order generic cues by their calculated line value.
</span><span class="cx"> std::pair<double, double> thisPosition = getPositionCoordinates();
</span><span class="lines">@@ -212,7 +209,10 @@
</span><span class="cx"> return thisPosition.second > thatPosition.second || (thisPosition.second == thatPosition.second && thisPosition.first < thatPosition.first);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return false;
</del><ins>+ if (that->cueType() == Generic)
+ return startTime() > that->startTime();
+
+ return VTTCue::isOrderedBefore(that);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationInbandTextTrackPrivateAVFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp (171699 => 171700)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp        2014-07-28 21:55:57 UTC (rev 171699)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp        2014-07-28 21:58:18 UTC (rev 171700)
</span><span class="lines">@@ -475,7 +475,7 @@
</span><span class="cx"> if (!arrivingCue->doesExtendCueData(*cueData))
</span><span class="cx"> nonExtensionCues.append(arrivingCue);
</span><span class="cx"> else
</span><del>- LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - found an extension cue (\"%s\") for time = %.2f, position = %.2f, line = %.2f", this, arrivingCue->content().utf8().data(), arrivingCue->startTime(), arrivingCue->position(), arrivingCue->line());
</del><ins>+ LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - found an extension cue (\"%s\") for time = %.2f, end = %.2f, position = %.2f, line = %.2f", this, arrivingCue->content().utf8().data(), arrivingCue->startTime(), arrivingCue->endTime(), arrivingCue->position(), arrivingCue->line());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool currentCueIsExtended = (arrivingCues.size() != nonExtensionCues.size());
</span><span class="lines">@@ -489,7 +489,7 @@
</span><span class="cx"> cueData->setEndTime(m_currentCueEndTime);
</span><span class="cx"> cueData->setStatus(GenericCueData::Complete);
</span><span class="cx">
</span><del>- LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - updating cue: start=%.2f, end=%.2f, content=\"%s\"", this, cueData->startTime(), m_currentCueEndTime, cueData->content().utf8().data());
</del><ins>+ LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - updating cue \"%s\": start=%.2f, end=%.2f", this, cueData->content().utf8().data(), cueData->startTime(), m_currentCueEndTime);
</ins><span class="cx"> client()->updateGenericCue(this, cueData.get());
</span><span class="cx"> } else {
</span><span class="cx"> // We have to assume that the implicit duration is invalid for cues delivered during a seek because the AVF decode pipeline may not
</span><span class="lines">@@ -512,7 +512,7 @@
</span><span class="cx">
</span><span class="cx"> m_cues.append(cueData);
</span><span class="cx">
</span><del>- LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - adding cue for time = %.2f, position = %.2f, line = %.2f", this, cueData->startTime(), cueData->position(), cueData->line());
</del><ins>+ LOG(Media, "InbandTextTrackPrivateAVF::processCue(%p) - adding cue \"%s\" for time = %.2f, end = %.2f, position = %.2f, line = %.2f", this, cueData->content().utf8().data(), cueData->startTime(), cueData->endTime(), cueData->position(), cueData->line());
</ins><span class="cx">
</span><span class="cx"> client()->addGenericCue(this, cueData.release());
</span><span class="cx"> }
</span><span class="lines">@@ -543,6 +543,8 @@
</span><span class="cx"> if (m_cues[currentCue]->status() != GenericCueData::Complete)
</span><span class="cx"> continue;
</span><span class="cx">
</span><ins>+ LOG(Media, "InbandTextTrackPrivateAVF::removeCompletedCues(%p) - removing cue \"%s\": start=%.2f, end=%.2f", this, m_cues[currentCue]->content().utf8().data(), m_cues[currentCue]->startTime(), m_cues[currentCue]->endTime());
+
</ins><span class="cx"> m_cues.remove(currentCue);
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>