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 17218 - WebVTT: Allow 'word-wrap: normal' or 'white-space: pre' to overflow the box (and make 'word-wrap: break-word' the default for cues)
Summary: WebVTT: Allow 'word-wrap: normal' or 'white-space: pre' to overflow the box (...
Status: RESOLVED MOVED
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: 17473
Blocks: 19458
  Show dependency treegraph
 
Reported: 2012-05-28 10:44 UTC by Simon Pieters
Modified: 2015-12-01 11:40 UTC (History)
5 users (show)

See Also:


Attachments

Description Simon Pieters 2012-05-28 10:44:19 UTC
[[
Text runs must be wrapped according to the CSS line-wrapping rules, with the following additional constraints: 
* Regardless of the value of the 'white-space' property, lines must be wrapped at the edge of their containing blocks, even if doing so requires splitting a word where there is no line breaking opportunity. (Thus, normally text wraps as needed, but if there is a particularly long word, it does not overflow as it normally would in CSS, it is instead forcibly wrapped at the box's edge.)
* Regardless of the value of the 'white-space' property, any line breaks inserted by the user agent for the purposes of line wrapping must be placed so as to minimise Δ across each run of consecutive lines between preserved newlines in the source. Δ for a set of lines is defined as the sum over each line of the absolute of the difference between the line's length and the mean line length of the set.
]]

We are not happy with this requirement. There are several problems.

The first bullet point is already available in CSS with word-wrap:break-word. We don't want to have two *slightly* different ways to force word wrapping just because the requirement here is differently worded than the CSS feature. Just say that word-wrap:break-word be applied by default (and this property could be white-listed).

We don't want to wrap when white-space is pre or nowrap. We basically don't want to derivate from CSS behavior.

The balanced line wrapping rules is overly precise. Since it is largely undefined in CSS where line break opportunities are, it seems inappropriate to have precise rules for balancing, and UAs should be allowed to approximate the balancing for perf.

So, what we want is:

* Remove the quoted spec text.
* Add word-wrap:break-word; as a default style.
* Relax the balancing algorithm.
Comment 1 Simon Pieters 2012-05-28 13:16:59 UTC
s/derivate/deviate/
Comment 2 Simon Pieters 2012-05-29 04:32:13 UTC
Also add word-wrap to the whitelist and to the list of properties that should cause relayout when changed.
Comment 3 Ian 'Hixie' Hickson 2012-07-24 16:01:48 UTC
What do you want to do with text that spills outside the box?
Comment 4 Philip Jägenstedt 2012-07-26 08:23:50 UTC
Just let it spill, potentially becoming unreadable. If there are common cases where CSS isn't enough to prevent this from happening, fixing it in CSS seems worthwhile.
Comment 5 Ian 'Hixie' Hickson 2012-08-07 23:31:15 UTC
Seems weird that we would have a size setting and then allow text to overflow it...
Comment 6 Philip Jägenstedt 2012-08-08 08:02:11 UTC
It seems like the same problem as <div style="width: 40px; outline: 1px dotted red;">foobarbaz</div> to me. If this is a problem and force-wrapping is the best solution, we should add that mode of wrapping to CSS, if it's not already somehow possible.
Comment 7 Simon Pieters 2012-08-13 08:50:32 UTC
It would be useful with opinions from other implementors here. Meanwhile, Opera willfully violates the spec as described in this bug.
Comment 8 Ian 'Hixie' Hickson 2012-10-10 23:29:50 UTC
Please file a separate bug on the balancing thing if you want the spec to allow different algorithms for that.

For this bug, I will change the spec to allow 'word-wrap: normal' or 'white-space: pre' to overflow the box, and make 'word-wrap: break-word' the default for cues. Currently, overflowing is not well defined for cues, and 'word-wrap' is not set in stone as far as I can tell.

The problem with overflowing is blocked on bug 17473.

The problem with using 'word-wrap' is blocked on CSS3 Text being widely implemented (i.e. stable). I am hesitant to depend on it yet given its history.
Comment 9 Simon Pieters 2015-12-01 11:40:27 UTC
https://github.com/w3c/webvtt/pull/275