Bug 83321 - Text tracks should not render unless they have kind=captions or kind=subtitles
Summary: Text tracks should not render unless they have kind=captions or kind=subtitles
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anna Cavender
URL:
Keywords:
Depends on:
Blocks: 43668
  Show dependency treegraph
 
Reported: 2012-04-05 15:14 PDT by Anna Cavender
Modified: 2012-05-21 13:33 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.52 KB, patch)
2012-04-16 20:06 PDT, Anna Cavender
no flags Details | Formatted Diff | Diff
Remove any currently rendered cues if kind changes to a non-visible kind. + tests. (11.33 KB, patch)
2012-04-25 15:09 PDT, Anna Cavender
no flags Details | Formatted Diff | Diff
Patch for landing (11.35 KB, patch)
2012-05-21 12:38 PDT, Anna Cavender
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anna Cavender 2012-04-05 15:14:27 PDT
Videos that have a track element with kind=metadata should not render captions.

For example, captions should not be visible here: http://www.annacavender.com/track/demo1/track-metadata.html
Comment 1 Anna Cavender 2012-04-16 20:06:17 PDT
Created attachment 137468 [details]
Patch
Comment 2 Anna Cavender 2012-04-16 20:12:41 PDT
I'm not entirely convinced that updateDisplay() is the proper place to check the text track kind.  Another solution would be to maintain a separate list of renderable TextTrackCues in HTMLMediaElement.  My gut tells me that the overhead of maintaining that list is not worth it and that currentlyActiveCues() will typically be small enough that sifting them right before rendering is probably not a big deal.  I'm open to suggestions.

As for testing, I'm reluctant to add more pixel tests.  Any other ideas?
Comment 3 Victor Carbune 2012-04-17 00:38:46 PDT
(In reply to comment #2)
> I'm not entirely convinced that updateDisplay() is the proper place to check the text track kind.  Another solution would be to maintain a separate list of renderable TextTrackCues in HTMLMediaElement.  My gut tells me that the overhead of maintaining that list is not worth it and that currentlyActiveCues() will typically be small enough that sifting them right before rendering is probably not a big deal.  I'm open to suggestions.
>
> As for testing, I'm reluctant to add more pixel tests.  Any other ideas?
You can call textTrackDisplayElement(video, 'display') defined LayoutTest/media/media-controls.js and check that it throws an error (hence no cue display block is there).
Comment 4 Eric Carlson 2012-04-19 10:41:46 PDT
Comment on attachment 137468 [details]
Patch

Marking r- because this needs a test. I agree that we DO NOT want any more pixel tests, but I think Victor's suggestion should work well.
Comment 5 Anna Cavender 2012-04-25 15:09:11 PDT
Created attachment 138879 [details]
Remove any currently rendered cues if kind changes to a non-visible kind.  + tests.

Thanks for the suggestions, Victor
Comment 6 Anna Cavender 2012-05-17 12:22:28 PDT
Ping!  I think the next review on this one fell through the cracks.
Comment 7 Eric Carlson 2012-05-17 14:39:04 PDT
Comment on attachment 138879 [details]
Remove any currently rendered cues if kind changes to a non-visible kind.  + tests.

View in context: https://bugs.webkit.org/attachment.cgi?id=138879&action=review

> Source/WebCore/html/HTMLMediaElement.cpp:1288
> +        ExceptionCode unusedException;
> +        track->setMode(TextTrack::HIDDEN, unusedException);

ASSERT_NO_EXCEPTION would be preferable.

> Source/WebCore/html/track/TextTrackCue.cpp:614
> +    ExceptionCode unusedException;
> +    m_displayTree->remove(unusedException);

Ditto.
Comment 8 Anna Cavender 2012-05-20 22:10:32 PDT
Thanks Eric!

(In reply to comment #7)
> (From update of attachment 138879 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=138879&action=review
> 
> > Source/WebCore/html/HTMLMediaElement.cpp:1288
> > +        ExceptionCode unusedException;
> > +        track->setMode(TextTrack::HIDDEN, unusedException);
> 
> ASSERT_NO_EXCEPTION would be preferable.

Good idea, that makes sense here.

> 
> > Source/WebCore/html/track/TextTrackCue.cpp:614
> > +    ExceptionCode unusedException;
> > +    m_displayTree->remove(unusedException);
> 
> Ditto.

In this case, I'd have to add an ASSERT_NO_EXCEPTION in Node.h.  Is this worth doing?
Comment 9 Eric Carlson 2012-05-21 09:23:56 PDT
(In reply to comment #8)
> 
> > 
> > > Source/WebCore/html/track/TextTrackCue.cpp:614
> > > +    ExceptionCode unusedException;
> > > +    m_displayTree->remove(unusedException);
> > 
> > Ditto.
> 
> In this case, I'd have to add an ASSERT_NO_EXCEPTION in Node.h.  Is this worth doing?
>
  "m_displayTree->remove(ASSERT_NO_EXCEPTION)" won't work?
Comment 10 Anna Cavender 2012-05-21 10:09:12 PDT
(In reply to comment #9)
> (In reply to comment #8)
> > 
> > > 
> > > > Source/WebCore/html/track/TextTrackCue.cpp:614
> > > > +    ExceptionCode unusedException;
> > > > +    m_displayTree->remove(unusedException);
> > > 
> > > Ditto.
> > 
> > In this case, I'd have to add an ASSERT_NO_EXCEPTION in Node.h.  Is this worth doing?
> >
>   "m_displayTree->remove(ASSERT_NO_EXCEPTION)" won't work?

Oh, yes, I misunderstood your original suggestion.  I'll go ahead and land with those two additions.  Thanks!
Comment 11 Anna Cavender 2012-05-21 12:38:35 PDT
Created attachment 143077 [details]
Patch for landing
Comment 12 WebKit Review Bot 2012-05-21 13:33:38 PDT
Comment on attachment 143077 [details]
Patch for landing

Clearing flags on attachment: 143077

Committed r117811: <http://trac.webkit.org/changeset/117811>
Comment 13 WebKit Review Bot 2012-05-21 13:33:44 PDT
All reviewed patches have been landed.  Closing bug.