Bug 84296

Summary: Implement overlap avoidance for cues with snap-to-lines flag not set
Product: WebKit Reporter: Victor Carbune <vcarbune>
Component: MediaAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: annacc, arun.patole, commit-queue, eric.carlson, esprehn+autocc, glenn, jer.noble, jonlee, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 79347    
Attachments:
Description Flags
Patch eric.carlson: review+

Description Victor Carbune 2012-04-18 16:05:44 PDT
When snap-to-lines flag is false the boxes should not overlap, if possible:

[...]
10.13.4 If there is a position to which the boxes in boxes can be moved while maintaining the relative positions of the boxes in boxes to each other such that none of the boxes in boxes would overlap any of the boxes in output, and all the boxes in output would be within the video's rendering area, then move the boxes in boxes to the closest such position to their current position, and then jump to the step labeled done positioning below. If there are multiple such positions that are equidistant from their current position, use the highest one amongst them; if there are several at that height, then use the leftmost one amongst them.
[...]
Comment 1 Alexey Proskuryakov 2012-04-19 10:11:34 PDT
http://dev.w3.org/html5/webvtt/
Comment 2 Victor Carbune 2012-08-12 07:08:58 PDT
Updating the title and moving under advanced rendering main bug
Comment 3 Jon Lee 2013-05-08 11:34:53 PDT
<rdar://problem/13760909>
Comment 4 Jer Noble 2013-05-20 12:53:10 PDT
Created attachment 202308 [details]
Patch
Comment 5 Eric Carlson 2013-05-20 13:36:29 PDT
Comment on attachment 202308 [details]
Patch

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

> Source/WebCore/rendering/RenderTextTrackCue.cpp:221
> +void RenderTextTrackCue::moveToWithinContainer()

Nit: I am not wild about this name. "keepWithinContainer" or "moveIfNecessaryToKeepWithinContainer"?
Comment 6 Jer Noble 2013-05-21 10:14:28 PDT
Committed r150452: <http://trac.webkit.org/changeset/150452>
Comment 7 Ryosuke Niwa 2013-05-21 12:26:09 PDT
The test added by this patch appears to be failing everywhere:
http://build.webkit.org/results/Apple%20MountainLion%20Release%20WK1%20(Tests)/r150461%20(10183)/results.html

--- /Volumes/Data/slave/mountainlion-release-tests-wk1/build/layout-test-results/media/track/track-cue-rendering-snap-to-lines-not-set-expected.txt
+++ /Volumes/Data/slave/mountainlion-release-tests-wk1/build/layout-test-results/media/track/track-cue-rendering-snap-to-lines-not-set-actual.txt
@@ -85,7 +85,7 @@
 * Cue 2 *
 EXPECTED (cueDisplayElement.innerText == 'Top-right cue.') OK
 Cue left position (percentage): 100
-Cue top position (percentage): 0
+Cue top position (percentage): 7
 
 * Cue 3 *
 EXPECTED (cueDisplayElement.innerText == 'Bottom cue.') OK
@@ -105,6 +105,6 @@
 * Cue 6 *
 EXPECTED (cueDisplayElement.innerText == 'Random cue 3.') OK
 Cue left position (percentage): 23
-Cue top position (percentage): 55
+Cue top position (percentage): 43
 END OF TEST