This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24380 - [WebVTT] Don't extend TextTrack with WebVTT-specific members
Summary: [WebVTT] Don't extend TextTrack with WebVTT-specific members
Status: RESOLVED FIXED
Alias: None
Product: TextTracks CG
Classification: Unclassified
Component: WebVTT (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Philip Jägenstedt
QA Contact: This bug has no owner yet - up for the taking
URL:
Whiteboard: v1
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-24 07:12 UTC by Philip Jägenstedt
Modified: 2014-01-31 07:35 UTC (History)
5 users (show)

See Also:


Attachments

Description Philip Jägenstedt 2014-01-24 07:12:12 UTC
TextTrackCue was untangled from VTTCue on the grounds that WebVTT may not be the only text track type for all eternity. On the same reasoning, we shouldn't put VTT-specific things on TextTrack:

interface TextTrack : EventTarget {
           attribute VTTRegionList? regions;
  void addRegion(VTTRegion region);
  void removeRegion(VTTRegion region);
};

Spawned from https://www.w3.org/Bugs/Public/show_bug.cgi?id=23686#c5

(I thought I had already filed a bug, but I can't find it.)
Comment 1 Philip Jägenstedt 2014-01-28 17:24:10 UTC
Suggested fix:

1. Change VTTCue to have an "attribute VTTRegion? region" instead of the regionId.
2. Remove the track and id attributes from from VTTRegion, since a region is now coupled with a cue directly, not via an id string.
3. Change the parser to use the id only during parsing to connect cues with regions.
4. Remove all of the extensions to TextTrack and with it the VTTRegionList interface.

In short, make the region an attribute of the cue only. If you want to find all regions (why?) then look at your cues and if you want to remove a region just stop using it.

This seems simpler to spec and implement, and reduces the API surface. Sounds good, Silvia?
Comment 2 Silvia Pfeiffer 2014-01-29 00:18:46 UTC
Maybe I have to see this completely, but will this not lead to duplicating a region for every cue in it?

(als cc-ing Victor for his feedback, since he implemented regions in blink/webkit)
Comment 3 Philip Jägenstedt 2014-01-29 02:39:55 UTC
(In reply to Silvia Pfeiffer from comment #2)
> Maybe I have to see this completely, but will this not lead to duplicating a
> region for every cue in it?

No, the parser would have an id->VTTRegion mapping while it is running, so it would find the same region each time.
Comment 4 vcarbune 2014-01-29 08:08:36 UTC
(In reply to Philip Jägenstedt from comment #1)
> In short, make the region an attribute of the cue only. If you want to find
> all regions (why?) then look at your cues and if you want to remove a region
> just stop using it.

I think the change makes sense; it probably implies a bit more work for developers who will want to change region parameter through script, but re-building an id/region mapping is fairly trivial, if needed.
Comment 5 Philip Jägenstedt 2014-01-29 09:35:00 UTC
Here's my proposal implemented: https://github.com/w3c/webvtt/pull/31
Comment 6 Rick Eyre 2014-01-29 14:43:05 UTC
This was one of the things we were considering bringing up when we implemented this in Firefox. I'm all for this change.
Comment 7 Silvia Pfeiffer 2014-01-30 22:21:20 UTC
OK, understood. I like the simplification. I guess a list of regions is now simply an array?
Comment 8 Philip Jägenstedt 2014-01-31 07:33:38 UTC
(In reply to Silvia Pfeiffer from comment #7)
> OK, understood. I like the simplification. I guess a list of regions is now
> simply an array?

It's no longer exposed in any API, so it's just a conceptual list of no specific kind. As I wrote in one of the commit messages, I think that in the end we should have a (conceptual) id->region map in the parser, so that the id isn't a property of the region but just something required by the syntax.
Comment 9 Philip Jägenstedt 2014-01-31 07:35:20 UTC
Resolving this as fixed since the TextTrack interface extensions are no more:
https://github.com/w3c/webvtt/commit/970b3a2d425d26e63fe2cd94b030f8f80289af00