Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 75881e26cd3acd585ac300d8add22a1fd1c826ef
      
https://github.com/WebKit/WebKit/commit/75881e26cd3acd585ac300d8add22a1fd1c826ef
  Author: Dana Estra <[email protected]>
  Date:   2026-07-27 (Mon, 27 Jul 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/webvtt/rendering/cues-with-video/processing-model/2_cues_overlapping_partially_move_down-expected.html
    M 
LayoutTests/imported/w3c/web-platform-tests/webvtt/rendering/cues-with-video/processing-model/2_cues_overlapping_partially_move_down-ref.html
    M Source/WebCore/rendering/RenderVTTCue.cpp

  Log Message:
  -----------
  WebVTT cue overlap avoidance algorithm should always move cue shortest 
possible distance when snap-to-lines is false
https://bugs.webkit.org/show_bug.cgi?id=320205
rdar://183151333

Reviewed by Eric Carlson.

The WebVTT positioning algorithm (7.2. Processing cue settings, step 10) asks 
that
when the snap-to-lines flag is false and a cue is overlapped with another, the
renderer moves the cue in the direction (up or down if horizontal, left or right
if vertical) that renders it the shortest distance from its original placement 
by
the VTT author.

The spec describes a different algorithm when snap-to-lines is true. In this 
case, the
renderer should first try moving the cue up (or to the left if vertical), and 
if the
edge of the video is hit before finding a non-overlapping position, then try 
again in the
opposite direction. Hence, when snap-to-lines is true, the cue is always moved 
up if there
is open space above regardless if there is a closer spot below.

WebKit's implementation of the snap-to-line == false path is incorrect because 
it only tries
moving the cue down if moving it up was unsuccessful. This patch changes it to 
check both
directions and to move the cue the shortest distance to avoid collision.

Also fixed bug in cues_overlapping_partially_move_down.html and marked it as 
passing. The test
incorrectly treated default line alignment as "center", when the spec states it 
should be "start."

* LayoutTests/TestExpectations:
* Source/WebCore/rendering/RenderVTTCue.cpp:
(WebCore::RenderVTTCue::findNonOverlappingPosition const):
* 
LayoutTests/imported/w3c/web-platform-tests/webvtt/rendering/cues-with-video/processing-model/2_cues_overlapping_partially_move_down-expected.html:
* 
LayoutTests/imported/w3c/web-platform-tests/webvtt/rendering/cues-with-video/processing-model/2_cues_overlapping_partially_move_down-ref.html:

Canonical link: https://commits.webkit.org/318012@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to