Title: [244014] releases/WebKitGTK/webkit-2.24/Source/WebCore
Revision
244014
Author
carlo...@webkit.org
Date
2019-04-08 05:39:43 -0700 (Mon, 08 Apr 2019)

Log Message

Merge r243341 - Inband Text Track cues interspersed with Data cues can display out of order.
https://bugs.webkit.org/show_bug.cgi?id=196095

Reviewed by Eric Carlson.

The compareCueIntervalForDisplay() comparator depends on a virtual function, isPositionedAbove(TextTrackCue* other),
but this comparison returns inconsistent results for cueA->isPositionedAbove(cueB) and cueB->isPositionedAbove(cueA)
if the two cues are different subclasses of TextTrackCue.

The underlying algorithm should be fixed in a future patch, but for now, remove all non-displaying cues from the array
of activeCues before sorting, rather than after when iterating over the sorted list of activeCues.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (244013 => 244014)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-04-08 12:39:39 UTC (rev 244013)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-04-08 12:39:43 UTC (rev 244014)
@@ -1,3 +1,20 @@
+2019-03-21  Jer Noble  <jer.no...@apple.com>
+
+        Inband Text Track cues interspersed with Data cues can display out of order.
+        https://bugs.webkit.org/show_bug.cgi?id=196095
+
+        Reviewed by Eric Carlson.
+
+        The compareCueIntervalForDisplay() comparator depends on a virtual function, isPositionedAbove(TextTrackCue* other),
+        but this comparison returns inconsistent results for cueA->isPositionedAbove(cueB) and cueB->isPositionedAbove(cueA)
+        if the two cues are different subclasses of TextTrackCue.
+
+        The underlying algorithm should be fixed in a future patch, but for now, remove all non-displaying cues from the array
+        of activeCues before sorting, rather than after when iterating over the sorted list of activeCues.
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
+
 2019-03-21  Zalan Bujtas  <za...@apple.com>
 
         Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer.

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/shadow/MediaControlElements.cpp (244013 => 244014)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/shadow/MediaControlElements.cpp	2019-04-08 12:39:39 UTC (rev 244013)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/shadow/MediaControlElements.cpp	2019-04-08 12:39:43 UTC (rev 244014)
@@ -1171,6 +1171,20 @@
     if (countChildNodes() < activeCues.size())
         removeChildren();
 
+    activeCues.removeAllMatching([] (CueInterval& cueInterval) {
+        if (!cueInterval.data() || !cueInterval.data()->isRenderable())
+            return true;
+
+        RefPtr<VTTCue> cue = toVTTCue(cueInterval.data());
+
+        return !cue->isRenderable()
+            || !cue->track()
+            || !cue->track()->isRendered()
+            || cue->track()->mode() == TextTrack::Mode::Disabled
+            || !cue->isActive()
+            || cue->text().isEmpty();
+    });
+
     // 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.
@@ -1183,22 +1197,13 @@
         if (!mediaController()->closedCaptionsVisible())
             continue;
 
-        RefPtr<TextTrackCue> textTrackCue = activeCues[i].data();
-        if (!textTrackCue->isRenderable())
+        RefPtr<VTTCue> cue = toVTTCue(activeCues[i].data());
+        ASSERT(cue);
+        if (!cue)
             continue;
 
-        RefPtr<VTTCue> cue = toVTTCue(textTrackCue.get());
-
-        ASSERT(cue->isActive());
-        if (!cue->track() || !cue->track()->isRendered() || !cue->isActive() || cue->text().isEmpty())
-            continue;
-
         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());
-
         Ref<VTTCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size(), m_fontSize);
-        if (cue->track()->mode() == TextTrack::Mode::Disabled)
-            continue;
-
         RefPtr<VTTRegion> region = cue->track()->regions()->getRegionById(cue->regionId());
         if (!region) {
             // If cue has an empty text track cue region identifier or there is no
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to