Commit ba1240dc authored by dgorbik@apple.com's avatar dgorbik@apple.com
Browse files

Not all properties apply to the '::cue' pseudo-element

https://bugs.webkit.org/show_bug.cgi?id=110705

Reviewed by Eric Carlson.

Source/WebCore:

Background properties are not inherited and they were not applied to right elements.
Now we apply all ::cue properties to WebVTT cue background box, which -webkit-media-text-track-all-nodes
container was corresponding to. Now it has 'cue' pseudoId instead of '-webkit-media-text-track-all-nodes'.
Property filtering is turned off for user agent rules so that we are still able to apply filtered rules
to this container internally. m_cueContainer is removed because it is no longer needed.
m_allDocumentNodes container was renamed to m_cueBackgroundBox.

Existing tests modified to cover this case.

* css/RuleSet.h:
(WebCore::RuleData::propertyWhitelistType): disable filtering for UA rules.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::sortAndTransferMatchedRules): pass the UA scope to propertyWhitelistType().
* css/mediaControls.css: rename -webkit-media-text-track-all-nodes to 'cue'
(video::cue):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):
* html/shadow/MediaControlElements.h:
(MediaControlTextTrackContainerElement):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::createTextTrackDisplay):
* html/shadow/MediaControlsChromium.cpp:
(WebCore::MediaControlsChromium::createTextTrackDisplay):
* html/shadow/MediaControlsGtk.cpp:
(WebCore::MediaControlsGtk::createTextTrackDisplay):
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::TextTrackCue):
(WebCore::TextTrackCue::updateDisplayTree):
(WebCore::TextTrackCue::getDisplayTree):
* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::element):
* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride):

LayoutTests:

* media/media-controls.js:
(textTrackDisplayElement):
* media/track/track-css-all-cues-expected.txt:
* media/track/track-css-all-cues.html:
* media/track/track-css-cue-lifetime.html:
* media/track/track-css-matching-default.html:
* media/track/track-css-matching-lang.html:
* media/track/track-css-matching-timestamps.html:
* media/track/track-css-matching.html:
* media/track/track-css-property-whitelist.html:
* media/track/track-in-band-style.html:
* platform/mac/media/track/track-cue-rendering-horizontal-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145397 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 305ef0e3
2013-02-26 Dima Gorbik <dgorbik@apple.com>
Not all properties apply to the '::cue' pseudo-element
https://bugs.webkit.org/show_bug.cgi?id=110705
Reviewed by Eric Carlson.
* media/media-controls.js:
(textTrackDisplayElement):
* media/track/track-css-all-cues-expected.txt:
* media/track/track-css-all-cues.html:
* media/track/track-css-cue-lifetime.html:
* media/track/track-css-matching-default.html:
* media/track/track-css-matching-lang.html:
* media/track/track-css-matching-timestamps.html:
* media/track/track-css-matching.html:
* media/track/track-css-property-whitelist.html:
* media/track/track-in-band-style.html:
* platform/mac/media/track/track-cue-rendering-horizontal-expected.txt:
2013-03-11 James Robinson <jamesr@chromium.org>
 
Update chromium expectations.
......@@ -54,7 +54,10 @@ function textTrackDisplayElement(parentElement, id, cueNumber)
if (!id)
return containerElement;
var controlID = "-webkit-media-text-track-" + arguments[1];
if (arguments[1] != 'cue')
var controlID = "-webkit-media-text-track-" + arguments[1];
else
var controlID = arguments[1];
var displayElement = mediaControlsElement(containerElement.firstChild, controlID);
if (!displayElement)
......
Test that style to all cues is applied correctly.
EVENT(canplaythrough)
EVENT(seeked)
EXPECTED (getComputedStyle(textTrackDisplayElement(video).firstChild).color == 'rgb(255, 0, 0)') OK
EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'cue')).color == 'rgb(128, 0, 128)') OK
EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor == 'rgb(0, 255, 0)') OK
END OF TEST
......@@ -9,7 +9,7 @@
<style>
video::cue { color:red }
video::cue { color: purple; background-color: lime; }
</style>
......@@ -17,7 +17,8 @@
function seeked()
{
testExpected("getComputedStyle(textTrackDisplayElement(video).firstChild).color", "rgb(255, 0, 0)");
testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(0, 255, 0)");
endTest();
}
......
......@@ -34,7 +34,7 @@
if (testEnded)
return;
cueNode = skipNonElements(textTrackDisplayElement(video, 'all-nodes').firstChild);
cueNode = skipNonElements(textTrackDisplayElement(video, 'cue').firstChild);
skipNonElements(cueNode);
testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
cueNode = skipNonElements(cueNode.nextSibling);
......
......@@ -16,7 +16,7 @@
if (testEnded)
return;
cueNode = textTrackDisplayElement(video, 'all-nodes').firstElementChild;
cueNode = textTrackDisplayElement(video, 'cue').firstElementChild;
testExpected("getComputedStyle(cueNode).fontWeight", "bold");
cueNode = cueNode.nextElementSibling;
testExpected("getComputedStyle(cueNode).fontStyle", "italic");
......
......@@ -26,7 +26,7 @@
if (testEnded)
return;
cueNode = textTrackDisplayElement(video, 'all-nodes').firstElementChild.firstElementChild;
cueNode = textTrackDisplayElement(video, 'cue').firstElementChild.firstElementChild;
testExpected("getComputedStyle(cueNode).color", info[seekedCount][0]);
cueNode = cueNode.firstElementChild.firstElementChild;
testExpected("getComputedStyle(cueNode).color", info[seekedCount][1]);
......
......@@ -30,7 +30,7 @@
if (testEnded)
return;
cueNode = textTrackDisplayElement(video, 'all-nodes').firstElementChild;
cueNode = textTrackDisplayElement(video, 'cue').firstElementChild;
testExpected("getComputedStyle(cueNode).color", info[seekedCount][0]);
cueNode = cueNode.nextElementSibling;
testExpected("getComputedStyle(cueNode).color", info[seekedCount][1]);
......
......@@ -58,7 +58,7 @@
consoleWrite(description[seekedCount]);
}
cueNode = skipNonElements(textTrackDisplayElement(video, 'all-nodes').firstChild);
cueNode = skipNonElements(textTrackDisplayElement(video, 'cue').firstChild);
skipNonElements(cueNode);
testExpected("getComputedStyle(cueNode).color", info[seekedCount][0]);
cueNode = skipNonElements(cueNode.nextSibling);
......
......@@ -28,7 +28,7 @@
consoleWrite("<br>");
consoleWrite("Test that only allowed for the ::cue pseudo-element properties are applied to WebVTT node objects.");
cueNode = textTrackDisplayElement(video, 'all-nodes').firstElementChild;
cueNode = textTrackDisplayElement(video, 'cue').firstElementChild;
testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
testExpected("getComputedStyle(cueNode).padding", "0px");
testExpected("getComputedStyle(cueNode).wordSpacing", "0px");
......
......@@ -16,7 +16,7 @@
cueDisplayElement = textTrackDisplayElement(video, 'display', 0);
testExpected("getComputedStyle(cueDisplayElement).color", "rgb(255, 255, 255)");
cueNode = textTrackDisplayElement(video, 'all-nodes');
cueNode = textTrackDisplayElement(video, 'cue');
testExpected("getComputedStyle(cueNode).backgroundColor", "rgb(0, 0, 0)");
endTest();
......
......@@ -21,67 +21,60 @@ layer at (0,0) size 800x332
layer at (8,8) size 320x240
RenderVideo {VIDEO} at (0,0) size 320x240
layer at (8,8) size 320x240
RenderDeprecatedFlexibleBox (relative positioned) {DIV} at (0,0) size 320x240
RenderFlexibleBox {DIV} at (0,0) size 320x240
layer at (8,8) size 320x215
RenderBlock (relative positioned) {DIV} at (0,0) size 320x215 [color=#FFFFFF00]
layer at (8,8) size 320x14
RenderBlock (positioned) {DIV} at (0,0) size 320x14 [color=#FFFFFF]
RenderBlock (relative positioned) {DIV} at (0,0) size 320x215 [color=#FFFFFF]
layer at (8,8) size 320x14 scrollHeight 16
RenderBlock (positioned) {DIV} at (0,0) size 320x14
RenderInline {DIV} at (0,0) size 280x18 [bgcolor=#000000CC]
RenderText {#text} at (22,0) size 276x14
text run at (22,0) width 276: "Cue 1: should be positioned at the top of the video."
RenderInline {DIV} at (0,0) size 3x18 [bgcolor=#000000CC]
layer at (8,26) size 320x14
RenderBlock (positioned) {DIV} at (0,18) size 320x14 [color=#FFFFFF]
layer at (8,26) size 320x14 scrollHeight 16
RenderBlock (positioned) {DIV} at (0,18) size 320x14
RenderInline {DIV} at (0,0) size 308x18 [bgcolor=#000000CC]
RenderText {#text} at (8,0) size 304x14
text run at (8,0) width 304: "Cue 2: should be the second cue and not overlap cue 1."
RenderInline {DIV} at (0,0) size 3x18 [bgcolor=#000000CC]
layer at (8,44) size 320x14
RenderBlock (positioned) {DIV} at (0,36) size 320x14 [color=#FFFFFF]
layer at (8,44) size 320x14 scrollHeight 16
RenderBlock (positioned) {DIV} at (0,36) size 320x14
RenderInline {DIV} at (0,0) size 300x18 [bgcolor=#000000CC]
RenderText {#text} at (12,0) size 296x14
text run at (12,0) width 296: "Cue 3: should become the third line from top to bottom."
RenderInline {DIV} at (0,0) size 2x18 [bgcolor=#000000CC]
layer at (8,98) size 320x14
RenderBlock (positioned) {DIV} at (0,90) size 320x14 [color=#FFFFFF]
layer at (8,98) size 320x14 scrollHeight 16
RenderBlock (positioned) {DIV} at (0,90) size 320x14
RenderInline {DIV} at (0,0) size 292x18 [bgcolor=#000000CC]
RenderText {#text} at (16,0) size 288x14
text run at (16,0) width 288: "Cue 4: should be fixed positioned around the middle."
RenderInline {DIV} at (0,0) size 3x18 [bgcolor=#000000CC]
layer at (8,205) size 320x14
RenderBlock (positioned) {DIV} at (0,197) size 320x14 [color=#FFFFFF]
layer at (8,205) size 320x14 scrollHeight 16
RenderBlock (positioned) {DIV} at (0,197) size 320x14
RenderInline {DIV} at (0,0) size 296x18 [bgcolor=#000000CC]
RenderText {#text} at (14,0) size 292x14
text run at (14,0) width 292: "Cue 5: should be displayed at the bottom of the video."
RenderInline {DIV} at (0,0) size 3x18 [bgcolor=#000000CC]
layer at (8,187) size 320x14
RenderBlock (positioned) {DIV} at (0,179) size 320x14 [color=#FFFFFF]
layer at (8,187) size 320x14 scrollHeight 16
RenderBlock (positioned) {DIV} at (0,179) size 320x14
RenderInline {DIV} at (0,0) size 284x18 [bgcolor=#000000CC]
RenderText {#text} at (20,0) size 280x14
text run at (20,0) width 280: "Cue 6: should be on top of bottom positioned cue 5."
RenderInline {DIV} at (0,0) size 3x18 [bgcolor=#000000CC]
layer at (8,223) size 320x25
RenderDeprecatedFlexibleBox (relative positioned) {DIV} at (0,215) size 320x25
RenderFlexibleBox {DIV} at (0,215) size 320x25
RenderButton {INPUT} at (6,3) size 18x18
RenderButton {INPUT} at (32,4) size 16x16
RenderDeprecatedFlexibleBox {DIV} at (49,5) size 216x15
RenderSlider {INPUT} at (45,2) size 126x13
RenderDeprecatedFlexibleBox {DIV} at (0,0) size 126x13
RenderBlock {DIV} at (0,2) size 116x8
RenderBlock {DIV} at (116,2) size 10x8
RenderButton {INPUT} at (297,4) size 16x16
RenderBlock {DIV} at (265,6) size 25x12
RenderButton {INPUT} at (32,4) size 16x17
RenderFlexibleBox {DIV} at (49,5) size 219x15
RenderSlider {INPUT} at (45,2) size 129x13
RenderFlexibleBox {DIV} at (0,0) size 129x13
RenderBlock {DIV} at (0,2) size 129x9
RenderBlock {DIV} at (4,0) size 11x8
RenderButton {INPUT} at (300,4) size 16x17
RenderButton {INPUT} at (330,4) size 16x17
RenderBlock {DIV} at (268,6) size 25x13
layer at (57,230) size 45x11
RenderDeprecatedFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
RenderBlock (anonymous) at (9,0) size 26x11
RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
RenderBlock (anonymous) at (9,0) size 27x11
RenderText {#text} at (0,0) size 26x11
text run at (0,0) width 26: "00:00"
layer at (228,230) size 45x11
RenderDeprecatedFlexibleBox {DIV} at (171,2) size 45x11 [color=#FFFFFF]
layer at (231,230) size 45x11
RenderFlexibleBox {DIV} at (174,2) size 45x11 [color=#FFFFFF]
RenderBlock (anonymous) at (7,0) size 31x11
RenderText {#text} at (0,0) size 31x11
text run at (0,0) width 31: "-00:05"
layer at (106,232) size 10x8
RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
layer at (275,229) size 14x12
layer at (278,230) size 14x12
RenderButton zI: 1 {INPUT} at (2,0) size 14x12
2013-02-26 Dima Gorbik <dgorbik@apple.com>
Not all properties apply to the '::cue' pseudo-element
https://bugs.webkit.org/show_bug.cgi?id=110705
Reviewed by Eric Carlson.
Background properties are not inherited and they were not applied to right elements.
Now we apply all ::cue properties to WebVTT cue background box, which -webkit-media-text-track-all-nodes
container was corresponding to. Now it has 'cue' pseudoId instead of '-webkit-media-text-track-all-nodes'.
Property filtering is turned off for user agent rules so that we are still able to apply filtered rules
to this container internally. m_cueContainer is removed because it is no longer needed.
m_allDocumentNodes container was renamed to m_cueBackgroundBox.
Existing tests modified to cover this case.
* css/RuleSet.h:
(WebCore::RuleData::propertyWhitelistType): disable filtering for UA rules.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::sortAndTransferMatchedRules): pass the UA scope to propertyWhitelistType().
* css/mediaControls.css: rename -webkit-media-text-track-all-nodes to 'cue'
(video::cue):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):
* html/shadow/MediaControlElements.h:
(MediaControlTextTrackContainerElement):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::createTextTrackDisplay):
* html/shadow/MediaControlsChromium.cpp:
(WebCore::MediaControlsChromium::createTextTrackDisplay):
* html/shadow/MediaControlsGtk.cpp:
(WebCore::MediaControlsGtk::createTextTrackDisplay):
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::TextTrackCue):
(WebCore::TextTrackCue::updateDisplayTree):
(WebCore::TextTrackCue::getDisplayTree):
* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::element):
* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride):
2013-03-11 Tim Horton <timothy_horton@apple.com>
 
ChromeClient.h doesn’t need to include RenderSnapshottedPlugIn
......@@ -69,7 +69,7 @@ public:
unsigned specificity() const { return m_specificity; }
unsigned linkMatchType() const { return m_linkMatchType; }
bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; }
PropertyWhitelistType propertyWhitelistType() const { return static_cast<PropertyWhitelistType>(m_propertyWhitelistType); }
PropertyWhitelistType propertyWhitelistType(bool isMatchingUARules = false) const { return isMatchingUARules ? PropertyWhitelistNone : static_cast<PropertyWhitelistType>(m_propertyWhitelistType); }
// Try to balance between memory usage (there can be lots of RuleData objects) and good filtering performance.
static const unsigned maximumIdentifierCount = 4;
const unsigned* descendantSelectorIdentifierHashes() const { return m_descendantSelectorIdentifierHashes; }
......
......@@ -537,7 +537,7 @@ void StyleResolver::sortAndTransferMatchedRules(MatchResult& result)
for (unsigned i = 0; i < matchedRules.size(); i++) {
if (state.style() && matchedRules[i]->containsUncommonAttributeSelector())
state.style()->setUnique();
addMatchedProperties(result, matchedRules[i]->rule()->properties(), matchedRules[i]->rule(), matchedRules[i]->linkMatchType(), matchedRules[i]->propertyWhitelistType());
addMatchedProperties(result, matchedRules[i]->rule()->properties(), matchedRules[i]->rule(), matchedRules[i]->linkMatchType(), matchedRules[i]->propertyWhitelistType(MatchingUARulesScope::isMatchingUARules()));
}
}
......
......@@ -237,7 +237,7 @@ video::-webkit-media-text-track-container {
-webkit-flex: 1 1;
}
video::-webkit-media-text-track-all-nodes {
video::cue {
display: inline;
background-color: rgba(0, 0, 0, 0.8);
......
......@@ -1185,13 +1185,6 @@ MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Doc
{
}
void MediaControlTextTrackContainerElement::createSubtrees(Document* document)
{
m_cueContainer = HTMLElement::create(spanTag, document);
m_cueContainer->setPseudo(TextTrackCue::cueShadowPseudoId());
appendChild(m_cueContainer, ASSERT_NO_EXCEPTION, AttachNow);
}
PassRefPtr<MediaControlTextTrackContainerElement> MediaControlTextTrackContainerElement::create(Document* document)
{
RefPtr<MediaControlTextTrackContainerElement> element = adoptRef(new MediaControlTextTrackContainerElement(document));
......@@ -1218,7 +1211,7 @@ const AtomicString& MediaControlTextTrackContainerElement::shadowPseudoId() cons
void MediaControlTextTrackContainerElement::updateDisplay()
{
if (!mediaController()->closedCaptionsVisible()) {
m_cueContainer->removeChildren();
removeChildren();
return;
}
......@@ -1277,7 +1270,7 @@ void MediaControlTextTrackContainerElement::updateDisplay()
RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size());
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.
m_cueContainer->appendChild(displayBox, ASSERT_NO_EXCEPTION, AttachNow);
appendChild(displayBox, ASSERT_NO_EXCEPTION, false);
}
// 11. Return output.
......
......@@ -439,7 +439,6 @@ public:
void updateDisplay();
void updateSizes(bool forceUpdate = false);
void createSubtrees(Document*);
static const AtomicString& textTrackContainerElementShadowPseudoId();
private:
......@@ -454,7 +453,6 @@ private:
IntRect m_videoDisplaySize;
float m_fontSize;
RefPtr<HTMLElement> m_cueContainer;
};
#endif
......
......@@ -382,9 +382,7 @@ void MediaControls::createTextTrackDisplay()
m_textDisplayContainer->setMediaController(m_mediaController);
// Insert it before the first controller element so it always displays behind the controls.
insertBefore(textDisplayContainer, m_panel, IGNORE_EXCEPTION, AttachLazily);
textDisplayContainer->createSubtrees(document());
textDisplayContainer.release();
insertBefore(textDisplayContainer.release(), m_panel, IGNORE_EXCEPTION, true);
}
void MediaControls::showTextTrackDisplay()
......
......@@ -215,9 +215,7 @@ void MediaControlsChromium::createTextTrackDisplay()
// 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, m_enclosure, ASSERT_NO_EXCEPTION, AttachLazily);
textDisplayContainer->createSubtrees(document());
textDisplayContainer.release();
insertBefore(textDisplayContainer.release(), m_enclosure, ASSERT_NO_EXCEPTION, true);
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment