Diff
Modified: trunk/LayoutTests/ChangeLog (140706 => 140707)
--- trunk/LayoutTests/ChangeLog 2013-01-24 20:18:49 UTC (rev 140706)
+++ trunk/LayoutTests/ChangeLog 2013-01-24 20:24:56 UTC (rev 140707)
@@ -1,3 +1,14 @@
+2013-01-24 Dima Gorbik <dgor...@apple.com>
+
+ Implement :past pseudo class for the WebVTT ::cue pseudo element
+ https://bugs.webkit.org/show_bug.cgi?id=105482
+
+ Reviewed by Eric Carlson.
+
+ * media/track/captions-webvtt/styling-timestamps.vtt: Added.
+ * media/track/track-css-matching-timestamps-expected.txt: Added.
+ * media/track/track-css-matching-timestamps.html: Added.
+
2013-01-24 Max Vujovic <mvujo...@adobe.com>
[CSS Filters] CSS opacity property clips filter outsets
Added: trunk/LayoutTests/media/track/captions-webvtt/styling-timestamps.vtt (0 => 140707)
--- trunk/LayoutTests/media/track/captions-webvtt/styling-timestamps.vtt (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/styling-timestamps.vtt 2013-01-24 20:24:56 UTC (rev 140707)
@@ -0,0 +1,5 @@
+WEBVTT
+
+1
+00:00.000 --> 00:01.000
+<00:00.200><c>One</c><00:00.400><c> two</c><c><00:00.600><c><c> three</c><00:00.800><c> five</c> four</c></c>
Added: trunk/LayoutTests/media/track/track-css-matching-timestamps-expected.txt (0 => 140707)
--- trunk/LayoutTests/media/track/track-css-matching-timestamps-expected.txt (rev 0)
+++ trunk/LayoutTests/media/track/track-css-matching-timestamps-expected.txt 2013-01-24 20:24:56 UTC (rev 140707)
@@ -0,0 +1,42 @@
+Test that cues are being matched properly by :past and :future pseudo classes.
+EVENT(canplaythrough)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+
+RUN(video.currentTime = 0.3)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+
+RUN(video.currentTime = 0.5)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+
+RUN(video.currentTime = 0.7)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(128, 128, 128)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+
+RUN(video.currentTime = 0.9)
+EVENT(seeked)
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+EXPECTED (getComputedStyle(cueNode).color == 'rgb(0, 255, 0)') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/track/track-css-matching-timestamps.html (0 => 140707)
--- trunk/LayoutTests/media/track/track-css-matching-timestamps.html (rev 0)
+++ trunk/LayoutTests/media/track/track-css-matching-timestamps.html 2013-01-24 20:24:56 UTC (rev 140707)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <script src=""
+ <script src=""
+ <script src=""
+
+ <style>
+ video::cue {color: green}
+ video::cue(:past) {color: lime}
+ video::cue(:future) {color: gray}
+ </style>
+
+ <script>
+
+ var cueNode;
+ var seekedCount = 0;
+ var seekTimes = [0.1, 0.3, 0.5, 0.7, 0.9];
+
+ var info = [["rgb(128, 128, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)"],
+ ["rgb(0, 255, 0)", "rgb(128, 128, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)"],
+ ["rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(128, 128, 128)", "rgb(128, 128, 128)", "rgb(128, 128, 128)"],
+ ["rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(128, 128, 128)", "rgb(0, 255, 0)"],
+ ["rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)"]];
+
+ function seeked()
+ {
+ if (testEnded)
+ return;
+
+ cueNode = textTrackDisplayElement(video, 'all-nodes').firstElementChild;
+ testExpected("getComputedStyle(cueNode).color", info[seekedCount][0]);
+ cueNode = cueNode.nextElementSibling;
+ testExpected("getComputedStyle(cueNode).color", info[seekedCount][1]);
+ cueNode = cueNode.nextElementSibling.firstElementChild.firstChild;
+ testExpected("getComputedStyle(cueNode).color", info[seekedCount][2]);
+ cueNode = cueNode.nextElementSibling;
+ testExpected("getComputedStyle(cueNode).color", info[seekedCount][3]);
+ cueNode = cueNode.parentNode;
+ testExpected("getComputedStyle(cueNode).color", info[seekedCount][4]);
+
+ if (++seekedCount == info.length)
+ endTest();
+ else {
+ consoleWrite("");
+ run("video.currentTime = " + seekTimes[seekedCount]);
+ }
+ }
+
+ function loaded()
+ {
+ consoleWrite("Test that cues are being matched properly by :past and :future pseudo classes.");
+ findMediaElement();
+ video.src = "" '../content/test');
+ video.id = "testvideo";
+ waitForEvent('seeked', seeked);
+ waitForEvent('canplaythrough', function() { video.currentTime = seekTimes[0]; });
+ }
+
+ </script>
+ </head>
+ <body _onload_="loaded()">
+ <video controls >
+ <track src="" kind="captions" default>
+ </video>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (140706 => 140707)
--- trunk/Source/WebCore/ChangeLog 2013-01-24 20:18:49 UTC (rev 140706)
+++ trunk/Source/WebCore/ChangeLog 2013-01-24 20:24:56 UTC (rev 140707)
@@ -1,3 +1,24 @@
+2013-01-24 Dima Gorbik <dgor...@apple.com>
+
+ Implement :past pseudo class for the WebVTT ::cue pseudo element
+ https://bugs.webkit.org/show_bug.cgi?id=105482
+
+ Reviewed by Eric Carlson.
+
+ It is good to have a designated pseudo class for this, though same could
+ be achieved by using a combination of ::cue and ::cue(:future).
+ Tests also check that nested timestamps work properly.
+
+ Test: media/track/track-css-matching-timestamps.html
+
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::pseudoId):
+ (WebCore::nameToPseudoTypeMap):
+ (WebCore::CSSSelector::extractPseudoType):
+ * css/CSSSelector.h:
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOne):
+
2013-01-23 Jer Noble <jer.no...@apple.com>
Mac: Avoid using k32BGRAPixelFormat on certain platforms.
Modified: trunk/Source/WebCore/css/CSSSelector.cpp (140706 => 140707)
--- trunk/Source/WebCore/css/CSSSelector.cpp 2013-01-24 20:18:49 UTC (rev 140706)
+++ trunk/Source/WebCore/css/CSSSelector.cpp 2013-01-24 20:24:56 UTC (rev 140707)
@@ -238,6 +238,7 @@
#if ENABLE(VIDEO_TRACK)
case PseudoCue:
case PseudoFutureCue:
+ case PseudoPastCue:
#endif
#if ENABLE(IFRAME_SEAMLESS)
case PseudoSeamlessDocument:
@@ -327,6 +328,7 @@
#if ENABLE(VIDEO_TRACK)
DEFINE_STATIC_LOCAL(AtomicString, cue, ("cue(", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(AtomicString, futureCue, ("future", AtomicString::ConstructFromLiteral));
+ DEFINE_STATIC_LOCAL(AtomicString, pastCue, ("past", AtomicString::ConstructFromLiteral));
#endif
#if ENABLE(IFRAME_SEAMLESS)
DEFINE_STATIC_LOCAL(AtomicString, seamlessDocument, ("-webkit-seamless-document", AtomicString::ConstructFromLiteral));
@@ -409,6 +411,7 @@
#if ENABLE(VIDEO_TRACK)
nameToPseudoType->set(cue.impl(), CSSSelector::PseudoCue);
nameToPseudoType->set(futureCue.impl(), CSSSelector::PseudoFutureCue);
+ nameToPseudoType->set(pastCue.impl(), CSSSelector::PseudoPastCue);
#endif
#if ENABLE(IFRAME_SEAMLESS)
nameToPseudoType->set(seamlessDocument.impl(), CSSSelector::PseudoSeamlessDocument);
@@ -539,6 +542,7 @@
case PseudoOutOfRange:
#if ENABLE(VIDEO_TRACK)
case PseudoFutureCue:
+ case PseudoPastCue:
#endif
break;
case PseudoFirstPage:
Modified: trunk/Source/WebCore/css/CSSSelector.h (140706 => 140707)
--- trunk/Source/WebCore/css/CSSSelector.h 2013-01-24 20:18:49 UTC (rev 140706)
+++ trunk/Source/WebCore/css/CSSSelector.h 2013-01-24 20:24:56 UTC (rev 140707)
@@ -160,6 +160,7 @@
#if ENABLE(VIDEO_TRACK)
PseudoCue,
PseudoFutureCue,
+ PseudoPastCue,
#endif
#if ENABLE(IFRAME_SEAMLESS)
PseudoSeamlessDocument
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (140706 => 140707)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2013-01-24 20:18:49 UTC (rev 140706)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2013-01-24 20:24:56 UTC (rev 140707)
@@ -870,6 +870,8 @@
#if ENABLE(VIDEO_TRACK)
case CSSSelector::PseudoFutureCue:
return (element->isWebVTTElement() && toWebVTTElement(element)->webVTTNodeType() == WebVTTNodeTypeFuture);
+ case CSSSelector::PseudoPastCue:
+ return (element->isWebVTTElement() && toWebVTTElement(element)->webVTTNodeType() == WebVTTNodeTypePast);
#endif
case CSSSelector::PseudoHorizontal: