Bug 105496

Summary: Follow WebVTT line breaking rules
Product: WebKit Reporter: Dean Jackson <dino>
Component: MediaAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, eric.carlson, feature-media-reviews, ian, macpherson, menard, ojan.autocc, silviapf, vcarbune, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 43668, 105569    
Attachments:
Description Flags
Patch eric.carlson: review+

Description Dean Jackson 2012-12-19 21:42:34 PST
From the spec:

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 minimize Δ 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.

I'm not sure we'll be able to do the latter part (nor what the benefit is).
Comment 1 Radar WebKit Bug Importer 2012-12-19 21:43:10 PST
<rdar://problem/12915747>
Comment 2 Radar WebKit Bug Importer 2012-12-19 21:43:14 PST
<rdar://problem/12915748>
Comment 3 Dean Jackson 2012-12-19 21:44:59 PST
Ignore those two radars. The real one is <rdar://problem/12530021>
Comment 4 Dean Jackson 2012-12-19 21:52:52 PST
Created attachment 180277 [details]
Patch
Comment 5 Eric Carlson 2012-12-20 10:04:51 PST
Comment on attachment 180277 [details]
Patch

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

> LayoutTests/media/track/captions-webvtt/long-word.vtt:9
> +mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

Yummy caption :-)
Comment 6 Dean Jackson 2012-12-20 12:13:35 PST
Committed r138282: <http://trac.webkit.org/changeset/138282>
Comment 7 Ian 'Hixie' Hickson 2012-12-20 12:30:37 PST
Re the wrapping, the benefit is it avoids cues wrapping like this:

   Hello World How Are
   You

...which is hard to read.
Comment 8 Dean Jackson 2012-12-20 12:40:18 PST
(In reply to comment #7)
> Re the wrapping, the benefit is it avoids cues wrapping like this:
> 
>    Hello World How Are
>    You
> 
> ...which is hard to read.

Got it. I had a suspicion that is what the specification text meant.

This is something we'll have to add to our layout code. I'll open a followup.