⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243583 in webkit


Ignore:
Timestamp:
Mar 27, 2019, 4:44:09 PM (7 years ago)
Author:
Alan Coon
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

Location:
branches/safari-607-branch/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Source/WebCore/ChangeLog

    r243582 r243583  
     12019-03-27  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r243341. rdar://problem/49308013
     4
     5    Inband Text Track cues interspersed with Data cues can display out of order.
     6    https://bugs.webkit.org/show_bug.cgi?id=196095
     7   
     8    Reviewed by Eric Carlson.
     9   
     10    The compareCueIntervalForDisplay() comparator depends on a virtual function, isPositionedAbove(TextTrackCue* other),
     11    but this comparison returns inconsistent results for cueA->isPositionedAbove(cueB) and cueB->isPositionedAbove(cueA)
     12    if the two cues are different subclasses of TextTrackCue.
     13   
     14    The underlying algorithm should be fixed in a future patch, but for now, remove all non-displaying cues from the array
     15    of activeCues before sorting, rather than after when iterating over the sorted list of activeCues.
     16   
     17    * html/shadow/MediaControlElements.cpp:
     18    (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
     19   
     20   
     21    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243341 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     22
     23    2019-03-21  Jer Noble  <jer.noble@apple.com>
     24
     25            Inband Text Track cues interspersed with Data cues can display out of order.
     26            https://bugs.webkit.org/show_bug.cgi?id=196095
     27
     28            Reviewed by Eric Carlson.
     29
     30            The compareCueIntervalForDisplay() comparator depends on a virtual function, isPositionedAbove(TextTrackCue* other),
     31            but this comparison returns inconsistent results for cueA->isPositionedAbove(cueB) and cueB->isPositionedAbove(cueA)
     32            if the two cues are different subclasses of TextTrackCue.
     33
     34            The underlying algorithm should be fixed in a future patch, but for now, remove all non-displaying cues from the array
     35            of activeCues before sorting, rather than after when iterating over the sorted list of activeCues.
     36
     37            * html/shadow/MediaControlElements.cpp:
     38            (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
     39
    1402019-03-27  Alan Coon  <alancoon@apple.com>
    241
  • branches/safari-607-branch/Source/WebCore/html/shadow/MediaControlElements.cpp

    r237266 r243583  
    11721172        removeChildren();
    11731173
     1174    activeCues.removeAllMatching([] (CueInterval& cueInterval) {
     1175        if (!cueInterval.data() || !cueInterval.data()->isRenderable())
     1176            return true;
     1177
     1178        RefPtr<VTTCue> cue = toVTTCue(cueInterval.data());
     1179
     1180        return !cue->isRenderable()
     1181            || !cue->track()
     1182            || !cue->track()->isRendered()
     1183            || cue->track()->mode() == TextTrack::Mode::Disabled
     1184            || !cue->isActive()
     1185            || cue->text().isEmpty();
     1186    });
     1187
    11741188    // Sort the active cues for the appropriate display order. For example, for roll-up
    11751189    // or paint-on captions, we need to add the cues in reverse chronological order,
     
    11841198            continue;
    11851199
    1186         RefPtr<TextTrackCue> textTrackCue = activeCues[i].data();
    1187         if (!textTrackCue->isRenderable())
     1200        RefPtr<VTTCue> cue = toVTTCue(activeCues[i].data());
     1201        ASSERT(cue);
     1202        if (!cue)
    11881203            continue;
    11891204
    1190         RefPtr<VTTCue> cue = toVTTCue(textTrackCue.get());
    1191 
    1192         ASSERT(cue->isActive());
    1193         if (!cue->track() || !cue->track()->isRendered() || !cue->isActive() || cue->text().isEmpty())
    1194             continue;
    1195 
    11961205        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());
    1197 
    11981206        Ref<VTTCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size(), m_fontSize);
    1199         if (cue->track()->mode() == TextTrack::Mode::Disabled)
    1200             continue;
    1201 
    12021207        RefPtr<VTTRegion> region = cue->track()->regions()->getRegionById(cue->regionId());
    12031208        if (!region) {
Note: See TracChangeset for help on using the changeset viewer.