Title: [139562] trunk
Revision
139562
Author
[email protected]
Date
2013-01-13 04:25:21 -0800 (Sun, 13 Jan 2013)

Log Message

Styling disappears from the cue that's being styled by ::cue pseudo element
https://bugs.webkit.org/show_bug.cgi?id=106723

Patch by Dima Gorbik <[email protected]> on 2013-01-13
Reviewed by Antti Koivisto.

Source/WebCore:

Fixes a regression caused by r138966. Setting a pseudoId in TextTrackCue::updateDisplayTree for m_allDocumentNodes
was triggering recalculating styles the next run loop. Now when this was removed we append the WebVTT tree after its children have
been marked by markFutureAndPastNodes so that correct styles are set within this append call.

Test: media/track/track-css-cue-lifetime.html

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::markFutureAndPastNodes): changing the type of the first argument because DocumentFragment is not a subclass
of Element.
(WebCore::TextTrackCue::updateDisplayTree): appending the WebVTT rendering tree after its children have been marked properly.
* html/track/TextTrackCue.h:
(TextTrackCue):

LayoutTests:

* media/track/captions-webvtt/styling-lifetime.vtt: Added.
* media/track/track-css-cue-lifetime-expected.txt: Added.
* media/track/track-css-cue-lifetime.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139561 => 139562)


--- trunk/LayoutTests/ChangeLog	2013-01-13 09:46:21 UTC (rev 139561)
+++ trunk/LayoutTests/ChangeLog	2013-01-13 12:25:21 UTC (rev 139562)
@@ -1,3 +1,14 @@
+2013-01-13  Dima Gorbik  <[email protected]>
+
+        Styling disappears from the cue that's being styled by ::cue pseudo element
+        https://bugs.webkit.org/show_bug.cgi?id=106723
+
+        Reviewed by Antti Koivisto.
+
+        * media/track/captions-webvtt/styling-lifetime.vtt: Added.
+        * media/track/track-css-cue-lifetime-expected.txt: Added.
+        * media/track/track-css-cue-lifetime.html: Added.
+
 2013-01-13  Csaba Osztrogonác  <[email protected]>
 
         Unreviewed gardening, skip new failing tests to paint the bots green.

Added: trunk/LayoutTests/media/track/captions-webvtt/styling-lifetime.vtt (0 => 139562)


--- trunk/LayoutTests/media/track/captions-webvtt/styling-lifetime.vtt	                        (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/styling-lifetime.vtt	2013-01-13 12:25:21 UTC (rev 139562)
@@ -0,0 +1,5 @@
+WEBVTT
+
+1
+00:00.500 --> 00:03.000
+<c.red>dolor sit </c><c.green>amet, consectetur </c><c.red2>adipiscing elit</c>

Added: trunk/LayoutTests/media/track/track-css-cue-lifetime-expected.txt (0 => 139562)


--- trunk/LayoutTests/media/track/track-css-cue-lifetime-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-css-cue-lifetime-expected.txt	2013-01-13 12:25:21 UTC (rev 139562)
@@ -0,0 +1,146 @@
+Test that the cue is styled properly throughout its lifetime.
+EVENT(canplaythrough)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+1
+RUN(video.currentTime = 0.7)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+2
+RUN(video.currentTime = 0.8)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+3
+RUN(video.currentTime = 0.9)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+4
+RUN(video.currentTime = 1)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+5
+RUN(video.currentTime = 1.1)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+6
+RUN(video.currentTime = 1.2000000000000002)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+7
+RUN(video.currentTime = 1.3)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+8
+RUN(video.currentTime = 1.4)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+9
+RUN(video.currentTime = 1.5)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+10
+RUN(video.currentTime = 1.6)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+11
+RUN(video.currentTime = 1.7000000000000002)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+12
+RUN(video.currentTime = 1.8000000000000003)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+13
+RUN(video.currentTime = 1.9)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+14
+RUN(video.currentTime = 2)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+15
+RUN(video.currentTime = 2.1)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+16
+RUN(video.currentTime = 2.2)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+17
+RUN(video.currentTime = 2.3000000000000003)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+18
+RUN(video.currentTime = 2.4)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+19
+RUN(video.currentTime = 2.5)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+20
+RUN(video.currentTime = 2.6)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+21
+RUN(video.currentTime = 2.7)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+22
+RUN(video.currentTime = 2.8000000000000003)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+23
+RUN(video.currentTime = 2.9000000000000004)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/track/track-css-cue-lifetime.html (0 => 139562)


--- trunk/LayoutTests/media/track/track-css-cue-lifetime.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-css-cue-lifetime.html	2013-01-13 12:25:21 UTC (rev 139562)
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+        <script src=""
+        <script src=""
+        <script src=""
+
+        <style>
+        video::cue(.red, .red2) { color:red }
+        video::cue(.green) { color:green }
+        </style>
+
+        <script>
+
+        var cueNode;
+        var seekedCount = 0;
+        var step = 0.1;
+        var initialTime = 0.6;
+        var endTime = 3.0
+
+        function skipNonElements(root)
+        {
+            nextElementSibling = root;
+            while (nextElementSibling.nodeType != 1) {
+                nextElementSibling = nextElementSibling.nextSibling;
+            }
+            return nextElementSibling;
+        }
+
+        function seeked()
+        {
+            if (testEnded)
+                return;
+
+            cueNode = skipNonElements(textTrackDisplayElement(video, 'all-nodes').firstChild);
+            skipNonElements(cueNode);
+            testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
+            cueNode = skipNonElements(cueNode.nextSibling);
+            testExpected("getComputedStyle(cueNode).color", "rgb(0, 128, 0)");
+            cueNode = skipNonElements(cueNode.nextSibling);
+            testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
+
+            if (++seekedCount * step + initialTime > endTime)
+                endTest();
+            else {
+                consoleWrite("" + seekedCount);
+                run("video.currentTime = " + (initialTime + seekedCount * step));
+            }
+        }
+
+        function loaded()
+        {
+            consoleWrite("Test that the cue is styled properly throughout its lifetime.");
+            findMediaElement();
+            video.src = "" '../content/test');
+            video.id = "testvideo";
+            waitForEvent('seeked', seeked);
+            waitForEvent('canplaythrough', function() { video.currentTime = initialTime; });
+        }
+
+        </script>
+    </head>
+    <body _onload_="loaded()">
+        <video controls >
+            <track src="" kind="captions" default>
+        </video>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (139561 => 139562)


