<!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>[168793] branches/safari-538.34-branch/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/168793">168793</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2014-05-13 23:39:49 -0700 (Tue, 13 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/168519">r168519</a>.  </pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari53834branchSourceWebCoreChangeLog">branches/safari-538.34-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari53834branchSourceWebCorehtmltrackTextTrackcpp">branches/safari-538.34-branch/Source/WebCore/html/track/TextTrack.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorehtmltrackTextTrackCuecpp">branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorehtmltrackTextTrackCueh">branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorehtmltrackTextTrackCueGenericcpp">branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorehtmltrackTextTrackCueGenerich">branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari53834branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/ChangeLog (168792 => 168793)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/ChangeLog        2014-05-14 06:35:35 UTC (rev 168792)
+++ branches/safari-538.34-branch/Source/WebCore/ChangeLog        2014-05-14 06:39:49 UTC (rev 168793)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2014-04-17  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r168519
+
+    2014-05-08  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+            Multiple (stacked) cues when shuttling through video while playing closed captions
+            https://bugs.webkit.org/show_bug.cgi?id=132715
+            &lt;rdar://problem/16795782&gt;
+
+            Reviewed by Eric Carlson.
+
+            Tests: media/track/track-in-band-cues-added-once.html
+
+            * html/track/TextTrack.cpp:
+            (WebCore::TextTrack::hasCue): Revise to use a relaxed time equality.
+            * html/track/TextTrackCue.cpp:
+            (WebCore::TextTrackCue::isEqual): Ditto.
+            (WebCore::TextTrackCue::hasEquivalentStartTime): Added.
+            * html/track/TextTrackCue.h:
+            (WebCore::TextTrackCue::startTimeVariance): Added.
+            * html/track/TextTrackCueGeneric.h:
+            * html/track/TextTrackCueGeneric.cpp:
+            (WebCore::TextTrackCueGeneric::isEqual): Do not call the VTTCue::isEqual method from
+            this class, since cueType() will not equal VTTCue, and the equality will fail.
+
+2014-04-17  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
</ins><span class="cx">         Merge r168514
</span><span class="cx"> 
</span><span class="cx">     2014-05-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorehtmltrackTextTrackcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrack.cpp (168792 => 168793)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/html/track/TextTrack.cpp        2014-05-14 06:35:35 UTC (rev 168792)
+++ branches/safari-538.34-branch/Source/WebCore/html/track/TextTrack.cpp        2014-05-14 06:39:49 UTC (rev 168793)
</span><span class="lines">@@ -507,7 +507,7 @@
</span><span class="cx"> 
</span><span class="cx">             // If there is more than one cue with the same start time, back up to first one so we
</span><span class="cx">             // consider all of them.
</span><del>-            while (searchStart &gt;= 2 &amp;&amp; cue-&gt;startTime() == m_cues-&gt;item(searchStart - 2)-&gt;startTime())
</del><ins>+            while (searchStart &gt;= 2 &amp;&amp; cue-&gt;hasEquivalentStartTime(*m_cues-&gt;item(searchStart - 2)))
</ins><span class="cx">                 --searchStart;
</span><span class="cx">             
</span><span class="cx">             bool firstCompare = true;
</span><span class="lines">@@ -519,7 +519,7 @@
</span><span class="cx">                     return false;
</span><span class="cx"> 
</span><span class="cx">                 existingCue = m_cues-&gt;item(searchStart - 1);
</span><del>-                if (!existingCue || cue-&gt;startTime() &gt; existingCue-&gt;startTime())
</del><ins>+                if (!existingCue || cue-&gt;startTime() &gt; (existingCue-&gt;startTime() + existingCue-&gt;startTimeVariance()))
</ins><span class="cx">                     return false;
</span><span class="cx"> 
</span><span class="cx">                 if (!existingCue-&gt;isEqual(*cue, match))
</span><span class="lines">@@ -531,7 +531,7 @@
</span><span class="cx">         
</span><span class="cx">         size_t index = (searchStart + searchEnd) / 2;
</span><span class="cx">         existingCue = m_cues-&gt;item(index);
</span><del>-        if (cue-&gt;startTime() &lt; existingCue-&gt;startTime() || (match != TextTrackCue::IgnoreDuration &amp;&amp; cue-&gt;startTime() == existingCue-&gt;startTime() &amp;&amp; cue-&gt;endTime() &gt; existingCue-&gt;endTime()))
</del><ins>+        if ((cue-&gt;startTime() + existingCue-&gt;startTimeVariance()) &lt; existingCue-&gt;startTime() || (match != TextTrackCue::IgnoreDuration &amp;&amp; cue-&gt;hasEquivalentStartTime(*existingCue) &amp;&amp; cue-&gt;endTime() &gt; existingCue-&gt;endTime()))
</ins><span class="cx">             searchEnd = index;
</span><span class="cx">         else
</span><span class="cx">             searchStart = index + 1;
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorehtmltrackTextTrackCuecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.cpp (168792 => 168793)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.cpp        2014-05-14 06:35:35 UTC (rev 168792)
+++ branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.cpp        2014-05-14 06:39:49 UTC (rev 168793)
</span><span class="lines">@@ -209,7 +209,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (match != IgnoreDuration &amp;&amp; endTime() != cue.endTime())
</span><span class="cx">         return false;
</span><del>-    if (startTime() != cue.startTime())
</del><ins>+    if (!hasEquivalentStartTime(cue))
</ins><span class="cx">         return false;
</span><span class="cx">     if (id() != cue.id())
</span><span class="cx">         return false;
</span><span class="lines">@@ -217,6 +217,11 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool TextTrackCue::hasEquivalentStartTime(const TextTrackCue&amp; cue) const
+{
+    return std::abs(std::abs(startTime()) - std::abs(cue.startTime())) &lt; startTimeVariance();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorehtmltrackTextTrackCueh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.h (168792 => 168793)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.h        2014-05-14 06:35:35 UTC (rev 168792)
+++ branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.h        2014-05-14 06:39:49 UTC (rev 168793)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Google Inc.  All rights reserved.
</span><del>- * Copyright (C) 2012, 2013 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2013, 2014 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -83,6 +83,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isOrderedBefore(const TextTrackCue*) const;
</span><span class="cx"> 
</span><ins>+    bool hasEquivalentStartTime(const TextTrackCue&amp;) const;
+    virtual double startTimeVariance() const { return 0; }
+
</ins><span class="cx">     enum CueType {
</span><span class="cx">         Data,
</span><span class="cx">         Generic,
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorehtmltrackTextTrackCueGenericcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp (168792 => 168793)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp        2014-05-14 06:35:35 UTC (rev 168792)
+++ branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp        2014-05-14 06:39:49 UTC (rev 168793)
</span><span class="lines">@@ -153,6 +153,8 @@
</span><span class="cx">     
</span><span class="cx"> bool TextTrackCueGeneric::isEqual(const TextTrackCue&amp; cue, TextTrackCue::CueMatchRules match) const
</span><span class="cx"> {
</span><ins>+    // Do not call the parent class isEqual here, because we are not cueType() == VTTCue,
+    // and will fail that equality test.
</ins><span class="cx">     if (!TextTrackCue::isEqual(cue, match))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -172,7 +174,7 @@
</span><span class="cx">     if (m_backgroundColor != other-&gt;backgroundColor())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return VTTCue::isEqual(cue, match);
</del><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool TextTrackCueGeneric::isOrderedBefore(const TextTrackCue* that) const
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorehtmltrackTextTrackCueGenerich"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.h (168792 => 168793)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.h        2014-05-14 06:35:35 UTC (rev 168792)
+++ branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.h        2014-05-14 06:39:49 UTC (rev 168793)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual bool isOrderedBefore(const TextTrackCue*) const override;
</span><ins>+    virtual double startTimeVariance() const override { return 0.25; }
</ins><span class="cx"> 
</span><span class="cx">     TextTrackCueGeneric(ScriptExecutionContext&amp;, double start, double end, const String&amp;);
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>