- Revision
- 172213
- Author
- [email protected]
- Date
- 2014-08-07 09:23:05 -0700 (Thu, 07 Aug 2014)
Log Message
[Mac, iOS] Captions are appearing multiple times during repeated video play through
https://bugs.webkit.org/show_bug.cgi?id=135680
Source/WebCore:
<rdar://problem/17926802>
Reviewed by Eric Carlson.
Test: media/track/track-in-band-cues-added-once.html
Revert TextTrackCueGeneric::isOrderedBefore logic to its original form, and add
a new 'isOrderedBeforeDuringDisplay' for the special case of displaying captions.
* html/shadow/MediaControlElements.cpp:
(WebCore::compareCueIntervalForDisplay): Added helper function.
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Use the new
'isOrderedBeforeDuringDisplay' to order the cues for display.
* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::isOrderedBeforeDuringDisplay): Added. This just
calls the existing 'isOrderedBefore' method.
* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGeneric::isOrderedBefore): Revert to logic used
prior to r171700.
(WebCore::TextTrackCueGeneric::isOrderedBeforeDuringDisplay): New method that
implements the behavior in r171700.
* html/track/TextTrackCueGeneric.h:
LayoutTests:
<rdar://problem/17926802>
Reviewed by Eric Carlson.
Reactivate the 'track-in-band-cues-added-once.html' test. We would have caught
this bug immediately if the test had been enabled.
* platform/mac/TestExpectations: Turn 'track-in-band-cues-added-once.html' back
on.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (172212 => 172213)
--- trunk/LayoutTests/ChangeLog 2014-08-07 16:06:06 UTC (rev 172212)
+++ trunk/LayoutTests/ChangeLog 2014-08-07 16:23:05 UTC (rev 172213)
@@ -1,3 +1,17 @@
+2014-08-06 Brent Fulgham <[email protected]>
+
+ [Mac, iOS] Captions are appearing multiple times during repeated video play through
+ https://bugs.webkit.org/show_bug.cgi?id=135680
+ <rdar://problem/17926802>
+
+ Reviewed by Eric Carlson.
+
+ Reactivate the 'track-in-band-cues-added-once.html' test. We would have caught
+ this bug immediately if the test had been enabled.
+
+ * platform/mac/TestExpectations: Turn 'track-in-band-cues-added-once.html' back
+ on.
+
2014-08-07 Michał Pakuła vel Rutka <[email protected]>
Unreviewed EFL gardening
Modified: trunk/LayoutTests/platform/mac/TestExpectations (172212 => 172213)
--- trunk/LayoutTests/platform/mac/TestExpectations 2014-08-07 16:06:06 UTC (rev 172212)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2014-08-07 16:23:05 UTC (rev 172213)
@@ -1195,8 +1195,6 @@
webkit.org/b/123490 [ Mavericks ] webaudio/oscillator-sawtooth.html [ Failure ]
-webkit.org/b/123498 [ Mavericks ] media/track/track-in-band-cues-added-once.html [ Failure ]
-
webkit.org/b/123522 [ Mavericks ] media/track/track-in-band-legacy-api.html [ Pass Failure ]
# Audio and video tracks aren't supported on mac
Modified: trunk/Source/WebCore/ChangeLog (172212 => 172213)
--- trunk/Source/WebCore/ChangeLog 2014-08-07 16:06:06 UTC (rev 172212)
+++ trunk/Source/WebCore/ChangeLog 2014-08-07 16:23:05 UTC (rev 172213)
@@ -1,3 +1,30 @@
+2014-08-06 Brent Fulgham <[email protected]>
+
+ [Mac, iOS] Captions are appearing multiple times during repeated video play through
+ https://bugs.webkit.org/show_bug.cgi?id=135680
+ <rdar://problem/17926802>
+
+ Reviewed by Eric Carlson.
+
+ Test: media/track/track-in-band-cues-added-once.html
+
+ Revert TextTrackCueGeneric::isOrderedBefore logic to its original form, and add
+ a new 'isOrderedBeforeDuringDisplay' for the special case of displaying captions.
+
+ * html/shadow/MediaControlElements.cpp:
+ (WebCore::compareCueIntervalForDisplay): Added helper function.
+ (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Use the new
+ 'isOrderedBeforeDuringDisplay' to order the cues for display.
+ * html/track/TextTrackCue.h:
+ (WebCore::TextTrackCue::isOrderedBeforeDuringDisplay): Added. This just
+ calls the existing 'isOrderedBefore' method.
+ * html/track/TextTrackCueGeneric.cpp:
+ (WebCore::TextTrackCueGeneric::isOrderedBefore): Revert to logic used
+ prior to r171700.
+ (WebCore::TextTrackCueGeneric::isOrderedBeforeDuringDisplay): New method that
+ implements the behavior in r171700.
+ * html/track/TextTrackCueGeneric.h:
+
2014-08-07 Jer Noble <[email protected]>
[Mac] Taking a paused video full screen flashes black at beginning of animation.
Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (172212 => 172213)
--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2014-08-07 16:06:06 UTC (rev 172212)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2014-08-07 16:23:05 UTC (rev 172213)
@@ -1096,6 +1096,11 @@
return createRenderer<RenderTextTrackContainerElement>(*this, WTF::move(style));
}
+static bool compareCueIntervalForDisplay(const CueInterval& one, const CueInterval& two)
+{
+ return one.data()->isPositionedAbove(two.data());
+};
+
void MediaControlTextTrackContainerElement::updateDisplay()
{
if (!mediaController()->closedCaptionsVisible())
@@ -1149,7 +1154,12 @@
// them so that the new cue is at the bottom.
if (childNodeCount() < activeCues.size())
removeChildren();
-
+
+ // Sort the active cues for the appropriate display order. For example, for roll-up
+ // or paint-on captions, we need to add the cues in reverse chronological order,
+ // so that the newest captions appear at the bottom.
+ std::sort(activeCues.begin(), activeCues.end(), &compareCueIntervalForDisplay);
+
// 10. For each text track cue cue in cues that has not yet had
// corresponding CSS boxes added to output, in text track cue order, run the
// following substeps:
Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (172212 => 172213)
--- trunk/Source/WebCore/html/track/TextTrackCue.h 2014-08-07 16:06:06 UTC (rev 172212)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h 2014-08-07 16:23:05 UTC (rev 172213)
@@ -82,6 +82,7 @@
virtual ScriptExecutionContext* scriptExecutionContext() const override final { return &m_scriptExecutionContext; }
virtual bool isOrderedBefore(const TextTrackCue*) const;
+ virtual bool isPositionedAbove(const TextTrackCue* cue) const { return isOrderedBefore(cue); }
bool hasEquivalentStartTime(const TextTrackCue&) const;
Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp (172212 => 172213)
--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2014-08-07 16:06:06 UTC (rev 172212)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp 2014-08-07 16:23:05 UTC (rev 172213)
@@ -202,6 +202,9 @@
bool TextTrackCueGeneric::isOrderedBefore(const TextTrackCue* that) const
{
+ if (VTTCue::isOrderedBefore(that))
+ return true;
+
if (that->cueType() == Generic && startTime() == that->startTime() && endTime() == that->endTime()) {
// Further order generic cues by their calculated line value.
std::pair<double, double> thisPosition = getPositionCoordinates();
@@ -209,6 +212,18 @@
return thisPosition.second > thatPosition.second || (thisPosition.second == thatPosition.second && thisPosition.first < thatPosition.first);
}
+ return false;
+}
+
+bool TextTrackCueGeneric::isPositionedAbove(const TextTrackCue* that) const
+{
+ if (that->cueType() == Generic && startTime() == that->startTime() && endTime() == that->endTime()) {
+ // Further order generic cues by their calculated line value.
+ std::pair<double, double> thisPosition = getPositionCoordinates();
+ std::pair<double, double> thatPosition = toVTTCue(that)->getPositionCoordinates();
+ return thisPosition.second > thatPosition.second || (thisPosition.second == thatPosition.second && thisPosition.first < thatPosition.first);
+ }
+
if (that->cueType() == Generic)
return startTime() > that->startTime();
Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.h (172212 => 172213)
--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.h 2014-08-07 16:06:06 UTC (rev 172212)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.h 2014-08-07 16:23:05 UTC (rev 172213)
@@ -80,6 +80,7 @@
private:
virtual bool isOrderedBefore(const TextTrackCue*) const override;
+ virtual bool isPositionedAbove(const TextTrackCue*) const override;
TextTrackCueGeneric(ScriptExecutionContext&, double start, double end, const String&);