Diff
Modified: trunk/LayoutTests/ChangeLog (136990 => 136991)
--- trunk/LayoutTests/ChangeLog 2012-12-07 23:06:53 UTC (rev 136990)
+++ trunk/LayoutTests/ChangeLog 2012-12-07 23:11:02 UTC (rev 136991)
@@ -1,3 +1,14 @@
+2012-12-07 Dima Gorbik <[email protected]>
+
+ Implement general ::cue pseudo element for the <video>
+ https://bugs.webkit.org/show_bug.cgi?id=104043
+
+ Reviewed by Eric Carlson.
+
+ * media/track/captions-webvtt/styling.vtt: Added.
+ * media/track/track-css-all-cues-expected.txt: Added.
+ * media/track/track-css-all-cues.html: Added.
+
2012-12-07 Kondapally Kalyan <[email protected]>
Fix webgl-depth-texture.html to match the test expectation.
Added: trunk/LayoutTests/media/track/captions-webvtt/styling.vtt (0 => 136991)
--- trunk/LayoutTests/media/track/captions-webvtt/styling.vtt (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/styling.vtt 2012-12-07 23:11:02 UTC (rev 136991)
@@ -0,0 +1,4 @@
+WEBVTT
+
+00:00.000 --> 00:04.000
+Lorum ipsum
\ No newline at end of file
Added: trunk/LayoutTests/media/track/track-css-all-cues-expected.txt (0 => 136991)
--- trunk/LayoutTests/media/track/track-css-all-cues-expected.txt (rev 0)
+++ trunk/LayoutTests/media/track/track-css-all-cues-expected.txt 2012-12-07 23:11:02 UTC (rev 136991)
@@ -0,0 +1,6 @@
+Test that style to all cues is applied correctly.
+EVENT(canplaythrough)
+EVENT(seeked)
+EXPECTED (getComputedStyle(textTrackDisplayElement(video).firstChild).color == 'rgb(255, 0, 0)') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/track/track-css-all-cues.html (0 => 136991)
--- trunk/LayoutTests/media/track/track-css-all-cues.html (rev 0)
+++ trunk/LayoutTests/media/track/track-css-all-cues.html 2012-12-07 23:11:02 UTC (rev 136991)
@@ -0,0 +1,40 @@
+<!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:red }
+
+ </style>
+
+ <script>
+
+ function seeked()
+ {
+ testExpected("getComputedStyle(textTrackDisplayElement(video).firstChild).color", "rgb(255, 0, 0)");
+ endTest();
+ }
+
+ function loaded()
+ {
+ consoleWrite("Test that style to all cues is applied correctly.");
+ findMediaElement();
+ video.src = "" '../content/test');
+ waitForEvent('seeked', seeked);
+ waitForEvent('canplaythrough', function() { video.currentTime = .5; });
+ }
+
+ </script>
+ </head>
+ <body _onload_="loaded()">
+ <video controls >
+ <track src="" kind="captions" default>
+ </video>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (136990 => 136991)
--- trunk/Source/WebCore/ChangeLog 2012-12-07 23:06:53 UTC (rev 136990)
+++ trunk/Source/WebCore/ChangeLog 2012-12-07 23:11:02 UTC (rev 136991)
@@ -1,3 +1,29 @@
+2012-12-07 Dima Gorbik <[email protected]>
+
+ Implement general ::cue pseudo element for the <video>
+ https://bugs.webkit.org/show_bug.cgi?id=104043
+
+ Reviewed by Eric Carlson.
+
+ Implemented the ::cue pseudo element to be able to style all WebVTT cues.
+ Added the subcontainer with a '::cue' pseudoId in between the TextTrackContainerElement and WebVTT nodes to separate
+ user agent default styles from user defined styles for the cue elements.
+
+ Test: media/track/track-css-all-cues.html
+
+ * css/CSSSelector.cpp: ::cue pseudo selector doesn't have a valid prefix but should be allowed in the user-agent stylesheet.
+ (WebCore::CSSSelector::parsePseudoType):
+ * html/shadow/MediaControlElements.cpp:
+ (WebCore):
+ (WebCore::MediaControlTextTrackContainerElement::createSubtrees): create a subcontainer and set its pseudoId to '::cue'.
+ (WebCore::MediaControlTextTrackContainerElement::updateDisplay): append WebVTT nodes to the newly created subcontainer.
+ * html/shadow/MediaControlElements.h:
+ (MediaControlTextTrackContainerElement):
+ * html/shadow/MediaControls.cpp:
+ (WebCore::MediaControls::createTextTrackDisplay): initiate creating subtrees for the MediaControlTextTrackContainerElement.
+ * html/shadow/MediaControlsChromium.cpp:
+ (WebCore::MediaControlsChromium::createTextTrackDisplay):
+
2012-12-06 Geoffrey Garen <[email protected]>
Crash in JSC::Bindings::RootObject::globalObject() sync'ing notes in Evernote
Modified: trunk/Source/WebCore/css/CSSSelector.cpp (136990 => 136991)
--- trunk/Source/WebCore/css/CSSSelector.cpp 2012-12-07 23:06:53 UTC (rev 136990)
+++ trunk/Source/WebCore/css/CSSSelector.cpp 2012-12-07 23:11:02 UTC (rev 136991)
@@ -395,7 +395,7 @@
if (name.startsWith("-webkit-"))
return PseudoWebKitCustomElement;
- if (name.startsWith("x-"))
+ if (name.startsWith("x-") || name.startsWith("cue"))
return PseudoUserAgentCustomElement;
return PseudoUnknown;
Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (136990 => 136991)
--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2012-12-07 23:06:53 UTC (rev 136990)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp 2012-12-07 23:11:02 UTC (rev 136991)
@@ -1192,6 +1192,14 @@
, m_fontSize(0)
{
}
+
+void MediaControlTextTrackContainerElement::createSubtrees(Document* document)
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, cue, ("cue", AtomicString::ConstructFromLiteral));
+ m_cueContainer = HTMLElement::create(spanTag, document);
+ m_cueContainer->setPseudo(cue);
+ appendChild(m_cueContainer, ASSERT_NO_EXCEPTION, false);
+}
PassRefPtr<MediaControlTextTrackContainerElement> MediaControlTextTrackContainerElement::create(Document* document)
{
@@ -1270,7 +1278,7 @@
if (displayBox->hasChildNodes() && !contains(static_cast<Node*>(displayBox.get())))
// Note: the display tree of a cue is removed when the active flag of the cue is unset.
- appendChild(displayBox, ASSERT_NO_EXCEPTION, false);
+ m_cueContainer->appendChild(displayBox, ASSERT_NO_EXCEPTION, false);
}
// 11. Return output.
Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.h (136990 => 136991)
--- trunk/Source/WebCore/html/shadow/MediaControlElements.h 2012-12-07 23:06:53 UTC (rev 136990)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.h 2012-12-07 23:11:02 UTC (rev 136991)
@@ -438,6 +438,7 @@
void updateDisplay();
void updateSizes();
+ void createSubtrees(Document*);
private:
explicit MediaControlTextTrackContainerElement(Document*);
@@ -447,6 +448,7 @@
IntRect m_videoDisplaySize;
float m_fontSize;
+ RefPtr<HTMLElement> m_cueContainer;
};
#endif
Modified: trunk/Source/WebCore/html/shadow/MediaControls.cpp (136990 => 136991)
--- trunk/Source/WebCore/html/shadow/MediaControls.cpp 2012-12-07 23:06:53 UTC (rev 136990)
+++ trunk/Source/WebCore/html/shadow/MediaControls.cpp 2012-12-07 23:11:02 UTC (rev 136991)
@@ -369,7 +369,9 @@
// Insert it before the first controller element so it always displays behind the controls.
ExceptionCode ec;
- insertBefore(textDisplayContainer.release(), m_panel, ec, true);
+ insertBefore(textDisplayContainer, m_panel, ec, true);
+ textDisplayContainer->createSubtrees(document());
+ textDisplayContainer.release();
}
void MediaControls::showTextTrackDisplay()
Modified: trunk/Source/WebCore/html/shadow/MediaControlsChromium.cpp (136990 => 136991)
--- trunk/Source/WebCore/html/shadow/MediaControlsChromium.cpp 2012-12-07 23:06:53 UTC (rev 136990)
+++ trunk/Source/WebCore/html/shadow/MediaControlsChromium.cpp 2012-12-07 23:11:02 UTC (rev 136991)
@@ -214,7 +214,9 @@
// Insert it before the first controller element so it always displays behind the controls.
// In the Chromium case, that's the enclosure element.
- insertBefore(textDisplayContainer.release(), m_enclosure, ASSERT_NO_EXCEPTION, true);
+ insertBefore(textDisplayContainer, m_enclosure, ASSERT_NO_EXCEPTION, true);
+ textDisplayContainer->createSubtrees(document());
+ textDisplayContainer.release();
}
#endif