Bug 179237

Summary: Automatic linebreaking of WebVTT subtitles is not supported
Product: WebKit Reporter: Frédéric Wang (:fredw) <fred.wang>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, eric.carlson, fred.wang, jer.noble
Priority: P2 Keywords: WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: http://wpt.live/html/semantics/embedded-content/media-elements/track/track-element/track-webvtt-non-snap-to-lines.html
See Also: https://bugs.webkit.org/show_bug.cgi?id=179370
Attachments:
Description Flags
WIP Patch none

Frédéric Wang (:fredw)
Reported 2017-11-03 03:45:24 PDT
From the spec: https://w3c.github.io/webvtt/#introduction-multiple-lines "Line breaks in cues are honored. User agents will also insert extra line breaks if necessary to fit the cue in the cue’s width. In general, therefore, authors are encouraged to write cues all on one line except when a line break is definitely necessary." This page uses the example from the specification: https://people.igalia.com/fwang/webvtt-tests/subtitle-linebreaking.html Linebreaking happens for the long (third) subtitle in Gecko, but not in WebKit. I tried both WebKitGTK+/Linux and Safari/macOS.
Attachments
WIP Patch (1.42 KB, patch)
2017-11-07 03:47 PST, Frédéric Wang (:fredw)
no flags
Frédéric Wang (:fredw)
Comment 1 2017-11-07 03:47:45 PST
Created attachment 326204 [details] WIP Patch I had reported this to Chromium and they reply it is fixed (see https://bugs.chromium.org/p/chromium/issues/detail?id=781186). The attached patch is based on https://chromium.googlesource.com/chromium/src.git/+/e6b16d301f0da8a22bfba7ab5997771af0459cf5%5E!/#F2 and removes a feature that is no longer in the WebVTT spec. It turns out to fix the linebreaking issue. I also opened bug 179370 to import the WebVTT tests.
Ahmad Saleem
Comment 2 2023-10-25 09:13:53 PDT
All browsers are failing WPT test linked in the URL (removed the standard link URL since it is in Comment 0). Added 'WPTImpact' tag for future tracking.
Ahmad Saleem
Comment 3 2023-10-25 09:20:50 PDT
We still have this code but in different shape here: https://searchfox.org/wubkat/source/Source/WebCore/html/track/VTTCue.cpp#261 if (!cue->snapToLines()) { setInlineStyleProperty(CSSPropertyWhiteSpaceCollapse, CSSValuePreserve); setInlineStyleProperty(CSSPropertyTextWrapMode, CSSValueNowrap); }
Note You need to log in before you can comment on or make changes to this bug.