[webkit-changes] [WebKit/WebKit] c2b79f: REGRESSION(271415 at main): Paint-on captions shift s...

Jer Noble noreply at github.com
Fri Jan 12 02:41:13 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c2b79f5f2ba7901ea4cdf02743c178b61270451b
      https://github.com/WebKit/WebKit/commit/c2b79f5f2ba7901ea4cdf02743c178b61270451b
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2024-01-12 (Fri, 12 Jan 2024)

  Changed paths:
    A LayoutTests/media/content/test-paint-on-captions.mp4
    A LayoutTests/media/track/track-paint-on-captions-expected.txt
    A LayoutTests/media/track/track-paint-on-captions.html
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp

  Log Message:
  -----------
  REGRESSION(271415 at main): Paint-on captions shift slightly during playback
https://bugs.webkit.org/show_bug.cgi?id=267413
rdar://120847946

Reviewed by Eric Carlson.

When AVFoundation parses CEA-609 captions and provides them to WebKit via an NSAttributedString,
that string will have it's kCMTextMarkupAttribute_Alignment property set to
kCMTextMarkupAlignmentType_Middle, unless the cue is multiple lines, the lines are different
lengths, and those lines visually align on the left or right. WebKit in turn sets the
InbandTextTrackCue's positionAlign and position properties to be centered. However for
paint-on captions, differences in the font metrics between AVFoundation and WebKit cause the
text to visually shift on the screen as the cue "grows" in length.

When we receive inband cue data that indicates a "middle" alignment, ignore that alignment for
the purposes of positioning the cue within the video's viewport, and treat the cue as if it was
aligned to the left. "Middle" aligned cues with multiple lines will still be centered within the
cue box, however.

* LayoutTests/media/content/test-paint-on-captions.mp4: Added.
* LayoutTests/media/track/track-paint-on-captions-expected.txt: Added.
* LayoutTests/media/track/track-paint-on-captions.html: Added.
* Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes):

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




More information about the webkit-changes mailing list