Title: [140505] trunk
Revision
140505
Author
[email protected]
Date
2013-01-22 21:50:15 -0800 (Tue, 22 Jan 2013)

Log Message

Whitelist should also work for the WebVTT ::cue element without an argument
https://bugs.webkit.org/show_bug.cgi?id=107488

Source/WebCore:

Patch by Dima Gorbik <[email protected]> on 2013-01-22
Reviewed by Andreas Kling.

Apply filtering if the cue shadow pseudoId is set on the selector.

Existing tests were modified to cover this case.

* css/RuleSet.cpp:
(WebCore::determinePropertyWhitelistType):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::createSubtrees):
* html/track/TextTrackCue.h:
(WebCore::TextTrackCue::cueShadowPseudoId):

LayoutTests:

Patch by Dima Gorbik <[email protected]> on 2013-01-22
Reviewed by Andreas Kling.

* media/track/track-css-property-whitelist-expected.txt:
* media/track/track-css-property-whitelist.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140504 => 140505)


--- trunk/LayoutTests/ChangeLog	2013-01-23 05:35:23 UTC (rev 140504)
+++ trunk/LayoutTests/ChangeLog	2013-01-23 05:50:15 UTC (rev 140505)
@@ -1,3 +1,13 @@
+2013-01-22  Dima Gorbik  <[email protected]>
+
+        Whitelist should also work for the WebVTT ::cue element without an argument
+        https://bugs.webkit.org/show_bug.cgi?id=107488
+
+        Reviewed by Andreas Kling.
+
+        * media/track/track-css-property-whitelist-expected.txt:
+        * media/track/track-css-property-whitelist.html:
+
 2013-01-22  Kent Tamura  <[email protected]>
 
         [Chromium] Layout test calendar-picker-mouse-operations.html is flaky

Modified: trunk/LayoutTests/media/track/track-css-property-whitelist-expected.txt (140504 => 140505)


--- trunk/LayoutTests/media/track/track-css-property-whitelist-expected.txt	2013-01-23 05:35:23 UTC (rev 140504)
+++ trunk/LayoutTests/media/track/track-css-property-whitelist-expected.txt	2013-01-23 05:50:15 UTC (rev 140505)
@@ -5,9 +5,12 @@
 Test that only allowed for the ::cue pseudo-element properties are applied to WebVTT node objects.
 EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
 EXPECTED (getComputedStyle(cueNode).padding == '0px') OK
+EXPECTED (getComputedStyle(cueNode).wordSpacing == '0px') OK
 EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
 EXPECTED (getComputedStyle(cueNode).padding == '0px') OK
+EXPECTED (getComputedStyle(cueNode).wordSpacing == '0px') OK
 EXPECTED (getComputedStyle(cueNode).color == 'rgb(255, 0, 0)') OK
 EXPECTED (getComputedStyle(cueNode).padding == '0px') OK
+EXPECTED (getComputedStyle(cueNode).wordSpacing == '0px') OK
 END OF TEST
 

Modified: trunk/LayoutTests/media/track/track-css-property-whitelist.html (140504 => 140505)


--- trunk/LayoutTests/media/track/track-css-property-whitelist.html	2013-01-23 05:35:23 UTC (rev 140504)
+++ trunk/LayoutTests/media/track/track-css-property-whitelist.html	2013-01-23 05:50:15 UTC (rev 140505)
@@ -8,6 +8,7 @@
         <script src=""
 
         <style>
+        ::cue {word-spacing: 100px;}
         ::cue(c) {padding-left: 10px; color: red;}
         </style>
 
@@ -15,15 +16,6 @@
 
         var cueNode;
 
-        function skipNonElements(root)
-        {
-            nextElementSibling = root;
-            while (nextElementSibling.nodeType != 1) {
-                nextElementSibling = nextElementSibling.nextSibling;
-            }
-            return nextElementSibling;
-        }
-
         function seeked()
         {
             if (testEnded)
@@ -32,16 +24,18 @@
             consoleWrite("<br>");
             consoleWrite("Test that only allowed for the ::cue pseudo-element properties are applied to WebVTT node objects.");
 
-            cueNode = skipNonElements(textTrackDisplayElement(video, 'all-nodes').firstChild);
-            skipNonElements(cueNode);
+            cueNode = textTrackDisplayElement(video, 'all-nodes').firstElementChild;
             testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
             testExpected("getComputedStyle(cueNode).padding", "0px");
-            cueNode = skipNonElements(cueNode.nextSibling);
+            testExpected("getComputedStyle(cueNode).wordSpacing", "0px");
+            cueNode = cueNode.nextElementSibling;
             testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
             testExpected("getComputedStyle(cueNode).padding", "0px");
-            cueNode = skipNonElements(cueNode.nextSibling);
+            testExpected("getComputedStyle(cueNode).wordSpacing", "0px");
+            cueNode = cueNode.nextElementSibling;
             testExpected("getComputedStyle(cueNode).color", "rgb(255, 0, 0)");
             testExpected("getComputedStyle(cueNode).padding", "0px");
+            testExpected("getComputedStyle(cueNode).wordSpacing", "0px");
             endTest();
         }
 

