<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[146128] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/146128">146128</a></dd>
<dt>Author</dt> <dd>vcarbune@chromium.org</dd>
<dt>Date</dt> <dd>2013-03-18 15:02:45 -0700 (Mon, 18 Mar 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Determine text direction for rendering a TextTrackCue
https://bugs.webkit.org/show_bug.cgi?id=79749

Reviewed by Levi Weintraub.

Source/WebCore:

The rendering rules for WebVTT cues are slightly different
depending on the directionality determined from the characters
of the cue text. This patch implements the preliminary step
to be able to take directionality into account.

It iterates through the cue characters and setting the CSS
directionality to the one of the first strong directional character.

Test: media/track/track-cue-rendering-rtl.html

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCueBox::applyCSSProperties): Applies the determined
direction.
(WebCore::TextTrackCue::TextTrackCue): Sets the default value for the
display direction.
(WebCore::isCueParagraphSeparator): Tests for explicit unicode characters
that are paragraph separators.
(WebCore):
(WebCore::TextTrackCue::determineTextDirection): Determined the direction
by the first strong directional character found.
(WebCore::TextTrackCue::calculateDisplayParameters): Updated.
(WebCore::TextTrackCue::getCSSWritingDirection): Return the determined CSS
writing direction.
* html/track/TextTrackCue.h:
(TextTrackCue):

LayoutTests:

* media/track/captions-webvtt/captions-rtl.vtt: Added.
* media/track/track-cue-rendering-rtl-expected.txt: Added.
* media/track/track-cue-rendering-rtl.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTextTrackCuecpp">trunk/Source/WebCore/html/track/TextTrackCue.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackTextTrackCueh">trunk/Source/WebCore/html/track/TextTrackCue.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediatrackcaptionswebvttcaptionsrtlvtt">trunk/LayoutTests/media/track/captions-webvtt/captions-rtl.vtt</a></li>
<li><a href="#trunkLayoutTestsmediatracktrackcuerenderingrtlexpectedtxt">trunk/LayoutTests/media/track/track-cue-rendering-rtl-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediatracktrackcuerenderingrtlhtml">trunk/LayoutTests/media/track/track-cue-rendering-rtl.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (146127 => 146128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-03-18 21:43:19 UTC (rev 146127)
+++ trunk/LayoutTests/ChangeLog        2013-03-18 22:02:45 UTC (rev 146128)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2013-03-18  Victor Carbune  &lt;vcarbune@chromium.org&gt;
+
+        Determine text direction for rendering a TextTrackCue
+        https://bugs.webkit.org/show_bug.cgi?id=79749
+
+        Reviewed by Levi Weintraub.
+
+        * media/track/captions-webvtt/captions-rtl.vtt: Added.
+        * media/track/track-cue-rendering-rtl-expected.txt: Added.
+        * media/track/track-cue-rendering-rtl.html: Added.
+
</ins><span class="cx"> 2013-03-18  Kenneth Russell  &lt;kbr@google.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed gardening. Marked flaky tests, removed obsolete
</span></span></pre></div>
<a id="trunkLayoutTestsmediatrackcaptionswebvttcaptionsrtlvtt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/track/captions-webvtt/captions-rtl.vtt (0 => 146128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/track/captions-webvtt/captions-rtl.vtt                                (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/captions-rtl.vtt        2013-03-18 22:02:45 UTC (rev 146128)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+WEBVTT
+Examples of RTL (odd-numbered ids) and LTR cues (even-numbered ids).
+
+1
+00:00:00.000 --&gt; 00:00:00.500
+تجربة
+
+2
+00:00:00.500 --&gt; 00:00:01.000
+        1234
+
+3
+00:00:01.000 --&gt; 00:00:01.500
+تجربة
+LTR new line, but cue should be RTL
+
+4
+00:00:01.500 --&gt; 00:00:02.000
+LTR cue تجربة
+
+5
+00:00:02.000 --&gt; 00:00:02.500
+;1234تجربة
+
+6
+00:00:02.500 --&gt; 00:00:03.000
+        ०१२३४५६७८९          
</ins></span></pre></div>
<a id="trunkLayoutTestsmediatracktrackcuerenderingrtlexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/track/track-cue-rendering-rtl-expected.txt (0 => 146128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/track/track-cue-rendering-rtl-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-rendering-rtl-expected.txt        2013-03-18 22:02:45 UTC (rev 146128)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+Test that directionality is set correctly on cues.
+
+** RTL cues alternate with LTR cues **
+EVENT(canplaythrough)
+EVENT(seeked)
+
+** Jump to next cue **
+EXPECTED (video.currentTime == '0.25') OK
+EXPECTED (testTrack.track.activeCues.length == '1') OK
+EXPECTED (testTrack.track.activeCues[0].text == 'تجربة') OK
+EXPECTED (testCueDisplayBox.innerText == 'تجربة') OK
+
+** The position should be default and CSS direction set to rtl **
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
+EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'rtl') OK
+
+RUN(video.currentTime = 0.75)
+EVENT(seeked)
+
+** Jump to next cue **
+EXPECTED (video.currentTime == '0.75') OK
+EXPECTED (testTrack.track.activeCues.length == '1') OK
+EXPECTED (testTrack.track.activeCues[0].text == '        1234') OK
+EXPECTED (testCueDisplayBox.innerText == '        1234') OK
+
+** The position should be default and CSS direction set to ltr **
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
+EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'ltr') OK
+
+RUN(video.currentTime = 1.25)
+EVENT(seeked)
+
+** Jump to next cue **
+EXPECTED (video.currentTime == '1.25') OK
+EXPECTED (testTrack.track.activeCues.length == '1') OK
+EXPECTED (testTrack.track.activeCues[0].text == 'تجربة LTR new line, but cue should be RTL') OK
+EXPECTED (testCueDisplayBox.innerText == 'تجربة LTR new line, but cue should be RTL') OK
+
+** The position should be default and CSS direction set to rtl **
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
+EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'rtl') OK
+
+RUN(video.currentTime = 1.75)
+EVENT(seeked)
+
+** Jump to next cue **
+EXPECTED (video.currentTime == '1.75') OK
+EXPECTED (testTrack.track.activeCues.length == '1') OK
+EXPECTED (testTrack.track.activeCues[0].text == 'LTR cue تجربة') OK
+EXPECTED (testCueDisplayBox.innerText == 'LTR cue تجربة') OK
+
+** The position should be default and CSS direction set to ltr **
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
+EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'ltr') OK
+
+RUN(video.currentTime = 2.25)
+EVENT(seeked)
+
+** Jump to next cue **
+EXPECTED (video.currentTime == '2.25') OK
+EXPECTED (testTrack.track.activeCues.length == '1') OK
+EXPECTED (testTrack.track.activeCues[0].text == ';1234تجربة') OK
+EXPECTED (testCueDisplayBox.innerText == ';1234تجربة') OK
+
+** The position should be default and CSS direction set to rtl **
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
+EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'rtl') OK
+
+RUN(video.currentTime = 2.75)
+EVENT(seeked)
+
+** Jump to next cue **
+EXPECTED (video.currentTime == '2.75') OK
+EXPECTED (testTrack.track.activeCues.length == '1') OK
+EXPECTED (testTrack.track.activeCues[0].text == '        ०१२३४५६७८९ ') OK
+EXPECTED (testCueDisplayBox.innerText == '        ०१२३४५६७८९ ') OK
+
+** The position should be default and CSS direction set to ltr **
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
+EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'ltr') OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediatracktrackcuerenderingrtlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/track/track-cue-rendering-rtl.html (0 => 146128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/track/track-cue-rendering-rtl.html                                (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-rendering-rtl.html        2013-03-18 22:02:45 UTC (rev 146128)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
+
+        &lt;script src=../media-file.js&gt;&lt;/script&gt;
+        &lt;script src=../video-test.js&gt;&lt;/script&gt;
+        &lt;script src=../media-controls.js&gt;&lt;/script&gt;
+
+        &lt;script&gt;
+
+        var testTrack;
+        var testCueDisplayBox;
+        var seekedCount = 0;
+        var direction;
+
+        var info = [&quot;تجربة&quot;,
+                    &quot;\t1234&quot;,
+                    &quot;تجربة\nLTR new line, but cue should be RTL&quot;,
+                    &quot;LTR cue تجربة&quot;,
+                    &quot;;1234تجربة&quot;,
+                    &quot;\t०१२३४५६७८९  \t&quot;];
+
+        function testCueStyle()
+        {
+            endTest();
+        }
+
+        function seeked()
+        {
+            testCueDisplayBox = textTrackDisplayElement(video, 'display');
+
+            consoleWrite(&quot;&quot;);
+            consoleWrite(&quot;** Jump to next cue **&quot;);
+            testExpected(&quot;video.currentTime&quot;, (seekedCount / 2) + .25);
+            testExpected(&quot;testTrack.track.activeCues.length&quot;, 1);
+            testExpected(&quot;testTrack.track.activeCues[0].text&quot;, info[seekedCount]);
+            testExpected(&quot;testCueDisplayBox.innerText&quot;, info[seekedCount]);
+
+            direction = seekedCount % 2 ? &quot;ltr&quot; : &quot;rtl&quot;;
+
+            consoleWrite(&quot;&quot;);
+            consoleWrite(&quot;** The position should be default and CSS direction set to &quot; + direction + &quot; **&quot;);
+            testExpected(&quot;2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth&quot;, true);
+
+            testExpected(&quot;getComputedStyle(testCueDisplayBox).direction&quot;, direction);
+
+            if (++seekedCount == info.length)
+                endTest();
+            else {
+                consoleWrite(&quot;&quot;);
+                run(&quot;video.currentTime = &quot; + (video.currentTime + .5));
+                return;
+            }
+        }
+
+        function loaded()
+        {
+            consoleWrite(&quot;Test that directionality is set correctly on cues.&quot;);
+            testTrack = document.querySelector('track');
+
+            findMediaElement();
+            video.src = findMediaFile('video', '../content/test');
+
+            consoleWrite(&quot;&quot;);
+            consoleWrite(&quot;** RTL cues alternate with LTR cues **&quot;);
+            waitForEvent('seeked', seeked);
+            waitForEvent('canplaythrough', function() { video.currentTime = .25; });
+        }
+        &lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body onload=&quot;loaded()&quot;&gt;
+        &lt;video controls &gt;
+            &lt;track src=&quot;captions-webvtt/captions-rtl.vtt&quot; kind=&quot;captions&quot; default&gt;
+        &lt;/video&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (146127 => 146128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-03-18 21:43:19 UTC (rev 146127)
+++ trunk/Source/WebCore/ChangeLog        2013-03-18 22:02:45 UTC (rev 146128)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2013-03-18  Victor Carbune  &lt;vcarbune@chromium.org&gt;
+
+        Determine text direction for rendering a TextTrackCue
+        https://bugs.webkit.org/show_bug.cgi?id=79749
+
+        Reviewed by Levi Weintraub.
+
+        The rendering rules for WebVTT cues are slightly different
+        depending on the directionality determined from the characters
+        of the cue text. This patch implements the preliminary step
+        to be able to take directionality into account.
+
+        It iterates through the cue characters and setting the CSS
+        directionality to the one of the first strong directional character.
+
+        Test: media/track/track-cue-rendering-rtl.html
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCueBox::applyCSSProperties): Applies the determined
+        direction.
+        (WebCore::TextTrackCue::TextTrackCue): Sets the default value for the
+        display direction.
+        (WebCore::isCueParagraphSeparator): Tests for explicit unicode characters
+        that are paragraph separators.
+        (WebCore):
+        (WebCore::TextTrackCue::determineTextDirection): Determined the direction
+        by the first strong directional character found.
+        (WebCore::TextTrackCue::calculateDisplayParameters): Updated.
+        (WebCore::TextTrackCue::getCSSWritingDirection): Return the determined CSS
+        writing direction.
+        * html/track/TextTrackCue.h:
+        (TextTrackCue):
+
</ins><span class="cx"> 2013-03-18  Hans Wennborg  &lt;hans@chromium.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix GridTrackSize::operator==
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTextTrackCuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (146127 => 146128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TextTrackCue.cpp        2013-03-18 21:43:19 UTC (rev 146127)
+++ trunk/Source/WebCore/html/track/TextTrackCue.cpp        2013-03-18 22:02:45 UTC (rev 146128)
</span><span class="lines">@@ -119,9 +119,8 @@
</span><span class="cx">     //  the 'unicode-bidi' property must be set to 'plaintext'
</span><span class="cx">     setInlineStyleProperty(CSSPropertyUnicodeBidi, CSSValueWebkitPlaintext);
</span><span class="cx"> 
</span><del>-    // FIXME: Determine the text direction using the BIDI algorithm. http://wkb.ug/79749
</del><span class="cx">     // the 'direction' property must be set to direction
</span><del>-    setInlineStyleProperty(CSSPropertyDirection, CSSValueLtr);
</del><ins>+    setInlineStyleProperty(CSSPropertyDirection, m_cue-&gt;getCSSWritingDirection());
</ins><span class="cx"> 
</span><span class="cx">     // the 'writing-mode' property must be set to writing-mode
</span><span class="cx">     setInlineStyleProperty(CSSPropertyWebkitWritingMode, m_cue-&gt;getCSSWritingMode(), false);
</span><span class="lines">@@ -204,6 +203,7 @@
</span><span class="cx">     , m_snapToLines(true)
</span><span class="cx">     , m_cueBackgroundBox(HTMLDivElement::create(toDocument(context)))
</span><span class="cx">     , m_displayTreeShouldChange(true)
</span><ins>+    , m_displayDirection(CSSValueLtr)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_scriptExecutionContext-&gt;isDocument());
</span><span class="cx"> 
</span><span class="lines">@@ -584,11 +584,58 @@
</span><span class="cx">     return n;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool isCueParagraphSeparator(UChar character)
+{
+    // Within a cue, paragraph boundaries are only denoted by Type B characters,
+    // such as U+000A LINE FEED (LF), U+0085 NEXT LINE (NEL), and U+2029 PARAGRAPH SEPARATOR.
+    return WTF::Unicode::category(character) &amp; WTF::Unicode::Separator_Paragraph;
+}
+
+void TextTrackCue::determineTextDirection()
+{
+    DEFINE_STATIC_LOCAL(const String, rtTag, (ASCIILiteral(&quot;rt&quot;)));
+    createWebVTTNodeTree();
+
+    // Apply the Unicode Bidirectional Algorithm's Paragraph Level steps to the
+    // concatenation of the values of each WebVTT Text Object in nodes, in a
+    // pre-order, depth-first traversal, excluding WebVTT Ruby Text Objects and
+    // their descendants.
+    StringBuilder paragraphBuilder;
+    for (Node* node = m_webVTTNodeTree-&gt;firstChild(); node; node = NodeTraversal::next(node, m_webVTTNodeTree.get())) {
+        if (!node-&gt;isTextNode() || node-&gt;localName() == rtTag)
+            continue;
+
+        paragraphBuilder.append(node-&gt;nodeValue());
+    }
+
+    String paragraph = paragraphBuilder.toString();
+    if (!paragraph.length())
+        return;
+
+    for (size_t i = 0; i &lt; paragraph.length(); ++i) {
+        UChar current = paragraph[i];
+        if (!current || isCueParagraphSeparator(current))
+            return;
+
+        if (UChar current = paragraph[i]) {
+            WTF::Unicode::Direction charDirection = WTF::Unicode::direction(current);
+            if (charDirection == WTF::Unicode::LeftToRight) {
+                m_displayDirection = CSSValueLtr;
+                return;
+            }
+            if (charDirection == WTF::Unicode::RightToLeft
+                || charDirection == WTF::Unicode::RightToLeftArabic) {
+                m_displayDirection = CSSValueRtl;
+                return;
+            }
+        }
+    }
+}
+
</ins><span class="cx"> void TextTrackCue::calculateDisplayParameters()
</span><span class="cx"> {
</span><del>-    // FIXME(BUG 79749): Determine the text direction using the BIDI algorithm.
</del><span class="cx">     // Steps 10.2, 10.3
</span><del>-    m_displayDirection = CSSValueLtr;
</del><ins>+    determineTextDirection();
</ins><span class="cx"> 
</span><span class="cx">     // 10.4 If the text track cue writing direction is horizontal, then let
</span><span class="cx">     // block-flow be 'tb'. Otherwise, if the text track cue writing direction is
</span><span class="lines">@@ -1028,6 +1075,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+int TextTrackCue::getCSSWritingDirection() const
+{
+    return m_displayDirection;
+}
+
</ins><span class="cx"> int TextTrackCue::getCSSWritingMode() const
</span><span class="cx"> {
</span><span class="cx">     return m_displayWritingMode;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackTextTrackCueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (146127 => 146128)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/TextTrackCue.h        2013-03-18 21:43:19 UTC (rev 146127)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h        2013-03-18 22:02:45 UTC (rev 146128)
</span><span class="lines">@@ -151,7 +151,9 @@
</span><span class="cx">     virtual ScriptExecutionContext* scriptExecutionContext() const;
</span><span class="cx"> 
</span><span class="cx">     std::pair&lt;double, double&gt; getCSSPosition() const;
</span><ins>+
</ins><span class="cx">     int getCSSSize() const;
</span><ins>+    int getCSSWritingDirection() const;
</ins><span class="cx">     int getCSSWritingMode() const;
</span><span class="cx"> 
</span><span class="cx">     enum WritingDirection {
</span><span class="lines">@@ -202,6 +204,7 @@
</span><span class="cx">     std::pair&lt;double, double&gt; getPositionCoordinates() const;
</span><span class="cx">     void parseSettings(const String&amp;);
</span><span class="cx"> 
</span><ins>+    void determineTextDirection();
</ins><span class="cx">     void calculateDisplayParameters();
</span><span class="cx"> 
</span><span class="cx">     void cueWillChange();
</span></span></pre>
</div>
</div>

</body>
</html>