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 16917 - WebVTT: snapToLines should throw InvalidStateError if the new value is false and "line" is negative or greater than 100
Summary: WebVTT: snapToLines should throw InvalidStateError if the new value is false ...
Status: RESOLVED FIXED
Alias: None
Product: TextTracks CG
Classification: Unclassified
Component: WebVTT (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Philip Jägenstedt
QA Contact: This bug has no owner yet - up for the taking
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard: v1
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-03 11:57 UTC by contributor
Modified: 2014-01-30 09:39 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2012-05-03 11:57:32 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html
Multipage: http://www.whatwg.org/C#text-track-api
Complete: http://www.whatwg.org/c#text-track-api

Comment:
snapToLines should throw InvalidStateError if the new value is false and
"line" is negative or greater than 100

Posted from: 88.131.66.80 by simonp@opera.com
User agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.7.3; U; en) Presto/2.10.229 Version/11.62
Comment 1 Simon Pieters 2012-05-03 11:59:09 UTC
Currently this throws:

cue.snapToLines = false;
cue.line = -1; // throws IndexSizeError

but this doesn't throw:

cue.snapToLines = true;
cue.line = -1;
cue.snapToLines = false; // this should not be allowed
Comment 2 contributor 2012-07-18 17:36:03 UTC
This bug was cloned to create bug 18185 as part of operation convergence.
Comment 3 Ian 'Hixie' Hickson 2012-08-30 18:19:31 UTC
Good point.

Should we throw, or force .line to a valid value? What's the conceptual model here? Is it that you can pick one or the other of two boxes, one of which has a wheel that turns from 0..100 and the other allows you to pick any integer? Or is it that there are is a dial interlocked with a switch, and the dial picks any integer, and the switch blocks the dial to the range 0..100, e.g. because the dial has a groove in the range 0..100 that the switch pushes a rod into?

To put it another way, what's the expected way this will be used? Do we expect to see this kind of code?:

   function (c, newSnapValue, newLineValue) {
     c.snapToLines = newSnapValue;
     c.line = newLineValue;
   }

If so, we presumably want the two-block mode (i.e. reset line when setting snapToLines, if line is out of range), otherwise it'll randomly throw and you'll always have to test the current values first...
Comment 4 Simon Pieters 2012-09-07 08:26:11 UTC
Hmm. Since scripts might set these in any order, it might be in an invalid state when the first is set but then be valid again when the other is set. Clamping and resetting would result with the end result. Throwing would stop the script.

I think we should allow setting to any value, i.e. not force a valid state in the DOM API, but for the purpose of rendering, while these are in an invalid state, ignore them both (default to "auto"). This would allow scripts to set them in any order without worrying about it getting the wrong values, and if they end up with something invalid, it gets ignored, just like in the WebVTT syntax.
Comment 5 Simon Pieters 2012-09-07 08:27:45 UTC
(In reply to comment #4)
> Clamping and resetting would result with the end result.

...the wrong end result.
Comment 6 Ian 'Hixie' Hickson 2012-09-11 22:29:23 UTC
The only way it can be invalid is if snapToLines is true and the value is negative or > 100, right? So "auto" in that case is always just equivalent to "100".

I've done as you suggest in comment 5. I think this is the opposite of all the previous comments, as well as bug 17027, which I'll now mark INVALID.
Comment 7 Simon Pieters 2012-09-12 16:36:52 UTC
An invalid state should be rendered as if the webvtt line setting was absent, i.e. as if snapToLines = true; line = 'auto'. The spec now says to use as if line:100% which is different from auto.
Comment 8 Simon Pieters 2012-10-27 09:27:41 UTC
(In reply to comment #6)
> I've done as you suggest in comment 5.

http://html5.org/tools/web-apps-tracker?from=7327&to=7328
Comment 10 Philip Jägenstedt 2014-01-28 08:31:04 UTC
Resolving as fixed, please reopen if there are still bugs.
Comment 11 Simon Pieters 2014-01-30 09:39:43 UTC
lgtm