--- trunk/Source/WebCore/ChangeLog	2013-01-13 09:46:21 UTC (rev 139561)
+++ trunk/Source/WebCore/ChangeLog	2013-01-13 12:25:21 UTC (rev 139562)
@@ -1,3 +1,23 @@
+2013-01-13  Dima Gorbik  <[email protected]>
+
+        Styling disappears from the cue that's being styled by ::cue pseudo element
+        https://bugs.webkit.org/show_bug.cgi?id=106723
+
+        Reviewed by Antti Koivisto.
+
+        Fixes a regression caused by r138966. Setting a pseudoId in TextTrackCue::updateDisplayTree for m_allDocumentNodes
+        was triggering recalculating styles the next run loop. Now when this was removed we append the WebVTT tree after its children have
+        been marked by markFutureAndPastNodes so that correct styles are set within this append call.
+
+        Test: media/track/track-css-cue-lifetime.html
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCue::markFutureAndPastNodes): changing the type of the first argument because DocumentFragment is not a subclass
+        of Element.
+        (WebCore::TextTrackCue::updateDisplayTree): appending the WebVTT rendering tree after its children have been marked properly.
+        * html/track/TextTrackCue.h:
+        (TextTrackCue):
+
 2013-01-12  David Grogan  <[email protected]>
 
         IndexedDB: Provide LevelDB with IDBEnv instead of Env::Default

Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (139561 => 139562)


--- trunk/Source/WebCore/html/track/TextTrackCue.cpp	2013-01-13 09:46:21 UTC (rev 139561)
+++ trunk/Source/WebCore/html/track/TextTrackCue.cpp	2013-01-13 12:25:21 UTC (rev 139562)
@@ -658,7 +658,7 @@
     m_computedLinePosition = calculateComputedLinePosition();
 }
     
-void TextTrackCue::markFutureAndPastNodes(Element* root, double previousTimestamp, double movieTime)
+void TextTrackCue::markFutureAndPastNodes(Node* root, double previousTimestamp, double movieTime)
 {
     DEFINE_STATIC_LOCAL(const String, timestampTag, (ASCIILiteral("timestamp")));
     
@@ -700,9 +700,8 @@
 
     // Update the two sets containing past and future WebVTT objects.
     RefPtr<DocumentFragment> referenceTree = getCueAsHTML();
-
+    markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime);
     m_allDocumentNodes->appendChild(referenceTree);
-    markFutureAndPastNodes(m_allDocumentNodes.get(), startTime(), movieTime);
 }
 
 PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree()

Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (139561 => 139562)


--- trunk/Source/WebCore/html/track/TextTrackCue.h	2013-01-13 09:46:21 UTC (rev 139561)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h	2013-01-13 12:25:21 UTC (rev 139562)
@@ -135,7 +135,7 @@
     PassRefPtr<TextTrackCueBox> getDisplayTree();
     void updateDisplayTree(float);
     void removeDisplayTree();
-    void markFutureAndPastNodes(Element*, double, double);
+    void markFutureAndPastNodes(Node*, double, double);
 
     int calculateComputedLinePosition();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to