Modified: trunk/Source/WebCore/ChangeLog (140504 => 140505)


--- trunk/Source/WebCore/ChangeLog	2013-01-23 05:35:23 UTC (rev 140504)
+++ trunk/Source/WebCore/ChangeLog	2013-01-23 05:50:15 UTC (rev 140505)
@@ -1,3 +1,21 @@
+2013-01-22  Dima Gorbik  <[email protected]>
+
+        Whitelist should also work for the WebVTT ::cue element without an argument
+        https://bugs.webkit.org/show_bug.cgi?id=107488
+
+        Reviewed by Andreas Kling.
+        
+        Apply filtering if the cue shadow pseudoId is set on the selector.
+
+        Existing tests were modified to cover this case.
+
+        * css/RuleSet.cpp:
+        (WebCore::determinePropertyWhitelistType):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::createSubtrees):
+        * html/track/TextTrackCue.h:
+        (WebCore::TextTrackCue::cueShadowPseudoId):
+
 2013-01-22  Hayato Ito  <[email protected]>
 
         Make MediaQueryEvaluator(bool) constructor explicit.

Modified: trunk/Source/WebCore/css/RuleSet.cpp (140504 => 140505)


--- trunk/Source/WebCore/css/RuleSet.cpp	2013-01-23 05:35:23 UTC (rev 140504)
+++ trunk/Source/WebCore/css/RuleSet.cpp	2013-01-23 05:50:15 UTC (rev 140505)
@@ -47,6 +47,10 @@
 #include <wtf/MemoryInstrumentationHashSet.h>
 #include <wtf/MemoryInstrumentationVector.h>
 
+#if ENABLE(VIDEO_TRACK)
+#include "TextTrackCue.h"
+#endif
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -118,9 +122,11 @@
         return PropertyWhitelistRegion;
 #if ENABLE(VIDEO_TRACK)
     for (const CSSSelector* component = selector; component; component = component->tagHistory()) {
-        if (component->pseudoType() == CSSSelector::PseudoCue)
+        if (component->pseudoType() == CSSSelector::PseudoCue || (component->m_match != CSSSelector::Tag && component->value() == TextTrackCue::cueShadowPseudoId()))
             return PropertyWhitelistCue;
     }
+#else
+    UNUSED_PARAM(selector);
 #endif
     return PropertyWhitelistNone;
 }

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (140504 => 140505)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-01-23 05:35:23 UTC (rev 140504)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2013-01-23 05:50:15 UTC (rev 140505)
@@ -1221,9 +1221,8 @@
 
 void MediaControlTextTrackContainerElement::createSubtrees(Document* document)
 {
-    DEFINE_STATIC_LOCAL(const AtomicString, cue, ("cue", AtomicString::ConstructFromLiteral));
     m_cueContainer = HTMLElement::create(spanTag, document);
-    m_cueContainer->setPseudo(cue);
+    m_cueContainer->setPseudo(TextTrackCue::cueShadowPseudoId());
     appendChild(m_cueContainer, ASSERT_NO_EXCEPTION, false);
 }
 

Modified: trunk/Source/WebCore/html/track/TextTrackCue.h (140504 => 140505)


--- trunk/Source/WebCore/html/track/TextTrackCue.h	2013-01-23 05:35:23 UTC (rev 140504)
+++ trunk/Source/WebCore/html/track/TextTrackCue.h	2013-01-23 05:50:15 UTC (rev 140505)
@@ -79,6 +79,12 @@
         return adoptRef(new TextTrackCue(context, start, end, content));
     }
 
+    static const AtomicString& cueShadowPseudoId()
+    {
+        DEFINE_STATIC_LOCAL(const AtomicString, cue, ("cue", AtomicString::ConstructFromLiteral));
+        return cue;
+    }
+
     static const QualifiedName& voiceElementTagName()
     {
         DEFINE_STATIC_LOCAL(QualifiedName, vTag, (nullAtom, "v", nullAtom));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to