Diff
Modified: branches/safari-538.34-branch/Source/WebCore/ChangeLog (168792 => 168793)
--- 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)
@@ -1,5 +1,31 @@
2014-04-17 Lucas Forschler <[email protected]>
+ Merge r168519
+
+ 2014-05-08 Brent Fulgham <[email protected]>
+
+ Multiple (stacked) cues when shuttling through video while playing closed captions
+ https://bugs.webkit.org/show_bug.cgi?id=132715
+ <rdar://problem/16795782>
+
+ 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 <[email protected]>
+
Merge r168514
2014-05-08 Simon Fraser <[email protected]>
Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrack.cpp (168792 => 168793)
--- 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)
@@ -507,7 +507,7 @@
// If there is more than one cue with the same start time, back up to first one so we
// consider all of them.
- while (searchStart >= 2 && cue->startTime() == m_cues->item(searchStart - 2)->startTime())
+ while (searchStart >= 2 && cue->hasEquivalentStartTime(*m_cues->item(searchStart - 2)))
--searchStart;
bool firstCompare = true;
@@ -519,7 +519,7 @@
return false;
existingCue = m_cues->item(searchStart - 1);
- if (!existingCue || cue->startTime() > existingCue->startTime())
+ if (!existingCue || cue->startTime() > (existingCue->startTime() + existingCue->startTimeVariance()))
return false;
if (!existingCue->isEqual(*cue, match))
@@ -531,7 +531,7 @@
size_t index = (searchStart + searchEnd) / 2;
existingCue = m_cues->item(index);
- if (cue->startTime() < existingCue->startTime() || (match != TextTrackCue::IgnoreDuration && cue->startTime() == existingCue->startTime() && cue->endTime() > existingCue->endTime()))
+ if ((cue->startTime() + existingCue->startTimeVariance()) < existingCue->startTime() || (match != TextTrackCue::IgnoreDuration && cue->hasEquivalentStartTime(*existingCue) && cue->endTime() > existingCue->endTime()))
searchEnd = index;
else
searchStart = index + 1;
Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.cpp (168792 => 168793)
--- 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)
@@ -209,7 +209,7 @@
if (match != IgnoreDuration && endTime() != cue.endTime())
return false;
- if (startTime() != cue.startTime())
+ if (!hasEquivalentStartTime(cue))
return false;
if (id() != cue.id())
return false;
@@ -217,6 +217,11 @@
return true;
}
+bool TextTrackCue::hasEquivalentStartTime(const TextTrackCue& cue) const
+{
+ return std::abs(std::abs(startTime()) - std::abs(cue.startTime())) < startTimeVariance();
+}
+
} // namespace WebCore
#endif
Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCue.h (168792 => 168793)
--- 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)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -83,6 +83,9 @@
virtual bool isOrderedBefore(const TextTrackCue*) const;
+ bool hasEquivalentStartTime(const TextTrackCue&) const;
+ virtual double startTimeVariance() const { return 0; }
+
enum CueType {
Data,
Generic,
Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.cpp (168792 => 168793)
--- 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)
@@ -153,6 +153,8 @@
bool TextTrackCueGeneric::isEqual(const TextTrackCue& cue, TextTrackCue::CueMatchRules match) const
{
+ // Do not call the parent class isEqual here, because we are not cueType() == VTTCue,
+ // and will fail that equality test.
if (!TextTrackCue::isEqual(cue, match))
return false;
@@ -172,7 +174,7 @@
if (m_backgroundColor != other->backgroundColor())
return false;
- return VTTCue::isEqual(cue, match);
+ return true;
}
bool TextTrackCueGeneric::isOrderedBefore(const TextTrackCue* that) const
Modified: branches/safari-538.34-branch/Source/WebCore/html/track/TextTrackCueGeneric.h (168792 => 168793)
--- 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)
@@ -78,6 +78,7 @@
private:
virtual bool isOrderedBefore(const TextTrackCue*) const override;
+ virtual double startTimeVariance() const override { return 0.25; }
TextTrackCueGeneric(ScriptExecutionContext&, double start, double end, const String&);