Title: [139714] trunk
Revision
139714
Author
[email protected]
Date
2013-01-14 21:22:43 -0800 (Mon, 14 Jan 2013)

Log Message

Implement ID selector matching for the WebVTT ::cue pseudo element
https://bugs.webkit.org/show_bug.cgi?id=105481

Patch by Dima Gorbik <[email protected]> on 2013-01-14
Reviewed by Eric Carlson.

Source/WebCore:

Implemented matching cue WebVTT elements by an identifier. Identifiers of all WebVTT nodes in the rendering tree for
a given cue are set to match the cue identifier.

Existing tests were modified to cover this case.

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::markFutureAndPastNodes):

LayoutTests:

* media/track/captions-webvtt/styling.vtt:
* media/track/track-css-matching-expected.txt:
* media/track/track-css-matching.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139713 => 139714)


--- trunk/LayoutTests/ChangeLog	2013-01-15 05:17:36 UTC (rev 139713)
+++ trunk/LayoutTests/ChangeLog	2013-01-15 05:22:43 UTC (rev 139714)
@@ -1,3 +1,14 @@
+2013-01-14  Dima Gorbik  <[email protected]>
+
+        Implement ID selector matching for the WebVTT ::cue pseudo element
+        https://bugs.webkit.org/show_bug.cgi?id=105481
+
+        Reviewed by Eric Carlson.
+
+        * media/track/captions-webvtt/styling.vtt:
+        * media/track/track-css-matching-expected.txt:
+        * media/track/track-css-matching.html:
+
 2013-01-14  Dominic Cooney   <[email protected]>
 
         [Chromium] Unreviewed gardening.

Modified: trunk/LayoutTests/media/track/captions-webvtt/styling.vtt (139713 => 139714)


--- trunk/LayoutTests/media/track/captions-webvtt/styling.vtt	2013-01-15 05:17:36 UTC (rev 139713)
+++ trunk/LayoutTests/media/track/captions-webvtt/styling.vtt	2013-01-15 05:22:43 UTC (rev 139714)
@@ -15,3 +15,7 @@
 4
 00:01.000 --> 00:01.200
 <c>Aliquam sollicitudin</c> <v>massa ac magna vulputate dignissim</v> <b>posuere et fermentum</b>
+
+testcue
+00:01.200 --> 00:01.400
+<c>Aliquam sollicitudin</c> <v>massa ac magna vulputate dignissim</v> <b>posuere et fermentum</b>

Modified: trunk/LayoutTests/media/track/track-css-matching-expected.txt (139713 => 139714)


--- trunk/LayoutTests/media/track/track-css-matching-expected.txt	2013-01-15 05:17:36 UTC (rev 139713)
+++ trunk/LayoutTests/media/track/track-css-matching-expected.txt	2013-01-15 05:22:43 UTC (rev 139714)
@@ -1,6 +1,8 @@
-1. Test that cues are being matched properly by the class name
 EVENT(canplaythrough)
 EVENT(seeked)
+
+
+1. Test that cues are being matched properly by the class name
 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
@@ -34,5 +36,14 @@
 EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 0, 128)') OK
 EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 255, 0)') OK
 EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+
+RUN(video.currentTime = 1.3)
+EVENT(seeked)
+
+
+4. Test that cues are being matched properly by id.
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
 END OF TEST
 

Modified: trunk/LayoutTests/media/track/track-css-matching.html (139713 => 139714)


--- trunk/LayoutTests/media/track/track-css-matching.html	2013-01-15 05:17:36 UTC (rev 139713)
+++ trunk/LayoutTests/media/track/track-css-matching.html	2013-01-15 05:22:43 UTC (rev 139714)
@@ -13,6 +13,7 @@
         video::cue(b) {color: lime}
         video::cue(.red, .red2) { color:red }
         #testvideo::cue(.green) { color:green }
