Title: [114760] trunk
Revision
114760
Author
commit-qu...@webkit.org
Date
2012-04-20 10:46:09 -0700 (Fri, 20 Apr 2012)

Log Message

Ensure text is centered for default captions
https://bugs.webkit.org/show_bug.cgi?id=84450

Patch by Victor Carbune <vcarb...@adobe.com> on 2012-04-20
Reviewed by Eric Carlson.

Source/WebCore:

Updated existing test.

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::getDisplayTree): Added default width.

LayoutTests:

Updated test to cover default positioning of captions.

* media/track/track-cue-rendering-expected.txt: Updated.
* media/track/track-cue-rendering.html: Updated.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (114759 => 114760)


--- trunk/LayoutTests/ChangeLog	2012-04-20 17:31:00 UTC (rev 114759)
+++ trunk/LayoutTests/ChangeLog	2012-04-20 17:46:09 UTC (rev 114760)
@@ -1,3 +1,15 @@
+2012-04-20  Victor Carbune  <vcarb...@adobe.com>
+
+        Ensure text is centered for default captions
+        https://bugs.webkit.org/show_bug.cgi?id=84450
+
+        Reviewed by Eric Carlson.
+
+        Updated test to cover default positioning of captions.
+
+        * media/track/track-cue-rendering-expected.txt: Updated.
+        * media/track/track-cue-rendering.html: Updated.
+
 2012-04-20  Dominik Röttsches  <dominik.rottsc...@linux.intel.com>
 
         [EFL][DRT] Gardening SVG tests and timeouts

Modified: trunk/LayoutTests/media/track/track-cue-rendering-expected.txt (114759 => 114760)


--- trunk/LayoutTests/media/track/track-cue-rendering-expected.txt	2012-04-20 17:31:00 UTC (rev 114759)
+++ trunk/LayoutTests/media/track/track-cue-rendering-expected.txt	2012-04-20 17:46:09 UTC (rev 114760)
@@ -1,31 +1,35 @@
-Test that TextTrack's cues are rendered correctly.
+Test that default positioned TextTrack's cues are rendered correctly.
 EVENT(canplaythrough)
 EVENT(seeked)
 EXPECTED (video.currentTime == '0.5') OK
 EXPECTED (testTrack.track.activeCues.length == '1') OK
 EXPECTED (testTrack.track.activeCues[0].text == 'Lorem') OK
-EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'Lorem') OK
+EXPECTED (testCueDisplayBox.innerText == 'Lorem') OK
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
 
 RUN(video.currentTime = 1.5)
 EVENT(seeked)
 EXPECTED (video.currentTime == '1.5') OK
 EXPECTED (testTrack.track.activeCues.length == '1') OK
 EXPECTED (testTrack.track.activeCues[0].text == 'ipsum') OK
-EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'ipsum') OK
+EXPECTED (testCueDisplayBox.innerText == 'ipsum') OK
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
 
 RUN(video.currentTime = 2.5)
 EVENT(seeked)
 EXPECTED (video.currentTime == '2.5') OK
 EXPECTED (testTrack.track.activeCues.length == '1') OK
 EXPECTED (testTrack.track.activeCues[0].text == 'dolor') OK
-EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'dolor') OK
+EXPECTED (testCueDisplayBox.innerText == 'dolor') OK
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
 
 RUN(video.currentTime = 3.5)
 EVENT(seeked)
 EXPECTED (video.currentTime == '3.5') OK
 EXPECTED (testTrack.track.activeCues.length == '1') OK
 EXPECTED (testTrack.track.activeCues[0].text == 'sit') OK
-EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'sit') OK
+EXPECTED (testCueDisplayBox.innerText == 'sit') OK
+EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
 
 Test the cue display colors and font.
 RUN(video.width = 320)

Modified: trunk/LayoutTests/media/track/track-cue-rendering.html (114759 => 114760)


--- trunk/LayoutTests/media/track/track-cue-rendering.html	2012-04-20 17:31:00 UTC (rev 114759)
+++ trunk/LayoutTests/media/track/track-cue-rendering.html	2012-04-20 17:46:09 UTC (rev 114760)
@@ -10,6 +10,7 @@
         <script>            
 
         var testTrack;
+        var testCueDisplayBox;
         var seekedCount = 0;
         var info = [ "Lorem", "ipsum", "dolor", "sit" ];
 
@@ -49,8 +50,11 @@
             testExpected("video.currentTime", seekedCount + .5);
             testExpected("testTrack.track.activeCues.length", 1);
             testExpected("testTrack.track.activeCues[0].text", info[seekedCount]);
-            testExpected("textTrackDisplayElement(video, 'display').innerText", info[seekedCount]);
 
+            testCueDisplayBox = textTrackDisplayElement(video, 'display');
+            testExpected("testCueDisplayBox.innerText", info[seekedCount]);
+            testExpected("2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth", true)
+
             if (++seekedCount == info.length)
                 testCueStyle();
             else {
@@ -62,7 +66,7 @@
 
         function loaded()
         {
-            consoleWrite("Test that TextTrack's cues are rendered correctly.");
+            consoleWrite("Test that default positioned TextTrack's cues are rendered correctly.");
             findMediaElement();
             testTrack = document.querySelector('track');
             video.src = "" '../content/test');

Modified: trunk/Source/WebCore/ChangeLog (114759 => 114760)


--- trunk/Source/WebCore/ChangeLog	2012-04-20 17:31:00 UTC (rev 114759)
+++ trunk/Source/WebCore/ChangeLog	2012-04-20 17:46:09 UTC (rev 114760)
@@ -1,3 +1,15 @@
+2012-04-20  Victor Carbune  <vcarb...@adobe.com>
+
+        Ensure text is centered for default captions
+        https://bugs.webkit.org/show_bug.cgi?id=84450
+
+        Reviewed by Eric Carlson.
+
+        Updated existing test.
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCue::getDisplayTree): Added default width.
+
 2012-04-20  Pavel Feldman  <pfeld...@chromium.org>
 
         Web Inspector: open file dialog is not centered.

Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (114759 => 114760)


--- trunk/Source/WebCore/html/track/TextTrackCue.cpp	2012-04-20 17:31:00 UTC (rev 114759)
+++ trunk/Source/WebCore/html/track/TextTrackCue.cpp	2012-04-20 17:46:09 UTC (rev 114760)
@@ -569,6 +569,11 @@
     // but if there is a particularly long word, it does not overflow as it
     // normally would in CSS, it is instead forcibly wrapped at the box's edge.)
 
+    // FIXME(BUG 79916): CSS width property should be set to 'size vw', when the
+    // maximum cue size computation is corrected in the specification.
+    if (m_snapToLines)
+        m_displayTree->setInlineStyleProperty(CSSPropertyWidth, (double) m_cueSize, CSSPrimitiveValue::CSS_PERCENTAGE);
+
     // FIXME(BUG 79750, 79751): Steps 10.12 - 10.14
 
     if (!m_snapToLines) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to