Commit dbc58ddb authored by eric.carlson@apple.com's avatar eric.carlson@apple.com
Browse files

Add ‎ ‏ and   to WebVTT parser

https://bugs.webkit.org/show_bug.cgi?id=85112

Reviewed by Jer Noble.

Source/WebCore:

No new tests, track-webvtt-tc022-entities.html was updated to test this.

* html/track/WebVTTTokenizer.cpp:
(WebCore::WebVTTTokenizer::nextToken): Support RLM, LRM, and NBSP entities.

LayoutTests:

* media/track/captions-webvtt/tc022-entities.vtt:
* media/track/track-webvtt-tc022-entities-expected.txt:
* media/track/track-webvtt-tc022-entities.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6188bb92
2014-01-21 Eric Carlson <eric.carlson@apple.com>
Add &lrm; &rlm; and &nbsp; to WebVTT parser
https://bugs.webkit.org/show_bug.cgi?id=85112
Reviewed by Jer Noble.
* media/track/captions-webvtt/tc022-entities.vtt:
* media/track/track-webvtt-tc022-entities-expected.txt:
* media/track/track-webvtt-tc022-entities.html:
2014-01-21 Mihai Tica <mitica@adobe.com>
 
If you set a tiled cross-faded-image or a tiled gradient as
WEBVTT
Cue content with escape characters for &, <, and >.
Cue content with escape characters for &, <, >, LRM, RLM and non-breaking space.
1
00:00:00.000 --> 00:00:30.500 align:start position:20%
This cue has an amp &amp; character.
This cue has an amp character: &amp;
2
00:00:31.000 --> 00:01:00.500 align:start position:20%
This cue has a less than &lt; character.
This cue has a less than character: &lt;
3
00:01:01.000 --> 00:02:00.500 align:start position:20%
This cue has a greater than &gt; character.
This cue has a greater than character: &gt;
4
00:02:01.000 --> 00:03:00.500 align:start position:20%
This cue has a right-to-left mark (RLM): &rlm;
5
00:03:01.000 --> 00:04:00.500 align:start position:20%
This cue has a left-to-right mark (LRM): &lrm;
6
00:04:01.000 --> 00:05:00.500 align:start position:20%
This cue has a non-breakable space (NBSP): &nbsp;
\ No newline at end of file
......@@ -3,10 +3,13 @@ Tests special characters &, <, and > in the cue text.
*** Testing text track 0
EXPECTED (cues.length == '3') OK
EXPECTED (cues[0].getCueAsHTML().textContent == 'This cue has an amp & character.') OK
EXPECTED (cues[1].getCueAsHTML().textContent == 'This cue has a less than < character.') OK
EXPECTED (cues[2].getCueAsHTML().textContent == 'This cue has a greater than > character.') OK
EXPECTED (cues.length == '6') OK
EXPECTED (cues[0].getCueAsHTML().textContent == 'This cue has an amp character: &') OK
EXPECTED (cues[1].getCueAsHTML().textContent == 'This cue has a less than character: <') OK
EXPECTED (cues[2].getCueAsHTML().textContent == 'This cue has a greater than character: >') OK
EXPECTED (cues[3].getCueAsHTML().textContent == 'This cue has a right-to-left mark (RLM): ') OK
EXPECTED (cues[4].getCueAsHTML().textContent == 'This cue has a left-to-right mark (LRM): ') OK
EXPECTED (cues[5].getCueAsHTML().textContent == 'This cue has a non-breakable space (NBSP):  ') OK
*** Testing text track 1
EXPECTED (cues.length == '3') OK
......
......@@ -24,14 +24,19 @@
findMediaElement();
var expected =
{
length : 3,
length : 6,
tests:
[
{
property : "getCueAsHTML().textContent",
values : ["This cue has an amp & character.",
"This cue has a less than < character.",
"This cue has a greater than > character."],
values : [
"This cue has an amp character: \u0026",
"This cue has a less than character: \u003C",
"This cue has a greater than character: \u003E",
"This cue has a right-to-left mark (RLM): \u200f",
"This cue has a left-to-right mark (LRM): \u200e",
"This cue has a non-breakable space (NBSP): \u00a0"
],
},
],
};
......
2014-01-21 Eric Carlson <eric.carlson@apple.com>
Add &lrm; &rlm; and &nbsp; to WebVTT parser
https://bugs.webkit.org/show_bug.cgi?id=85112
Reviewed by Jer Noble.
No new tests, track-webvtt-tc022-entities.html was updated to test this.
* html/track/WebVTTTokenizer.cpp:
(WebCore::WebVTTTokenizer::nextToken): Support RLM, LRM, and NBSP entities.
2014-01-21 Commit Queue <commit-queue@webkit.org>
 
Unreviewed, rolling out r162354.
......@@ -35,6 +35,7 @@
#include "WebVTTTokenizer.h"
#include "MarkupTokenizerInlines.h"
#include <wtf/unicode/CharacterNames.h>
namespace WebCore {
......@@ -107,6 +108,12 @@ bool WebVTTTokenizer::nextToken(SegmentedString& source, WebVTTToken& token)
bufferCharacter('<');
else if (vectorEqualsString(m_buffer, "&gt"))
bufferCharacter('>');
else if (vectorEqualsString(m_buffer, "&lrm"))
bufferCharacter(leftToRightMark);
else if (vectorEqualsString(m_buffer, "&rlm"))
bufferCharacter(rightToLeftMark);
else if (vectorEqualsString(m_buffer, "&nbsp"))
bufferCharacter(noBreakSpace);
else {
m_buffer.append(static_cast<LChar>(cc));
m_token->appendToCharacter(m_buffer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment