WebVTT cue alignment broken
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 23:10:41 +0000 (23:10 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 23:10:41 +0000 (23:10 +0000)
commit1bd61e5a599c186601b25da2ed9fbd1fc00fd39e
treeed192e408cbc99200757704de2352ab92eef8f4e
parent61cee8bcadab3cff4c63ea7daa0c5959fd764f85
WebVTT cue alignment broken
https://bugs.webkit.org/show_bug.cgi?id=190004

Reviewed by Eric Carlson.

Source/WebCore:

If the position of the queue is unspecified, the default value of 50 was used, which is incorrect.
This patch also updates the API according to https://w3c.github.io/webvtt/#the-vttcue-interface.
The position attribute should not be a double, but either a double or the "auto" keyword. Parts
of this patch is inspired by the associated code in the Chromium project.

Test: media/track/track-cue-left-align.html

* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
(WebCore::TextTrackCueGeneric::setPosition):
* html/track/TextTrackCueGeneric.h:
* html/track/VTTCue.cpp:
(WebCore::VTTCueBox::applyCSSProperties):
(WebCore::VTTCue::initialize):
(WebCore::VTTCue::position const):
(WebCore::VTTCue::setPosition):
(WebCore::VTTCue::textPositionIsAuto const):
(WebCore::VTTCue::calculateComputedTextPosition const):
(WebCore::VTTCue::calculateDisplayParameters):
(WebCore::VTTCue::toJSON const):
* html/track/VTTCue.h:
(WebCore::VTTCue::position const): Deleted.
* html/track/VTTCue.idl:

LayoutTests:

* media/track/captions-webvtt/left-align.vtt: Added.
* media/track/track-add-remove-cue-expected.txt:
* media/track/track-add-remove-cue.html:
* media/track/track-cue-left-align-expected-mismatch.html: Added.
* media/track/track-cue-left-align.html: Added.
* media/track/track-cue-mutable-expected.txt:
* media/track/track-cue-mutable.html:
* media/track/track-vttcue-expected.txt:
* media/track/track-vttcue.html:
* media/track/track-webvtt-tc013-settings-expected.txt:
* media/track/track-webvtt-tc013-settings.html:
* media/track/track-webvtt-tc015-positioning-expected.txt:
* media/track/track-webvtt-tc015-positioning.html:
* media/track/track-webvtt-tc016-align-positioning-expected.txt:
* media/track/track-webvtt-tc016-align-positioning.html:
* media/track/track-webvtt-tc018-align-text-line-position-expected.txt:
* media/track/track-webvtt-tc018-align-text-line-position.html:
* media/track/track-webvtt-tc021-valign-expected.txt:
* media/track/track-webvtt-tc021-valign.html:
* media/video-test.js:
(testCues):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/captions-webvtt/left-align.vtt [new file with mode: 0644]
LayoutTests/media/track/track-add-remove-cue-expected.txt
LayoutTests/media/track/track-add-remove-cue.html
LayoutTests/media/track/track-cue-left-align-expected-mismatch.html [new file with mode: 0644]
LayoutTests/media/track/track-cue-left-align.html [new file with mode: 0644]
LayoutTests/media/track/track-cue-mutable-expected.txt
LayoutTests/media/track/track-cue-mutable.html
LayoutTests/media/track/track-vttcue-expected.txt
LayoutTests/media/track/track-vttcue.html
LayoutTests/media/track/track-webvtt-tc013-settings-expected.txt
LayoutTests/media/track/track-webvtt-tc013-settings.html
LayoutTests/media/track/track-webvtt-tc015-positioning-expected.txt
LayoutTests/media/track/track-webvtt-tc015-positioning.html
LayoutTests/media/track/track-webvtt-tc016-align-positioning-expected.txt
LayoutTests/media/track/track-webvtt-tc016-align-positioning.html
LayoutTests/media/track/track-webvtt-tc018-align-text-line-position-expected.txt
LayoutTests/media/track/track-webvtt-tc018-align-text-line-position.html
LayoutTests/media/track/track-webvtt-tc021-valign-expected.txt
LayoutTests/media/track/track-webvtt-tc021-valign.html
LayoutTests/media/video-test.js
Source/WebCore/ChangeLog
Source/WebCore/html/track/TextTrackCueGeneric.cpp
Source/WebCore/html/track/TextTrackCueGeneric.h
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/html/track/VTTCue.h
Source/WebCore/html/track/VTTCue.idl