Title: [139803] trunk
Revision
139803
Author
commit-qu...@webkit.org
Date
2013-01-15 15:49:31 -0800 (Tue, 15 Jan 2013)

Log Message

Implement matching by the voice attribute for WebVTT ::cue pseudo element
https://bugs.webkit.org/show_bug.cgi?id=106762

Patch by Dima Gorbik <dgor...@apple.com> on 2013-01-15
Reviewed by Eric Carlson.

Source/WebCore:

Implemented matching cue WebVTT elements by a voice attribute by adding a WebVTT specific voice attribute.
For DOM trees title attribute is used instead as this is required by specs.

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::copyWebVTTNodeToDOMTree): set a title argument instead of a voice attribute for the DOM tree.
* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::voiceAttributeName):
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::constructTreeFromToken):

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 (139802 => 139803)


--- trunk/LayoutTests/ChangeLog	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/LayoutTests/ChangeLog	2013-01-15 23:49:31 UTC (rev 139803)
@@ -1,3 +1,14 @@
+2013-01-15  Dima Gorbik  <dgor...@apple.com>
+
+        Implement matching by the voice attribute for WebVTT ::cue pseudo element
+        https://bugs.webkit.org/show_bug.cgi?id=106762
+
+        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-15  Levi Weintraub  <le...@chromium.org>
 
         Unreviewed, rolling out r139790.

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


--- trunk/LayoutTests/media/track/captions-webvtt/styling.vtt	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/LayoutTests/media/track/captions-webvtt/styling.vtt	2013-01-15 23:49:31 UTC (rev 139803)
@@ -19,3 +19,8 @@
 testcue
 00:01.200 --> 00:01.400
 <c>Aliquam sollicitudin</c> <v>massa ac magna vulputate dignissim</v> <b>posuere et fermentum</b>
+
+5
+00:01.400 --> 00:01.600
+<v>Aliquam sollicitudin</v> <v Mark>massa ac magna vulputate dignissim</v> <v Nancy>posuere et fermentum</v>
+

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


--- trunk/LayoutTests/media/track/track-css-matching-expected.txt	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/LayoutTests/media/track/track-css-matching-expected.txt	2013-01-15 23:49:31 UTC (rev 139803)
@@ -45,5 +45,14 @@
 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
+
+RUN(video.currentTime = 1.5)
+EVENT(seeked)
+
+
+5. Test that cues are being matched properly by the voice attribute.
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 128, 0)') OK
 END OF TEST
 

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


--- trunk/LayoutTests/media/track/track-css-matching.html	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/LayoutTests/media/track/track-css-matching.html	2013-01-15 23:49:31 UTC (rev 139803)
@@ -10,6 +10,8 @@
         <style>
         video::cue(c) {color: purple}
         video::cue(v) {color: yellow}
+        video::cue(v[voice="Mark"]) {color: red}
+        video::cue(v[voice="Nancy"]) {color: green}
         video::cue(b) {color: lime}
         video::cue(.red, .red2) { color:red }
         #testvideo::cue(.green) { color:green }
@@ -21,19 +23,21 @@
 
         var cueNode;
         var seekedCount = 0;
-        var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3];
+        var seekTimes = [0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5];
 
         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)"],
-                    ["rgb(0, 128, 0)", "rgb(0, 128, 0)", "rgb(0, 128, 0)"]];
+                    ["rgb(0, 128, 0)", "rgb(0, 128, 0)", "rgb(0, 128, 0)"],
+                    ["rgb(255, 255, 0)", "rgb(255, 0, 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."];
+                           "4. Test that cues are being matched properly by id.",
+                           "5. Test that cues are being matched properly by the voice attribute."];
 
         function skipNonElements(root)
         {

Modified: trunk/Source/WebCore/ChangeLog (139802 => 139803)


--- trunk/Source/WebCore/ChangeLog	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/Source/WebCore/ChangeLog	2013-01-15 23:49:31 UTC (rev 139803)
@@ -1,3 +1,19 @@
+2013-01-15  Dima Gorbik  <dgor...@apple.com>
+        Implement matching by the voice attribute for WebVTT ::cue pseudo element
+        https://bugs.webkit.org/show_bug.cgi?id=106762
+
+        Reviewed by Eric Carlson.
+
+        Implemented matching cue WebVTT elements by a voice attribute by adding a WebVTT specific voice attribute.
+        For DOM trees title attribute is used instead as this is required by specs.
+
+        * html/track/TextTrackCue.cpp:
+        (WebCore::TextTrackCue::copyWebVTTNodeToDOMTree): set a title argument instead of a voice attribute for the DOM tree.
+        * html/track/TextTrackCue.h:
+        (WebCore::TextTrackCue::voiceAttributeName):
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::constructTreeFromToken):
+
 2013-01-15  Simon Fraser  <simon.fra...@apple.com>
 
         Some ScrollingCoördinator-related cleanup in RenderLayerBacking

Modified: trunk/Source/WebCore/html/track/TextTrackCue.cpp (139802 => 139803)


--- trunk/Source/WebCore/html/track/TextTrackCue.cpp	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/Source/WebCore/html/track/TextTrackCue.cpp	2013-01-15 23:49:31 UTC (rev 139803)
@@ -495,7 +495,7 @@
         if (node->hasTagName(voiceElementTagName()) || node->hasTagName(classElementTagName())) {
             clonedNode = HTMLSpanElement::create(spanTag, static_cast<Document*>(m_scriptExecutionContext));
             toElement(clonedNode.get())->setAttribute(classAttr, toElement(node)->getAttribute(classAttr));
-            toElement(clonedNode.get())->setAttribute(titleAttr, toElement(node)->getAttribute(titleAttr));
+            toElement(clonedNode.get())->setAttribute(titleAttr, toElement(node)->getAttribute(voiceAttributeName()));
         } else
             clonedNode = node->cloneNode(false);
 

Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (139802 => 139803)


--- trunk/Source/WebCore/html/track/TextTrackCue.h	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h	2013-01-15 23:49:31 UTC (rev 139803)
@@ -89,6 +89,12 @@
         DEFINE_STATIC_LOCAL(QualifiedName, cTag, (nullAtom, "c", nullAtom));
         return cTag;
     }
+    
+    static const QualifiedName& voiceAttributeName()
+    {
+        DEFINE_STATIC_LOCAL(QualifiedName, voiceAttr, (nullAtom, "voice", nullAtom));
+        return voiceAttr;
+    }
 
     virtual ~TextTrackCue();
 

Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (139802 => 139803)


--- trunk/Source/WebCore/html/track/WebVTTParser.cpp	2013-01-15 23:46:18 UTC (rev 139802)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp	2013-01-15 23:49:31 UTC (rev 139803)
@@ -367,7 +367,7 @@
             if (m_token.classes().size() > 0)
                 child->setAttribute(classAttr, AtomicString(m_token.classes().data(), m_token.classes().size()));
             if (child->hasTagName(TextTrackCue::voiceElementTagName()))
-                child->setAttribute(titleAttr, AtomicString(m_token.annotation().data(), m_token.annotation().size()));
+                child->setAttribute(TextTrackCue::voiceAttributeName(), AtomicString(m_token.annotation().data(), m_token.annotation().size()));
             m_currentNode->parserAppendChild(child);
             m_currentNode = child;
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to