+        video::cue(#testcue) {color: green}
         video::cue(:future) {color: gray}
         </style>
 
@@ -20,13 +21,20 @@
 
         var cueNode;
         var seekedCount = 0;
+        var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3];
+
         var info = [["rgb(255, 0, 0)", "rgb(0, 128, 0)", "rgb(255, 0, 0)"],
                     ["rgb(128, 0, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)"],
                     ["rgb(128, 0, 128)", "rgb(128, 0, 128)", "rgb(128, 128, 128)"],
                     ["rgb(128, 0, 128)", "rgb(128, 0, 128)", "rgb(128, 0, 128)"],
-                    ["rgb(128, 0, 128)", "rgb(255, 255, 0)", "rgb(0, 255, 0)"]];
-        var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3];
+                    ["rgb(128, 0, 128)", "rgb(255, 255, 0)", "rgb(0, 255, 0)"],
+                    ["rgb(0, 128, 0)", "rgb(0, 128, 0)", "rgb(0, 128, 0)"]];
 
+        var description = ["1. Test that cues are being matched properly by the class name",
+                           "2. Test that cues are being matched properly by the ':future' pseudo class.", "", "",
+                           "3. Test that cues are being matched properly by tag.",
+                           "4. Test that cues are being matched properly by id."];
+
         function skipNonElements(root)
         {
             nextElementSibling = root;
@@ -35,20 +43,15 @@
             }
             return nextElementSibling;
         }
-        
+
         function seeked()
         {
             if (testEnded)
                 return;
 
-            if (seekedCount == 1) {
-                consoleWrite("");
-                consoleWrite("");
-                consoleWrite("2. Test that cues are being matched properly by the ':future' pseudo class.");
-            } else if (seekedCount == 4) {
-                consoleWrite("");
-                consoleWrite("");
-                consoleWrite("3. Test that cues are being matched properly by tag.");
+            if (description[seekedCount] != "") {
+                consoleWrite("<br>");
+                consoleWrite(description[seekedCount]);
             }
 
             cueNode = skipNonElements(textTrackDisplayElement(video, 'all-nodes').firstChild);
@@ -69,7 +72,6 @@
 
         function loaded()
         {
-            consoleWrite("1. Test that cues are being matched properly by the class name");
             findMediaElement();
             video.src = "" '../content/test');
             video.id = "testvideo";

Modified: trunk/Source/WebCore/ChangeLog (139713 => 139714)


--- trunk/Source/WebCore/ChangeLog	2013-01-15 05:17:36 UTC (rev 139713)
+++ trunk/Source/WebCore/ChangeLog	2013-01-15 05:22:43 UTC (rev 139714)
@@ -1,3 +1,18 @@
+2013-01-14  Dima Gorbik  <[email protected]>
+
+        Implement ID selector matching for the WebVTT ::cue pseudo element
+        https://bugs.webkit.org/show_bug.cgi?id=105481
+
+        Reviewed by Eric Carlson.
+
+        Implemented matching cue WebVTT elements by an identifier. Identifiers of all WebVTT nodes in the rendering tree for 
+        a given cue are set to match the cue identifier.
+
+        Existing tests were modified to cover this case.
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCue::markFutureAndPastNodes):
+
 2013-01-14  Mark Pilgrim  <[email protected]>
 
         [Chromium] Use explicit WebKit prefixes in BlobRegistryProxy
@@ -125,7 +140,7 @@
         * rendering/RenderListItem.cpp:
         * rendering/RenderListItem.h:
 
-2013-01-14  Dima Gorbik  <[email protected]>
+2013-01-13  Dima Gorbik  <[email protected]>
 
         Implement element type selectors for the WebVTT ::cue pseudo class
         https://bugs.webkit.org/show_bug.cgi?id=105480

Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (139713 => 139714)


--- trunk/Source/WebCore/html/track/TextTrackCue.cpp	2013-01-15 05:17:36 UTC (rev 139713)
+++ trunk/Source/WebCore/html/track/TextTrackCue.cpp	2013-01-15 05:22:43 UTC (rev 139714)
@@ -694,9 +694,13 @@
             if (currentTimestamp > movieTime)
                 isPastNode = false;
         }
-
-        if (child->isElementNode())
+        
+        if (child->isElementNode()) {
             toElement(child)->setWebVTTNodeType(isPastNode ? WebVTTNodeTypePast : WebVTTNodeTypeFuture);
+            // Make an elemenet id match a cue id for style matching purposes.
+            if (!m_id.isEmpty())
+                toElement(child)->setIdAttribute(AtomicString(m_id.characters(), m_id.length()));
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to