Renaming parameters for positioning a track cue
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2012 17:10:34 +0000 (17:10 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2012 17:10:34 +0000 (17:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78706

Source/WebCore:

Change WebVTT settings identifiers for spec change: D: -> vertical:, L: -> line:,
T: -> position:, S: -> size:, A: -> align:

Reviewed by Sam Weinig.

No new tests, existing tests updated for spec changes.

* html/track/TextTrackCue.cpp:
(WebCore::verticalGrowingLeftKeyword): Drive-by change to improve readability.
(WebCore::TextTrackCue::settingName): New, parse the settings keyword.
(WebCore::TextTrackCue::parseSettings): Update to match the current spec.
* html/track/TextTrackCue.h:

* html/track/WebVTTParser.h:
(WebCore::WebVTTParser::isValidSettingDelimiter): New.

LayoutTests:

Reviewed by Sam Weinig.

* media/track/captions-webvtt/missed-cues.vtt:
* media/track/captions-webvtt/sorted-dispatch.vtt:
* media/track/captions-webvtt/tc005-default-styles.vtt:
* media/track/captions-webvtt/tc014-alignment-bad.vtt:
* media/track/captions-webvtt/tc014-alignment-ltr.vtt:
* media/track/captions-webvtt/tc014-alignment.vtt:
* media/track/captions-webvtt/tc015-positioning-bad.vtt:
* media/track/captions-webvtt/tc015-positioning-ltr.vtt:
* media/track/captions-webvtt/tc015-positioning.vtt:
* media/track/captions-webvtt/tc016-align-positioning-bad.vtt:
* media/track/captions-webvtt/tc016-align-positioning.vtt:
* media/track/captions-webvtt/tc017-line-position-bad.vtt:
* media/track/captions-webvtt/tc017-line-position.vtt:
* media/track/captions-webvtt/tc018-align-text-line-position-bad.vtt:
* media/track/captions-webvtt/tc018-align-text-line-position.vtt:
* media/track/captions-webvtt/tc019-cue-size-bad.vtt:
* media/track/captions-webvtt/tc019-cue-size.vtt:
* media/track/captions-webvtt/tc020-cue-size-align-bad.vtt:
* media/track/captions-webvtt/tc020-cue-size-align.vtt:
* media/track/captions-webvtt/tc021-valign-bad.vtt:
* media/track/captions-webvtt/tc021-valign-ltr.vtt:
* media/track/captions-webvtt/tc021-valign.vtt:
* media/track/captions-webvtt/tc022-entities-wrong.vtt:
* media/track/captions-webvtt/tc022-entities.vtt:
* media/track/captions-webvtt/tc023-markup-bad.vtt:
* media/track/captions-webvtt/tc023-markup.vtt:
* media/track/captions-webvtt/tc024-timestamp-bad.vtt:
* media/track/captions-webvtt/tc024-timestamp.vtt:
* media/track/captions-webvtt/tc025-class-bad.vtt:
* media/track/captions-webvtt/tc025-class.vtt:
* media/track/captions-webvtt/tc026-voice-bad.vtt:
* media/track/captions-webvtt/tc026-voice.vtt:
* media/track/captions-webvtt/tc027-empty-cue.vtt:
* media/track/captions-webvtt/tc028-unsupported-markup.vtt:
    Update settings for spec change.

* media/track/captions-webvtt/tc013-settings-bad-separation.vtt:
* media/track/captions-webvtt/tc013-settings.vtt:
* media/track/track-webvtt-tc013-settings-expected.txt:
* media/track/track-webvtt-tc013-settings.html:
    Update test and results to skip illegal settings delimiters.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112898 268f45cc-cd09-0410-ab3c-d52691b4dbfc

43 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/captions-webvtt/missed-cues.vtt
LayoutTests/media/track/captions-webvtt/sorted-dispatch.vtt
LayoutTests/media/track/captions-webvtt/tc005-default-styles.vtt
LayoutTests/media/track/captions-webvtt/tc013-settings-bad-separation.vtt
LayoutTests/media/track/captions-webvtt/tc013-settings.vtt
LayoutTests/media/track/captions-webvtt/tc014-alignment-bad.vtt
LayoutTests/media/track/captions-webvtt/tc014-alignment-ltr.vtt
LayoutTests/media/track/captions-webvtt/tc014-alignment.vtt
LayoutTests/media/track/captions-webvtt/tc015-positioning-bad.vtt
LayoutTests/media/track/captions-webvtt/tc015-positioning-ltr.vtt
LayoutTests/media/track/captions-webvtt/tc015-positioning.vtt
LayoutTests/media/track/captions-webvtt/tc016-align-positioning-bad.vtt
LayoutTests/media/track/captions-webvtt/tc016-align-positioning.vtt
LayoutTests/media/track/captions-webvtt/tc017-line-position-bad.vtt
LayoutTests/media/track/captions-webvtt/tc017-line-position.vtt
LayoutTests/media/track/captions-webvtt/tc018-align-text-line-position-bad.vtt
LayoutTests/media/track/captions-webvtt/tc018-align-text-line-position.vtt
LayoutTests/media/track/captions-webvtt/tc019-cue-size-bad.vtt
LayoutTests/media/track/captions-webvtt/tc019-cue-size.vtt
LayoutTests/media/track/captions-webvtt/tc020-cue-size-align-bad.vtt
LayoutTests/media/track/captions-webvtt/tc020-cue-size-align.vtt
LayoutTests/media/track/captions-webvtt/tc021-valign-bad.vtt
LayoutTests/media/track/captions-webvtt/tc021-valign-ltr.vtt
LayoutTests/media/track/captions-webvtt/tc021-valign.vtt
LayoutTests/media/track/captions-webvtt/tc022-entities-wrong.vtt
LayoutTests/media/track/captions-webvtt/tc022-entities.vtt
LayoutTests/media/track/captions-webvtt/tc023-markup-bad.vtt
LayoutTests/media/track/captions-webvtt/tc023-markup.vtt
LayoutTests/media/track/captions-webvtt/tc024-timestamp-bad.vtt
LayoutTests/media/track/captions-webvtt/tc024-timestamp.vtt
LayoutTests/media/track/captions-webvtt/tc025-class-bad.vtt
LayoutTests/media/track/captions-webvtt/tc025-class.vtt
LayoutTests/media/track/captions-webvtt/tc026-voice-bad.vtt
LayoutTests/media/track/captions-webvtt/tc026-voice.vtt
LayoutTests/media/track/captions-webvtt/tc027-empty-cue.vtt
LayoutTests/media/track/captions-webvtt/tc028-unsupported-markup.vtt
LayoutTests/media/track/track-webvtt-tc013-settings-expected.txt
LayoutTests/media/track/track-webvtt-tc013-settings.html
Source/WebCore/ChangeLog
Source/WebCore/html/track/TextTrackCue.cpp
Source/WebCore/html/track/TextTrackCue.h
Source/WebCore/html/track/WebVTTParser.h

index 00af1e0..790c1d1 100644 (file)
@@ -1,3 +1,52 @@
+2012-04-02  Eric Carlson  <eric.carlson@apple.com>
+
+        Renaming parameters for positioning a track cue
+        https://bugs.webkit.org/show_bug.cgi?id=78706
+
+        Reviewed by Sam Weinig.
+
+        * media/track/captions-webvtt/missed-cues.vtt:
+        * media/track/captions-webvtt/sorted-dispatch.vtt:
+        * media/track/captions-webvtt/tc005-default-styles.vtt:
+        * media/track/captions-webvtt/tc014-alignment-bad.vtt:
+        * media/track/captions-webvtt/tc014-alignment-ltr.vtt:
+        * media/track/captions-webvtt/tc014-alignment.vtt:
+        * media/track/captions-webvtt/tc015-positioning-bad.vtt:
+        * media/track/captions-webvtt/tc015-positioning-ltr.vtt:
+        * media/track/captions-webvtt/tc015-positioning.vtt:
+        * media/track/captions-webvtt/tc016-align-positioning-bad.vtt:
+        * media/track/captions-webvtt/tc016-align-positioning.vtt:
+        * media/track/captions-webvtt/tc017-line-position-bad.vtt:
+        * media/track/captions-webvtt/tc017-line-position.vtt:
+        * media/track/captions-webvtt/tc018-align-text-line-position-bad.vtt:
+        * media/track/captions-webvtt/tc018-align-text-line-position.vtt:
+        * media/track/captions-webvtt/tc019-cue-size-bad.vtt:
+        * media/track/captions-webvtt/tc019-cue-size.vtt:
+        * media/track/captions-webvtt/tc020-cue-size-align-bad.vtt:
+        * media/track/captions-webvtt/tc020-cue-size-align.vtt:
+        * media/track/captions-webvtt/tc021-valign-bad.vtt:
+        * media/track/captions-webvtt/tc021-valign-ltr.vtt:
+        * media/track/captions-webvtt/tc021-valign.vtt:
+        * media/track/captions-webvtt/tc022-entities-wrong.vtt:
+        * media/track/captions-webvtt/tc022-entities.vtt:
+        * media/track/captions-webvtt/tc023-markup-bad.vtt:
+        * media/track/captions-webvtt/tc023-markup.vtt:
+        * media/track/captions-webvtt/tc024-timestamp-bad.vtt:
+        * media/track/captions-webvtt/tc024-timestamp.vtt:
+        * media/track/captions-webvtt/tc025-class-bad.vtt:
+        * media/track/captions-webvtt/tc025-class.vtt:
+        * media/track/captions-webvtt/tc026-voice-bad.vtt:
+        * media/track/captions-webvtt/tc026-voice.vtt:
+        * media/track/captions-webvtt/tc027-empty-cue.vtt:
+        * media/track/captions-webvtt/tc028-unsupported-markup.vtt:
+            Update settings for spec change.
+
+        * media/track/captions-webvtt/tc013-settings-bad-separation.vtt:
+        * media/track/captions-webvtt/tc013-settings.vtt:
+        * media/track/track-webvtt-tc013-settings-expected.txt:
+        * media/track/track-webvtt-tc013-settings.html:
+            Update test and results to skip illegal settings delimiters.
+
 2012-04-02  Alexander Pavlov  <apavlov@chromium.org>
 
         [Chromium] Unreviewed, mark http/tests/xmlhttprequest/upload-progress-events.html as crashy on Linux Debug
index 53dff06..924bcc3 100644 (file)
@@ -2,26 +2,26 @@ WEBVTT
 Events should be triggered for missed (skipped) cues during normal playback.
 
 1
-00:00:00.000 --> 00:00:01.500 A:start T:20%
+00:00:00.000 --> 00:00:01.500 align:start position:20%
 Bear is Coming!!!!!
 And what kind of a bear it is - just have look.
 
 2
-00:00:02.000 --> 00:00:02.500 A:start T:20%
+00:00:02.000 --> 00:00:02.500 align:start position:20%
 I said Bear is coming!!!!
 
 3
-00:00:05.500 --> 00:00:05.501 A:start T:20%
+00:00:05.500 --> 00:00:05.501 align:start position:20%
 I said Bear is coming now!!!!
 
 4
-00:00:05.700 --> 00:00:05.701 A:start T:20%
+00:00:05.700 --> 00:00:05.701 align:start position:20%
 This is the second missed cue in the test.
 
 5
-00:00:05.800 --> 00:00:05.801 A:start T:20%
+00:00:05.800 --> 00:00:05.801 align:start position:20%
 Maybe a third missed cue.
 
 6
-00:00:05.992 --> 00:00:05.993 A:start T:20%
+00:00:05.992 --> 00:00:05.993 align:start position:20%
 Fourth missed cue.
index db925d6..438ea6a 100644 (file)
@@ -6,7 +6,7 @@ Enter and exit events should be dispatched in a sorted order according to their
 Missed cue that should not be considered because of seeking.
 
 1
-00:00:05.100 --> 00:00:05.800 A:start T:20%
+00:00:05.100 --> 00:00:05.800 align:start position:20%
 Bear is Coming!!!!!
 
 2
@@ -22,13 +22,13 @@ And what kind of a bear it is - just have look.
 Missed Cue 2
 
 5
-00:00:05.300 --> 00:00:05.800 A:start T:20%
+00:00:05.300 --> 00:00:05.800 align:start position:20%
 I said Bear is coming!!!!
 
 6
-00:00:05.990 --> 00:00:05.993 A:start T:20%
+00:00:05.990 --> 00:00:05.993 align:start position:20%
 I said Bear is coming now!!!!
 
 7
-00:00:05.994 --> 00:00:05.998 A:start T:20%
+00:00:05.994 --> 00:00:05.998 align:start position:20%
 Bear is already here
index b99ff97..d890ca3 100644 (file)
@@ -8,7 +8,7 @@ STYLE-->
 ::cue(.narration) { color: blue; }
 
 DEFAULTS -->
-L:-1 A:middle S:50%
+line:-1 align:middle size:50%
 
 1
 00:00:00.000 --> 00:00:30.500
index b03b3b7..577cbd9 100644 (file)
@@ -1,18 +1,20 @@
 WEBVTT
-Cues settings may only be separated by spaces or tabs (all of these settings are ignored).
+Cues settings may only be separated by spaces or tabs, but illegal characters 
+between settings are ignored.
 
 1
-00:00:00.000 --> 00:00:30.500 - L:100%
-Bear is Coming!!!!! Bad separator
+00:00:00.000 --> 00:00:30.500 - line:43% position:10% -
+Bear is Coming!!!!! Bad separator ignored.
 
 2
-00:00:31.000 --> 00:01:00.500 --> T:50%
-I said Bear is coming!!!! Bad separator.
+00:00:31.000 --> 00:01:00.500 --> position:50% Vertical:lr align:end
+I said Bear is coming!!!! Bad separator and setting ignored.
 
 3
-00:01:01.000 --> 00:02:00.500 <A:middle> <T:50%>
-I said Bear is coming now!!!! Bad setting markup.
+00:01:01.000 --> 00:02:00.500 <align:end> <position:90%>
+I said Bear is coming now!!!! Bad setting markup. Not ignored because the settings are
+not delimited by spaces or tabs.
 
 4
-00:02:01.000 --> 100:20:00.500 / D:horizontal
-I said Bear is coming now!!!! Bad separators.
\ No newline at end of file
+00:02:01.000 --> 100:20:00.500 / vertical:lr | position:90%
+I said Bear is coming now!!!! Bad separator ignored.
index 5832382..dd6b022 100644 (file)
@@ -2,17 +2,17 @@ WEBVTT
 Cue settings may be separated by spaces or tabs.
 
 1
-00:00:00.000 --> 00:00:30.500 L:100%
+00:00:00.000 --> 00:00:30.500 line:100% align:start
 Bear is Coming!!!!! One blank.
 
 2
-00:00:31.000 --> 00:01:00.500   T:50%
+00:00:31.000 --> 00:01:00.500   position:40% vertical:rl line:15%
 I said Bear is coming!!!! Several blanks.
 
 3
-00:01:01.000 --> 00:02:00.500  A:middle T:50%
+00:01:01.000 --> 00:02:00.500  align:middle position:10%
 I said Bear is coming now!!!! Tab separator.
 
 4
-00:02:01.000 --> 100:20:00.500                 D:horizontal
+00:02:01.000 --> 100:20:00.500         line:95%        vertical:lr align:end
 I said Bear is coming now!!!! Tab separators.
\ No newline at end of file
index b1acb3d..5beb376 100644 (file)
@@ -2,21 +2,21 @@ WEBVTT
 Cue alignment may only be start, middle, or end.  These are all misspelled and so will default to middle.
 
 1
-00:00:00.000 --> 00:00:30.500 A:starta
+00:00:00.000 --> 00:00:30.500 align:starta
 Bear is Coming!!!!!
 Erroneous alignment value -> middle.
 
 2
-00:00:31.000 --> 00:01:00.500 A:-start
+00:00:31.000 --> 00:01:00.500 align:-start
 I said Bear is coming!!!!
 Erroneous alignment value --> middle.
 
 3
-00:01:01.000 --> 00:02:00.500 A: end
+00:01:01.000 --> 00:02:00.500 align: end
 I said Bear is coming now!!!!
 Erroneous alignment value with surplus whitespace --> middle.
 
 4
-00:02:01.000 --> 100:20:00.500 A:piugjk
+00:02:01.000 --> 100:20:00.500 align:piugjk
 I said Bear is coming now!!!!
-Erroneous alignment value -> middle.
\ No newline at end of file
+Erroneous alignment value -> middle.
index 6071bf0..673b29a 100644 (file)
@@ -2,17 +2,17 @@ WEBVTT
 Cue alignment may be start, middle, or end (default is middle).
 
 1
-00:00:00.000 --> 00:00:30.500 A:start
+00:00:00.000 --> 00:00:30.500 align:start
 الدب قادم!!!!!
 بدء محاذاته.
 
 2
-00:00:31.000 --> 00:01:00.500 A:middle
+00:00:31.000 --> 00:01:00.500 align:middle
 قلت الدب قادم!!
 محاذاة الوسط.
 
 3
-00:01:01.000 --> 00:02:00.500 A:end
+00:01:01.000 --> 00:02:00.500 align:end
 قلت الدب قادم الآن!!
 محاذاة الغاية.
 
index 918555a..ad7792f 100644 (file)
@@ -2,17 +2,17 @@ WEBVTT
 Cue alignment may be start, middle, or end (default is middle).
 
 1
-00:00:00.000 --> 00:00:30.500 A:start
+00:00:00.000 --> 00:00:30.500 align:start
 Bear is Coming!!!!!
 Start align.
 
 2
-00:00:31.000 --> 00:01:00.500 A:middle
+00:00:31.000 --> 00:01:00.500 align:middle
 I said Bear is coming!!!!
 Middle align.
 
 3
-00:01:01.000 --> 00:02:00.500 A:end
+00:01:01.000 --> 00:02:00.500 align:end
 I said Bear is coming now!!!!
 End align.
 
index a435dda..58ca679 100644 (file)
@@ -2,38 +2,38 @@ WEBVTT
 Invalid horizontal positioning values (all settings are ignored).
 
 1
-00:00:00.000 --> 00:00:15.500 T:-5%
+00:00:00.000 --> 00:00:15.500 position:-5%
 Bear is Coming!!!!!
 This would be off screen -> ignored.
 
-00:00:16.000 --> 00:00:30.500 T:150%
+00:00:16.000 --> 00:00:30.500 position:150%
 Bear is Coming!!!!!
 This would be off screen -> ignored.
 
 2
-00:00:31.000 --> 00:00:45.500 T:50
+00:00:31.000 --> 00:00:45.500 position:50
 I said Bear is coming!!!!
 Missing percent sign -> ignored.
 
 2
-00:00:46.000 --> 00:01:00.500 T:50a%
+00:00:46.000 --> 00:01:00.500 position:50a%
 I said Bear is coming!!!!
 Surplus character between number and percent sign -> ignored.
 
 3
-00:01:01.000 --> 00:01:30.500 T:100%-fj
+00:01:01.000 --> 00:01:30.500 position:100%-fj
 I said Bear is coming now!!!!
 Surplus characters after percent sign -> ignored.
 
 
-00:01:31.000 --> 00:02:00.500 T:100asdf
+00:01:31.000 --> 00:02:00.500 position:100asdf
 I said Bear is coming now!!!!
 Surplus characters and no percent sign -> ignored.
 
-00:02:01.000 --> 00:02:02.000 T:e50%
+00:02:01.000 --> 00:02:02.000 position:e50%
 I said Bear is coming now!!!!
 Surplus characters at beginning of size string -> ignored.
 
-00:02:02.100 --> 00:02:02.500 T:5g0%
+00:02:02.100 --> 00:02:02.500 position:5g0%
 I said Bear is coming now!!!!
 Surplus characters in middle of size string -> ignored.
index 36bd4cd..b23a744 100644 (file)
@@ -2,12 +2,12 @@ WEBVTT
 Valid horizontal positioning values.
 
 1
-00:00:00.000 --> 00:00:30.500 T:0%
+00:00:00.000 --> 00:00:30.500 position:0%
 الدب قادم!!!!!
 تحديد المواقع في أسفل اليمين.
 
 2
-00:00:31.000 --> 00:00:45.500 T:50%
+00:00:31.000 --> 00:00:45.500 position:50%
 قلت الدب قادم!!
 تحديد المواقع في منتصف القاع.
 
@@ -16,6 +16,6 @@ Valid horizontal positioning values.
 المواقع الافتراضية على منتصف أسفل تزال قائمة.
 
 3
-00:01:01.000 --> 00:02:00.500 T:100%
+00:01:01.000 --> 00:02:00.500 position:100%
 قلت الدب قادم الآن!!
-غادر لتحديد المواقع في القاع.
\ No newline at end of file
+غادر لتحديد المواقع في القاع.
index 8e701a7..ccf6024 100644 (file)
@@ -2,12 +2,12 @@ WEBVTT
 Valid horizontal positioning values.
 
 1
-00:00:00.000 --> 00:00:30.500 T:0%
+00:00:00.000 --> 00:00:30.500 position:0%
 Bear is Coming!!!!!
 Positioning on the left bottom.
 
 2
-00:00:31.000 --> 00:00:45.500 T:50%
+00:00:31.000 --> 00:00:45.500 position:50%
 I said Bear is coming!!!!
 Positioning on the bottom middle.
 
@@ -16,6 +16,6 @@ I said Bear is coming!!!!
 Default positioning on the bottom middle still.
 
 3
-00:01:01.000 --> 00:02:00.500 T:100%
+00:01:01.000 --> 00:02:00.500 position:100%
 I said Bear is coming now!!!!
 Positioning on the bottom right.
index ad99807..ff4c3fb 100644 (file)
@@ -2,19 +2,19 @@ WEBVTT
 Either one or both of positioning and alignment values are invalid.
 
 1
-00:00:00.000 --> 00:00:30.500 T:10% A: start
+00:00:00.000 --> 00:00:30.500 position:10% align: start
 Bear is Coming!!!!!
 Positioning on the left bottom, middle aligned,
 because the alignment is mistyped.
 
 2
-00:00:31.000 --> 00:00:45.500 T:200% A:middle
+00:00:31.000 --> 00:00:45.500 position:200% align:middle
 I said Bear is coming!!!!
 Positioning on the bottom middle, middle aligned,
 because the positioning is off.
 
 3
-00:01:01.000 --> 00:02:00.500 T:-80% A:ends
+00:01:01.000 --> 00:02:00.500 position:-80% align:ends
 I said Bear is coming now!!!!
 Positioning on the bottom middle, middle aligned,
-because both the alignment and positioning don't apply.
\ No newline at end of file
+because both the alignment and positioning don't apply.
index f1e9b3b..a6e6af2 100644 (file)
@@ -2,19 +2,19 @@ WEBVTT
 Cues should position at different horizontal positions with different alignments.
 
 1
-00:00:00.000 --> 00:00:30.500 T:10% A:start
+00:00:00.000 --> 00:00:30.500 position:10% align:start
 Bear is Coming!!!!!
 Positioning on the left bottom, start aligned, and
 first character rendering position is at 10% of width.
 
 2
-00:00:31.000 --> 00:00:45.500 T:20% A:middle
+00:00:31.000 --> 00:00:45.500 position:20% align:middle
 I said Bear is coming!!!!
 Positioning on the bottom left, middle aligned, and
 middle character rendering position of each line is at 20% of width.
 
 3
-00:01:01.000 --> 00:02:00.500 A:end T:80%
+00:01:01.000 --> 00:02:00.500 align:end position:80%
 I said Bear is coming now!!!!
 Positioning on the bottom right, end aligned, and
-last character rendering position of each line is at 80% of width.
\ No newline at end of file
+last character rendering position of each line is at 80% of width.
index f265a35..9eff499 100644 (file)
@@ -2,34 +2,34 @@ WEBVTT
 Invalid positioning values (all settings are ignored).
 
 1
-00:00:00.000 --> 00:00:15.000 L:-0%
+00:00:00.000 --> 00:00:15.000 line:-0%
 Bear is Coming!!!!!
 Negative percentages are not allowed.
 Line position is ignored.
 
-00:00:15.500 --> 00:00:30.500 L:0.5
+00:00:15.500 --> 00:00:30.500 line:0.5
 Bear is Coming!!!!!
 Fractions of lines are not allowed.
 Line position is ignored.
 
 2
-00:00:31.000 --> 00:00:45.500 L:+50%
+00:00:31.000 --> 00:00:45.500 line:+50%
 I said Bear is coming!!!!
 Non-numbers are not allowed.
 Line position is ignored.
 
-00:00:46.000 --> 00:01:00.500 L:+5
+00:00:46.000 --> 00:01:00.500 line:+5
 I said Bear is coming!!!!
 Plus sign is not allowed.
 Line position is ignored.
 
 3
-00:01:01.000 --> 00:01:30.000 L:10%0%
+00:01:01.000 --> 00:01:30.000 line:10%0%
 I said Bear is coming now!!!!
 Doesn't parse into a percentage.
 Line position is ignored.
 
-00:01:31.000 --> 00:02:00.500 L:-10l
+00:01:31.000 --> 00:02:00.500 line:-10l
 I said Bear is coming now!!!!
 Doesn't parse into a number.
 Line position is ignored.
index dc62407..82f7e2a 100644 (file)
@@ -2,36 +2,36 @@ WEBVTT
 Cues with valid vertical line positioning values.
 
 1
-00:00:00.000 --> 00:00:15.000 L:0%
+00:00:00.000 --> 00:00:15.000 line:0%
 Bear is Coming!!!!!
 Positioning on the top of the viewport, in the middle.
 
-00:00:15.500 --> 00:00:30.500 L:0
+00:00:15.500 --> 00:00:30.500 line:0
 Bear is Coming!!!!!
 This is line 0.
 Positioning on the top of the viewport, in the middle.
 
 2
-00:00:31.000 --> 00:00:45.500 L:50%
+00:00:31.000 --> 00:00:45.500 line:50%
 I said Bear is coming!!!!
 Positioning on the center of the video.
 
 
-00:00:46.000 --> 00:01:00.500 L:5
+00:00:46.000 --> 00:01:00.500 line:5
 I said Bear is coming!!!!
 This is line 6 from the top of the video viewport.
 
 3
-00:01:01.000 --> 00:01:30.000 L:100%
+00:01:01.000 --> 00:01:30.000 line:100%
 I said Bear is coming now!!!!
 Positioning on the bottom middle.
 
-00:01:31.000 --> 00:02:00.500 L:-1
+00:01:31.000 --> 00:02:00.500 line:-1
 I said Bear is coming now!!!!
 This is the first line at the bottom of the video viewport.
 Positioning on the bottom middle. Only 1 line shows.
 
-00:02:01.000 --> 00:02:30.000 L:500
+00:02:01.000 --> 00:02:30.000 line:500
 I said Bear is coming now!!!!
 This is legal,
-even though the line will likely not be within the video viewport.
\ No newline at end of file
+even though the line will likely not be within the video viewport.
index 629843f..b196f13 100644 (file)
@@ -2,19 +2,19 @@ WEBVTT
 One or more of line/text positioning and alignment values are invalid (settings are ignored).
 
 1
-00:00:00.000 --> 00:00:30.500  T: 0% A: start L: 0%
+00:00:00.000 --> 00:00:30.500  position: 0% align: start line: 0%
 Bear is Coming!!!!!
 None of the cue settings will be applied, just the default.
 
 2
-00:00:31.000 --> 00:00:01.500 T:0% A:end L:-30%
+00:00:31.000 --> 00:00:01.500 position:0% align:end line:-30%
 I said Bear is coming!!!!
 The line position setting is ignored.
 No text is visible though because it's off-screen at position
 0 and the last character is at position 0%.
 
 3
-00:01:01.000 --> 00:01:30.000 L:-3 A:middler T:60%
+00:01:01.000 --> 00:01:30.000 line:-3 align:middler position:60%
 I said Bear is coming now!!!!
 Positioning on line 3 from the viewport bottom, middle aligned,
 with middle character of cue at 60% width.
index c25450d..dd3a6de 100644 (file)
@@ -2,27 +2,27 @@ WEBVTT
 Cues with valid alignment, line and text position settings.
 
 1
-00:00:00.000 --> 00:00:15.000  T:10% A:start L:0%
+00:00:00.000 --> 00:00:15.000  position:10% align:start line:0%
 Bear is Coming!!!!!
 Positioning on the top of the viewport at 10% horizontally,
 start aligned.
 
-00:00:15.500 --> 00:00:30.500 L:0 A:start
+00:00:15.500 --> 00:00:30.500 line:0 align:start
 Bear is Coming!!!!!
 This is line 0, middle aligned, first character at 50% width.
 
 2
-00:00:31.000 --> 00:00:45.500 T:80% L:80%
+00:00:31.000 --> 00:00:45.500 position:80% line:80%
 I said Bear is coming!!!!
 Middle aligned, middle of cue's character is at 80% width and 80% height.
 
-00:00:46.000 --> 00:01:00.500 L:5 A:end T:30%
+00:00:46.000 --> 00:01:00.500 line:5 align:end position:30%
 I said Bear is coming!!!!
 This is line 6 from the top of the video viewport,
 end aligned with last character at 30% of viewport width.
 
 3
-00:01:01.000 --> 00:01:30.000 L:-3 A:middle T:60%
+00:01:01.000 --> 00:01:30.000 line:-3 align:middle position:60%
 I said Bear is coming now!!!!
 Positioning on line 3 from the viewport bottom, middle aligned,
 with middle character of cue at 60% width.
index 46ac794..700600d 100644 (file)
@@ -2,16 +2,16 @@ WEBVTT
 Invalid cue sizes (all settings are ignored).
 
 1
-00:00:00.000 --> 00:00:30.500 S:       50%
+00:00:00.000 --> 00:00:30.500 size:    50%
 Bear is Coming!!!!!
 Cue size setting doesn't parse and is ignored.
 
 2
-00:00:31.000 --> 00:01:00.500 S:-10%
+00:00:31.000 --> 00:01:00.500 size:-10%
 I said Bear is coming!!!!
 Negative cue size setting is not acceptable and is ignored.
 
 3
-00:01:01.000 --> 00:02:00.500 S:4000%
+00:01:01.000 --> 00:02:00.500 size:4000%
 I said Bear is coming now!!!!
 Cue size beyond 100% is not acceptable and is ignored.
index 57f96e8..017d59a 100644 (file)
@@ -2,18 +2,18 @@ WEBVTT
 Valid cue size values.
 
 1
-00:00:00.000 --> 00:00:30.500 S:100%
+00:00:00.000 --> 00:00:30.500 size:100%
 Bear is Coming!!!!!
 Box for the cue is 100% of the video viewport width,
 exemplified through background color,
 even if the text needs less.
 
 2
-00:00:31.000 --> 00:01:00.500 S:10%
+00:00:31.000 --> 00:01:00.500 size:10%
 I said Bear is coming!!!!
 Box for the cue is 10% of the video viewport width, which will mean that automatic line wrapping will happen.
 
 3
-00:01:01.000 --> 00:02:00.500 S:0%
+00:01:01.000 --> 00:02:00.500 size:0%
 I said Bear is coming now!!!!
 Cue text box size of 0 is acceptable, even if not visible.
index 58639d8..5e4a61a 100644 (file)
@@ -2,17 +2,17 @@ WEBVTT
 Either size or alignment are invalid.
 
 1
-00:00:00.000 --> 00:00:30.500 S:100% A:@start
+00:00:00.000 --> 00:00:30.500 size:100% align:@start
 Bear is Coming!!!!!
 Box for the cue is 100% of the video viewport width, alignment is ignored.
 
 2
-00:00:31.000 --> 00:01:00.500 S:-10% A:end
+00:00:31.000 --> 00:01:00.500 size:-10% align:end
 I said Bear is coming!!!!
 Box for the cue is as big as the text, no line wrapping,
 (except if viewport is too small) and end aligned.
 
 3
-00:01:01.000 --> 00:02:00.500 S:110% A:@middle
+00:01:01.000 --> 00:02:00.500 size:110% align:@end
 I said Bear is coming now!!!!
-Both cue size and alignment are ignored.
\ No newline at end of file
+Both cue size and alignment are ignored.
index b0b93a4..6d36536 100644 (file)
@@ -2,18 +2,18 @@ WEBVTT
 Valid cue size with alignment settings.
 
 1
-00:00:00.000 --> 00:00:30.500 S:100% A:start
+00:00:00.000 --> 00:00:30.500 size:100% align:start
 Bear is Coming!!!!!
 Box for the cue is 100% of the video viewport width
 and because of the start align, all text is left aligned on the video viewport.
 
 2
-00:00:31.000 --> 00:01:00.500 S:10% A:end
+00:00:31.000 --> 00:01:00.500 size:10% align:end
 I said Bear is coming!!!!
 Box for the cue is 10% of the video viewport width, which will mean that automatic line wrapping will happen
 and the text is aligned to the end.
 
 3
-00:01:01.000 --> 00:02:00.500 S:0% A:middle
+00:01:01.000 --> 00:02:00.500 size:0% align:middle
 I said Bear is coming now!!!!
 Cue text box size of 0 is acceptable, even if not visible.
index 427041d..8e7b3b7 100644 (file)
@@ -2,16 +2,16 @@ WEBVTT
 Invalid vertical direction settings (all settings are ignored).
 
 1
-00:00:00.000 --> 00:00:30.500 D:#vertical
+00:00:00.000 --> 00:00:30.500 vertical:#vertical
 Bear is Coming!!!!!
 Normal rendering - direction setting is ignored.
 
 2
-00:00:31.000 --> 00:01:00.500 D:verticallr
+00:00:31.000 --> 00:01:00.500 vertical:verticallr
 I said Bear is coming!!!!
 Normal rendering - direction setting is ignored.
 
 3
-00:01:01.000 --> 00:02:00.500 D:vertical-rl
+00:01:01.000 --> 00:02:00.500 vertical:vertical-rl
 I said Bear is coming now!!!!
 Normal rendering - direction setting is ignored.
index f8427b9..7483836 100644 (file)
@@ -2,19 +2,19 @@ WEBVTT
 Valid vertical direction settings.
 
 1
-00:00:00.000 --> 00:00:30.500 D:vertical
+00:00:00.000 --> 00:00:30.500 vertical:rl
 الدب قادم!!!!!
 يجعل على الجانب الأيمن من المعاينة الفيديو والمتوسطة الانحياز ،
 أسفل إلى أعلى، وتزايد اليسار.
 
 2
-00:00:31.000 --> 00:01:00.500 D:vertical-lr
+00:00:31.000 --> 00:01:00.500 vertical:lr
 قلت الدب قادم!!
 يجعل على الجانب الأيسر من المعاينة الفيديو والمتوسطة الانحياز ،
 أسفل إلى أعلى، وتنامي اليمين.
 
 3
-00:01:01.000 --> 00:02:00.500 D:vertical A:start T:0%
+00:01:01.000 --> 00:02:00.500 vertical:rl align:start position:0%
 قلت الدب قادم الآن!!
 يجعل على الجانب الأيمن من المعاينة الفيديو ، على حد سواء أسفل محاذاة
 لمربع جديلة والنص داخل النص ، من أسفل إلى أعلى، وتزايد اليسار.
index 4f8db68..f757a36 100644 (file)
@@ -2,19 +2,19 @@ WEBVTT
 Valid vertical direction settings.
 
 1
-00:00:00.000 --> 00:00:30.500 D:vertical
+00:00:00.000 --> 00:00:30.500 vertical:rl
 Bear is Coming!!!!!
 Renders on the right side of the video viewport, middle aligned,
 top to bottom, growing left.
 
 2
-00:00:31.000 --> 00:01:00.500 D:vertical-lr
+00:00:31.000 --> 00:01:00.500 vertical:lr
 I said Bear is coming!!!!
 Renders on the left side of the video viewport, middle aligned,
 top to bottom, growing right.
 
 3
-00:01:01.000 --> 00:02:00.500 D:vertical A:start T:0%
+00:01:01.000 --> 00:02:00.500 vertical:rl align:start position:0%
 I said Bear is coming now!!!!
 Renders on the right side of the video viewport, top aligned both
 for the cue box and the text within, text from top to bottom, growing left.
index e56ccef..6cb6702 100644 (file)
@@ -2,19 +2,19 @@ WEBVTT
 Invalid use of &, <, and > characters.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 This cue has an amp & character.
 Ampersand is ignored.
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 This cue has a less than < character.
 It turns everything from there on into an annotation
 for an empty tag and ends only at the next &gt; or &amp; character.
 
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 This cue has a greater than > character.
 Since it's not related to a &lt; character,
 it's just interpreted as text.
index 0789214..79558e5 100644 (file)
@@ -2,13 +2,13 @@ WEBVTT
 Cue content with escape characters for &, <, and >.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 This cue has an amp &amp; character.
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 This cue has a less than &lt; character.
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 This cue has a greater than &gt; character.
index d45ac5b..4ff7add 100644 (file)
@@ -2,21 +2,21 @@ WEBVTT
 Cue text has invalid markup of <b>, <i>, <u>, <rt> and <ruby>.  Has a bad effect on the remainder of the cue.
 
 1
-00:00:00.000 --> 00:00:15.000 A:start T:20%
+00:00:00.000 --> 00:00:15.000 align:start position:20%
 The following bear starts bold but end is broken:
 <b>Bear</ b> is Coming!!!!!
 
-00:00:15.500 --> 00:00:30.500 A:start T:20%
+00:00:15.500 --> 00:00:30.500 align:start position:20%
 The following bear is not in italics but the markup is removed:
 < i>Bear</i> is Coming!!!!!
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 The following bear is not underlined and markup is removed:
 I said < u >Bear</u> is coming!!!!
 
 3
-00:01:01.000 --> 00:01:30.000 A:start T:20%
+00:01:01.000 --> 00:01:30.000 align:start position:20%
 The following bear is not ruby annotated and markup is removed:
 I said <ru by>Bear<rt>bear with me</rt></ruby> is coming!!!!
 
index f1a3f78..252a599 100644 (file)
@@ -2,21 +2,21 @@ WEBVTT
 Cues with <b>, <i>, <u>, <rt> and <ruby> tags (all valid).
 
 1
-00:00:00.000 --> 00:00:15.000 A:start T:20%
+00:00:00.000 --> 00:00:15.000 align:start position:20%
 The following bear is bold:
 <b>Bear</b> is Coming!!!!!
 
-00:00:15.500 --> 00:00:30.500 A:start T:20%
+00:00:15.500 --> 00:00:30.500 align:start position:20%
 The following bear is in italics and has a class of "larger":
 <i.larger>Bear</i> is Coming!!!!!
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 The following bear is underlined even though the element has a blank:
 I said <u >Bear</u> is coming!!!!
 
 3
-00:01:01.000 --> 00:01:30.000 A:start T:20%
+00:01:01.000 --> 00:01:30.000 align:start position:20%
 The following bear is ruby annotated:
 I said <ruby>Bear<rt>bear with me</rt></ruby> is coming!!!!
 
index afb8831..4479cdb 100644 (file)
@@ -2,16 +2,16 @@ WEBVTT
 Invalid <timestamp> markup.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 This <00:00:05.000>cue <00:00:10.000>is <00:00:12.000>painted <00:00:08.000>on.
 But since the last two timestamps are out of order, they are ignored.
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 I <00:00:20.000>said <00:00:22.000>Bear <00:00:24.000>is <00:00:26.000>coming!!!!
 All of these timestamps are before the start of the cue, so get ignored.
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 I <00:02:05.000>said <00:02:10.000>Bear <00:02:15.000>is <00:02:20.000>coming <00:02:25.000>now!!!!
 All of these timestamps are after the end of the cue, so get ignored.
index 526974b..17d464b 100644 (file)
@@ -2,13 +2,13 @@ WEBVTT
 Paint-on text in cues with <timestamp> markup.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 This <00:00:05.000>cue <00:00:10.000>is <00:00:15.000>painted <00:00:20.000>on.
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 I <00:00:35.000>said <00:00:40.000>Bear <00:00:45.000>is <00:00:50.000>coming!!!!
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
-I <00:01:05.000>said <00:01:10.000>Bear <00:01:15.000>is <00:01:20.000>coming <00:01:25.000>now!!!!
\ No newline at end of file
+00:01:01.000 --> 00:02:00.500 align:start position:20%
+I <00:01:05.000>said <00:01:10.000>Bear <00:01:15.000>is <00:01:20.000>coming <00:01:25.000>now!!!!
index 84369a1..650ea2c 100644 (file)
@@ -2,16 +2,16 @@ WEBVTT
 Invalid <c> class markup.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 <c .black>Bear is Coming!!!!!</c>
 The space signified an annotation start.
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 <c.red&large>I said Bear is coming!!!!</c>
 Probably should only allow characters that CSS allows in class names.
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 I said <c.9red.upper+case>Bear is coming now</c>!!!!
 Probably should only allow characters that CSS allows in class names.
index 832a03d..ea3ef62 100644 (file)
@@ -2,13 +2,13 @@ WEBVTT
 Cue text fragment with <c> class markup is mapped to HTML <span> element with CSS classes.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 <c.black>Bear is Coming!!!!!</c>
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 <c.green>I said Bear is coming!!!!</c>
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 I said <c.red.uppercase>Bear is coming now</c>!!!!
index 68ca5c8..12ffdeb 100644 (file)
@@ -2,16 +2,16 @@ WEBVTT
 Invalid <v> voice markup.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 < v Speaker>Bear is Coming!!!!!</v>
 This is two annotations for an empty tag.
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 <v&Doe Hunter>I said Bear is coming!!!!</v>
 This does not parse as a voice tag.
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 I said <v-Speaker>Bear is coming now</v>!!!!
 This does not parse as a voice tag.
index 3311b11..d6cfc68 100644 (file)
@@ -2,14 +2,14 @@ WEBVTT
 Cue text fragment with <v> voice markup mapped to HTML <q> element with @title for annotation.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 <v.blue Speaker>Bear is Coming!!!!!</v>
 Text span with a class and an annotation.
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 <v Doe Hunter>I said Bear is coming!!!!</v>
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 I said <v.blue Speaker>Bear is coming now</v>!!!!
index 03d0e2b..6deea4a 100644 (file)
@@ -2,10 +2,10 @@ WEBVTT
 Empty cues should be discarded and ignored.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
index 32b7186..b4ea7ea 100644 (file)
@@ -2,12 +2,12 @@ WEBVTT
 Any HTML markup that is not supported should be ignored.
 
 1
-00:00:00.000 --> 00:00:30.500 A:start T:20%
+00:00:00.000 --> 00:00:30.500 align:start position:20%
 <h1>Bear is Coming!!!!!</h1>
 <p>And what kind of a bear it is - just have <a href="webpage.html">look</a>.</p>
 
 2
-00:00:31.000 --> 00:01:00.500 A:start T:20%
+00:00:31.000 --> 00:01:00.500 align:start position:20%
 <ul>
   <li>I said Bear is coming!!!!</li>
   <li>I said Bear is still coming!!!!</li>
@@ -15,7 +15,7 @@ Any HTML markup that is not supported should be ignored.
 
 
 3
-00:01:01.000 --> 00:02:00.500 A:start T:20%
+00:01:01.000 --> 00:02:00.500 align:start position:20%
 <ol>
   <li>I said Bear is coming now!!!!</li>
   <li><img src="bear.png" alt="mighty bear"></li>
index 42baf44..5a524a4 100644 (file)
@@ -5,38 +5,38 @@ Tests WebVTT settings.
 EXPECTED (cues.length == '4') OK
 EXPECTED (cues[0].line == '100') OK
 EXPECTED (cues[0].position == '50') OK
-EXPECTED (cues[0].align == 'middle') OK
+EXPECTED (cues[0].align == 'start') OK
 EXPECTED (cues[0].vertical == '') OK
-EXPECTED (cues[1].line == '-1') OK
-EXPECTED (cues[1].position == '50') OK
+EXPECTED (cues[1].line == '15') OK
+EXPECTED (cues[1].position == '40') OK
 EXPECTED (cues[1].align == 'middle') OK
-EXPECTED (cues[1].vertical == '') OK
+EXPECTED (cues[1].vertical == 'rl') OK
 EXPECTED (cues[2].line == '-1') OK
-EXPECTED (cues[2].position == '50') OK
+EXPECTED (cues[2].position == '10') OK
 EXPECTED (cues[2].align == 'middle') OK
 EXPECTED (cues[2].vertical == '') OK
-EXPECTED (cues[3].line == '-1') OK
+EXPECTED (cues[3].line == '95') OK
 EXPECTED (cues[3].position == '50') OK
-EXPECTED (cues[3].align == 'middle') OK
-EXPECTED (cues[3].vertical == '') OK
+EXPECTED (cues[3].align == 'end') OK
+EXPECTED (cues[3].vertical == 'lr') OK
 
 *** Testing text track 1
 EXPECTED (cues.length == '4') OK
-EXPECTED (cues[0].line == '100') OK
-EXPECTED (cues[0].position == '50') OK
+EXPECTED (cues[0].line == '43') OK
+EXPECTED (cues[0].position == '10') OK
 EXPECTED (cues[0].align == 'middle') OK
 EXPECTED (cues[0].vertical == '') OK
 EXPECTED (cues[1].line == '-1') OK
 EXPECTED (cues[1].position == '50') OK
-EXPECTED (cues[1].align == 'middle') OK
+EXPECTED (cues[1].align == 'end') OK
 EXPECTED (cues[1].vertical == '') OK
 EXPECTED (cues[2].line == '-1') OK
 EXPECTED (cues[2].position == '50') OK
 EXPECTED (cues[2].align == 'middle') OK
 EXPECTED (cues[2].vertical == '') OK
 EXPECTED (cues[3].line == '-1') OK
-EXPECTED (cues[3].position == '50') OK
+EXPECTED (cues[3].position == '90') OK
 EXPECTED (cues[3].align == 'middle') OK
-EXPECTED (cues[3].vertical == '') OK
+EXPECTED (cues[3].vertical == 'lr') OK
 END OF TEST
 
index 9385607..b4163c2 100644 (file)
             {
                 findMediaElement();
                 var expected = 
-                {
-                    length : 4,
-                    tests:
-                    [
-                        {
-                            property : "line",
-                            values : [100, -1, -1, -1],
-                        },
-                        {
-                            property : "position",
-                            values : [50, 50, 50, 50],
-                        },
-                        {
-                            property : "align",
-                            values : ["middle", "middle", "middle", "middle"],
-                        },
-                        {
-                            property : "vertical",
-                            values : ["", "", "", ""],
-                        },
-                    ],
-                };
-                testCues(i, expected);
+                [
+                    {
+                        length : 4,
+                        tests:
+                        [
+                            {
+                                property : "line",
+                                values : [100, 15, -1, 95],
+                            },
+                            {
+                                property : "position",
+                                values : [50, 40, 10, 50],
+                            },
+                            {
+                                property : "align",
+                                values : ["start", "middle", "middle", "end"],
+                            },
+                            {
+                                property : "vertical",
+                                values : ["", "rl", "", "lr"],
+                            },
+                        ],
+                    },
+                    {
+                        length : 4,
+                        tests:
+                        [
+                            {
+                                property : "line",
+                                values : [43, -1, -1, -1],
+                            },
+                            {
+                                property : "position",
+                                values : [10, 50, 50, 90],
+                            },
+                            {
+                                property : "align",
+                                values : ["middle", "end", "middle", "middle"],
+                            },
+                            {
+                                property : "vertical",
+                                values : ["", "", "", "lr"],
+                            },
+                        ],
+                    }
+                ]
+                testCues(i, expected[i]);
 
                 allTestsEnded();
             }
index ad86d8f..425028c 100644 (file)
@@ -1,3 +1,24 @@
+2012-04-02  Eric Carlson  <eric.carlson@apple.com>
+
+        Renaming parameters for positioning a track cue
+        https://bugs.webkit.org/show_bug.cgi?id=78706
+
+        Change WebVTT settings identifiers for spec change: D: -> vertical:, L: -> line:, 
+        T: -> position:, S: -> size:, A: -> align:
+
+        Reviewed by Sam Weinig.
+
+        No new tests, existing tests updated for spec changes.
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::verticalGrowingLeftKeyword): Drive-by change to improve readability.
+        (WebCore::TextTrackCue::settingName): New, parse the settings keyword.
+        (WebCore::TextTrackCue::parseSettings): Update to match the current spec.
+        * html/track/TextTrackCue.h:
+
+        * html/track/WebVTTParser.h:
+        (WebCore::WebVTTParser::isValidSettingDelimiter): New.
+
 2012-03-29  Sam Weinig  <sam@webkit.org>
 
         Add setting to disable Java for local files even if it is otherwise enabled
index 00ebb21..ba1feef 100644 (file)
@@ -75,8 +75,8 @@ static const String& horizontalKeyword()
 
 static const String& verticalGrowingLeftKeyword()
 {
-    DEFINE_STATIC_LOCAL(const String, vertical, ("rl"));
-    return vertical;
+    DEFINE_STATIC_LOCAL(const String, verticalrl, ("rl"));
+    return verticalrl;
 }
 
 static const String& verticalGrowingRightKeyword()
@@ -85,21 +85,6 @@ static const String& verticalGrowingRightKeyword()
     return verticallr;
 }
 
