Title: [243583] branches/safari-607-branch/Source/WebCore
Revision
243583
Author
[email protected]
Date
2019-03-27 16:44:09 -0700 (Wed, 27 Mar 2019)

Log Message

Cherry-pick r243341. rdar://problem/49308013

    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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243341 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (243582 => 243583)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-03-27 23:44:06 UTC (rev 243582)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-03-27 23:44:09 UTC (rev 243583)
@@ -1,5 +1,44 @@
 2019-03-27  Alan Coon  <[email protected]>
 
+        Cherry-pick r243341. rdar://problem/49308013
+
+    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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243341 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-03-21  Jer Noble  <[email protected]>
+
+            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-27  Alan Coon  <[email protected]>
+
         Cherry-pick r243338. rdar://problem/49307958
 
     Fix iOS build after r243337

Modified: branches/safari-607-branch/Source/WebCore/html/shadow/MediaControlElements.cpp (243582 => 243583)


--- branches/safari-607-branch/Source/WebCore/html/shadow/MediaControlElements.cpp	2019-03-27 23:44:06 UTC (rev 243582)
+++ branches/safari-607-branch/Source/WebCore/html/shadow/MediaControlElements.cpp	2019-03-27 23:44:09 UTC (rev 243583)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to