-// FIXME: remove this once https://bugs.webkit.org/show_bug.cgi?id=78706 has been fixed.
-static const String& verticalKeywordOLD()
-{
-    DEFINE_STATIC_LOCAL(const String, vertical, ("vertical"));
-    return vertical;
-}
-
-// FIXME: remove this once https://bugs.webkit.org/show_bug.cgi?id=78706 has been fixed.
-static const String& verticallrKeywordOLD()
-{
-    DEFINE_STATIC_LOCAL(const String, verticallr, ("vertical-lr"));
-    return verticallr;
-}
-    
-
 TextTrackCue::TextTrackCue(ScriptExecutionContext* context, const String& id, double start, double end, const String& content, const String& settings, bool pauseOnExit)
     : m_id(id)
     , m_startTime(start)
@@ -462,68 +447,119 @@ PassRefPtr<HTMLDivElement> TextTrackCue::getDisplayTree()
     return m_displayTree;
 }
 
+TextTrackCue::CueSetting TextTrackCue::settingName(const String& name)
+{
+    DEFINE_STATIC_LOCAL(const String, verticalKeyword, ("vertical"));
+    DEFINE_STATIC_LOCAL(const String, lineKeyword, ("line"));
+    DEFINE_STATIC_LOCAL(const String, positionKeyword, ("position"));
+    DEFINE_STATIC_LOCAL(const String, sizeKeyword, ("size"));
+    DEFINE_STATIC_LOCAL(const String, alignKeyword, ("align"));
+
+    if (name == verticalKeyword)
+        return Vertical;
+    else if (name == lineKeyword)
+        return Line;
+    else if (name == positionKeyword)
+        return Position;
+    else if (name == sizeKeyword)
+        return Size;
+    else if (name == alignKeyword)
+        return Align;
+
+    return None;
+}
+
 void TextTrackCue::parseSettings(const String& input)
 {
-    // 4.8.10.13.3 Parse the WebVTT settings.
-    // 1 - Initial setup.
     unsigned position = 0;
+
     while (position < input.length()) {
-        // Discard any space characters between or after settings (not in the spec, but we think it should be).
-        while (position < input.length() && WebVTTParser::isASpace(input[position]))
-            position++;
 
-        // 2-4 Settings - get the next character representing a settings.
-        char setting = input[position++];
+        // The WebVTT cue settings part of a WebVTT cue consists of zero or more of the following components, in any order, 
+        // separated from each other by one or more U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characters. 
+        while (position < input.length() && WebVTTParser::isValidSettingDelimiter(input[position]))
+            position++;
         if (position >= input.length())
-            return;
+            break;
 
-        // 5-7 - If the character at position is not ':', set setting to empty string.
-        if (input[position++] != ':')
-            setting = '\0';
+        // When the user agent is to parse the WebVTT settings given by a string input for a text track cue cue, 
+        // the user agent must run the following steps:
+        // 1. Let settings be the result of splitting input on spaces.
+        // 2. For each token setting in the list settings, run the following substeps:
+        //    1. If setting does not contain a U+003A COLON character (:), or if the first U+003A COLON character (:) 
+        //       in setting is either the first or last character of setting, then jump to the step labeled next setting.
+        unsigned endOfSetting = position;
+        String setting = WebVTTParser::collectWord(input, &endOfSetting);
+        CueSetting name;
+        size_t colonOffset = setting.find(':', 1);
+        if (colonOffset == notFound || colonOffset == 0 || colonOffset == setting.length() - 1)
+            goto NextSetting;
+
+        // 2. Let name be the leading substring of setting up to and excluding the first U+003A COLON character (:) in that string.
+        name = settingName(setting.substring(0, colonOffset));
+
+        // 3. Let value be the trailing substring of setting starting from the character immediately after the first U+003A COLON character (:) in that string.
+        position += colonOffset + 1;
         if (position >= input.length())
-            return;
+            break;
 
-        // 8 - Gather settings based on value of setting.
-        switch (setting) {
-        case 'D':
+        // 4. Run the appropriate substeps that apply for the value of name, as follows:
+        switch (name) {
+        case Vertical:
             {
-            // 1-3 - Collect the next word and set the writing direction accordingly.
+            // If name is a case-sensitive match for "vertical"
+            // 1. If value is a case-sensitive match for the string "rl", then let cue's text track cue writing direction 
+            //    be vertical growing left.
             String writingDirection = WebVTTParser::collectWord(input, &position);
-            if (writingDirection == verticalKeywordOLD())
+            if (writingDirection == verticalGrowingLeftKeyword())
                 m_writingDirection = VerticalGrowingLeft;
-            else if (writingDirection == verticallrKeywordOLD())
+            
+            // 2. Otherwise, if value is a case-sensitive match for the string "lr", then let cue's text track cue writing 
+            //    direction be vertical growing right.
+            else if (writingDirection == verticalGrowingRightKeyword())
                 m_writingDirection = VerticalGrowingRight;
             }
             break;
-        case 'L':
+        case Line:
             {
             // 1-2 - Collect chars that are either '-', '%', or a digit.
+            // 1. If value contains any characters other than U+002D HYPHEN-MINUS characters (-), U+0025 PERCENT SIGN 
+            //    characters (%), and characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump
+            //    to the step labeled next setting.
             StringBuilder linePositionBuilder;
             while (position < input.length() && (input[position] == '-' || input[position] == '%' || isASCIIDigit(input[position])))
                 linePositionBuilder.append(input[position++]);
-            if (position < input.length() && !WebVTTParser::isASpace(input[position]))
-                goto Otherwise;
-            String linePosition = linePositionBuilder.toString();
+            if (position < input.length() && !WebVTTParser::isValidSettingDelimiter(input[position]))
+                break;
 
-            // 3-5 - If there is not at least one digit character,
-            //       a '-' occurs anywhere other than the front, or
-            //       a '%' occurs anywhere other than the end, then
-            //       ignore this setting and keep looking.
+            // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT 
+            //    NINE (9), then jump to the step labeled next setting.
+            // 3. If any character in value other than the first character is a U+002D HYPHEN-MINUS character (-), then 
+            //    jump to the step labeled next setting.
+            // 4. If any character in value other than the last character is a U+0025 PERCENT SIGN character (%), then
+            //    jump to the step labeled next setting.
+            String linePosition = linePositionBuilder.toString();
             if (linePosition.find('-', 1) != notFound || linePosition.reverseFind("%", linePosition.length() - 2) != notFound)
                 break;
 
-            // 6 - If the first char is a '-' and the last char is a '%', ignore and keep looking.
+            // 5. If the first character in value is a U+002D HYPHEN-MINUS character (-) and the last character in value is a 
+            //    U+0025 PERCENT SIGN character (%), then jump to the step labeled next setting.
             if (linePosition[0] == '-' && linePosition[linePosition.length() - 1] == '%')
                 break;
 
-            // 7 - Interpret as number (toInt ignores trailing non-digit characters,
-            //     such as a possible '%').
+            // 6. Ignoring the trailing percent sign, if any, interpret value as a (potentially signed) integer, and 
+            //    let number be that number. 
+            // NOTE: toInt ignores trailing non-digit characters, such as '%'.
             bool validNumber;
             int number = linePosition.toInt(&validNumber);
             if (!validNumber)
                 break;
 
-            // 8 - If the last char is a '%' and the value is not between 0 and 100, ignore and keep looking.
+            // 7. If the last character in value is a U+0025 PERCENT SIGN character (%), but number is not in the range 
+            //    0 ≤ number ≤ 100, then jump to the step labeled next setting.
+            // 8. Let cue's text track cue line position be number.
+            // 9. If the last character in value is a U+0025 PERCENT SIGN character (%), then let cue's text track cue 
+            //    snap-to-lines flag be false. Otherwise, let it be true.
             if (linePosition[linePosition.length() - 1] == '%') {
                 if (number < 0 || number > 100)
                     break;
@@ -532,29 +568,33 @@ void TextTrackCue::parseSettings(const String& input)
                 m_snapToLines = false;
             }
 
-            // 9 - Set cue line position to the number found.
             m_linePosition = number;
             }
             break;
-        case 'T':
+        case Position:
             {
-            // 1-2 - Collect characters that are digits.
+            // 1. If value contains any characters other than U+0025 PERCENT SIGN characters (%) and characters in the range 
+            //    U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump to the step labeled next setting.
+            // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9),
+            //    then jump to the step labeled next setting.
             String textPosition = WebVTTParser::collectDigits(input, &position);
+            if (textPosition.isEmpty())
+                break;
             if (position >= input.length())
                 break;
 
-            // 3 - Character at end must be '%', otherwise ignore and keep looking.
+            // 3. If any character in value other than the last character is a U+0025 PERCENT SIGN character (%), then jump
+            //    to the step labeled next setting.
+            // 4. If the last character in value is not a U+0025 PERCENT SIGN character (%), then jump to the step labeled
+            //    next setting.
             if (input[position++] != '%')
-                goto Otherwise;
-
-            // 4-6 - Ensure no other chars in this setting and setting is not empty.
-            if (position < input.length() && !WebVTTParser::isASpace(input[position]))
-                goto Otherwise;
-            if (textPosition.isEmpty())
+                break;
+            if (position < input.length() && !WebVTTParser::isValidSettingDelimiter(input[position]))
                 break;
 
-            // 7-8 - Interpret as number and make sure it is between 0 and 100
-            // (toInt ignores trailing non-digit characters, such as a possible '%').
+            // 5. Ignoring the trailing percent sign, interpret value as an integer, and let number be that number.
+            // 6. If number is not in the range 0 ≤ number ≤ 100, then jump to the step labeled next setting.
+            // NOTE: toInt ignores trailing non-digit characters, such as '%'.
             bool validNumber;
             int number = textPosition.toInt(&validNumber);
             if (!validNumber)
@@ -562,28 +602,33 @@ void TextTrackCue::parseSettings(const String& input)
             if (number < 0 || number > 100)
               break;
 
-            // 9 - Set cue text position to the number found.
+            // 7. Let cue's text track cue text position be number.
             m_textPosition = number;
             }
             break;
-        case 'S':
+        case Size:
             {
-            // 1-2 - Collect characters that are digits.
+            // 1. If value contains any characters other than U+0025 PERCENT SIGN characters (%) and characters in the
+            //    range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump to the step labeled next setting.
+            // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT 
+            //    NINE (9), then jump to the step labeled next setting.
             String cueSize = WebVTTParser::collectDigits(input, &position);
+            if (cueSize.isEmpty())
+                break;
             if (position >= input.length())
                 break;
 
-            // 3 - Character at end must be '%', otherwise ignore and keep looking.
+            // 3. If any character in value other than the last character is a U+0025 PERCENT SIGN character (%),
+            //    then jump to the step labeled next setting.
+            // 4. If the last character in value is not a U+0025 PERCENT SIGN character (%), then jump to the step
+            //    labeled next setting.
             if (input[position++] != '%')
-                goto Otherwise;
-
-            // 4-6 - Ensure no other chars in this setting and setting is not empty.
-            if (position < input.length() && !WebVTTParser::isASpace(input[position]))
-                goto Otherwise;
-            if (cueSize.isEmpty())
+                break;
+            if (position < input.length() && !WebVTTParser::isValidSettingDelimiter(input[position]))
                 break;
 
-            // 7-8 - Interpret as number and make sure it is between 0 and 100.
+            // 5. Ignoring the trailing percent sign, interpret value as an integer, and let number be that number.
+            // 6. If number is not in the range 0 ≤ number ≤ 100, then jump to the step labeled next setting.
             bool validNumber;
             int number = cueSize.toInt(&validNumber);
             if (!validNumber)
@@ -591,29 +636,33 @@ void TextTrackCue::parseSettings(const String& input)
             if (number < 0 || number > 100)
                 break;
 
-            // 9 - Set cue size to the number found.
+            // 7. Let cue's text track cue size be number.
             m_cueSize = number;
             }
             break;
-        case 'A':
+        case Align:
             {
-            // 1-4 - Collect the next word and set the cue alignment accordingly.
             String cueAlignment = WebVTTParser::collectWord(input, &position);
+
+            // 1. If value is a case-sensitive match for the string "start", then let cue's text track cue alignment be start alignment.
             if (cueAlignment == startKeyword())
                 m_cueAlignment = Start;
+
+            // 2. If value is a case-sensitive match for the string "middle", then let cue's text track cue alignment be middle alignment.
             else if (cueAlignment == middleKeyword())
                 m_cueAlignment = Middle;
+
+            // 3. If value is a case-sensitive match for the string "end", then let cue's text track cue alignment be end alignment.
             else if (cueAlignment == endKeyword())
                 m_cueAlignment = End;
             }
             break;
+        case None:
+            break;
         }
 
-        continue;
-
-Otherwise:
-        // Collect a sequence of characters that are not space characters and discard them.
-        WebVTTParser::collectWord(input, &position);
+NextSetting:
+        position = endOfSetting;
     }
 }
 
index 401132d..c681d07 100644 (file)
@@ -128,6 +128,9 @@ private:
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
 
+    enum CueSetting { None, Vertical, Line, Position, Size, Align };
+    CueSetting settingName(const String&);
+
     String m_id;
     double m_startTime;
     double m_endTime;
index 4e1dc04..65e1363 100644 (file)
@@ -80,6 +80,12 @@ public:
         // WebVTT space characters are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN    (CR).
         return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r';
     }
+    static inline bool isValidSettingDelimiter(char c)
+    {
+        // ... a WebVTT cue consists of zero or more of the following components, in any order, separated from each other by one or more 
+        // U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characters.
+        return c == ' ' || c == '\t';
+    }
     static String collectDigits(const String&, unsigned*);
     static String collectWord(const String&, unsigned*);