Title: [133715] trunk
- Revision
- 133715
- Author
- [email protected]
- Date
- 2012-11-06 20:40:33 -0800 (Tue, 06 Nov 2012)
Log Message
[Shadow] Pseudo custom-elements should start with 'x-'.
https://bugs.webkit.org/show_bug.cgi?id=100919
Reviewed by Dimitri Glazkov.
Source/WebCore:
Pseuco custom-elements should start with 'x-'. 'Pseudo' starting with '-webkit-' should work
only in UserAgent ShadowDOM. If it's used in Author ShadowDOM, it should not work.
Test: fast/dom/shadow/pseudo-attribute-rendering.html
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkSelector): Added ShadowRoot type check.
LayoutTests:
* fast/dom/shadow/pseudo-attribute-rendering-expected.html: Added.
* fast/dom/shadow/pseudo-attribute-rendering.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (133714 => 133715)
--- trunk/LayoutTests/ChangeLog 2012-11-07 04:39:00 UTC (rev 133714)
+++ trunk/LayoutTests/ChangeLog 2012-11-07 04:40:33 UTC (rev 133715)
@@ -1,3 +1,13 @@
+2012-11-06 Shinya Kawanaka <[email protected]>
+
+ [Shadow] Pseudo custom-elements should start with 'x-'.
+ https://bugs.webkit.org/show_bug.cgi?id=100919
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/shadow/pseudo-attribute-rendering-expected.html: Added.
+ * fast/dom/shadow/pseudo-attribute-rendering.html: Added.
+
2012-11-06 Alice Boxhall <[email protected]>
Unreviewed gardening. Rebaseline the tests added in http://trac.webkit.org/changeset/133686 for different platforms.
Added: trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-rendering-expected.html (0 => 133715)
--- trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-rendering-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-rendering-expected.html 2012-11-07 04:40:33 UTC (rev 133715)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test checks element.pseudo starting '-webkit-' only works in UserAgentShadowRoot.</p>
+
+<div><div style="color: red">This text should be red.</div></div>
+<div><div>This text should not be red.</div></div>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-rendering.html (0 => 133715)
--- trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-rendering.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-rendering.html 2012-11-07 04:40:33 UTC (rev 133715)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+div::x-foo {
+ color: red;
+}
+div::-webkit-foobar {
+ color: red;
+}
+</style>
+</head>
+<body>
+<p>This test checks element.pseudo starting '-webkit-' only works in UserAgentShadowRoot.</p>
+
+<div id="host1"></div>
+<div id="host2"></div>
+
+<script>
+var shadowRoot1 = new WebKitShadowRoot(host1);
+var div1 = document.createElement('div');
+div1.pseudo = 'x-foo';
+div1.innerHTML = "This text should be red.";
+shadowRoot1.appendChild(div1);
+
+var shadowRoot2 = new WebKitShadowRoot(host2);
+var div2 = document.createElement('div');
+div2.pseudo = '-webkit-foobar';
+div2.innerHTML = "This text should not be red.";
+shadowRoot2.appendChild(div2);
+</script>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (133714 => 133715)
--- trunk/Source/WebCore/ChangeLog 2012-11-07 04:39:00 UTC (rev 133714)
+++ trunk/Source/WebCore/ChangeLog 2012-11-07 04:40:33 UTC (rev 133715)
@@ -1,3 +1,18 @@
+2012-11-06 Shinya Kawanaka <[email protected]>
+
+ [Shadow] Pseudo custom-elements should start with 'x-'.
+ https://bugs.webkit.org/show_bug.cgi?id=100919
+
+ Reviewed by Dimitri Glazkov.
+
+ Pseuco custom-elements should start with 'x-'. 'Pseudo' starting with '-webkit-' should work
+ only in UserAgent ShadowDOM. If it's used in Author ShadowDOM, it should not work.
+
+ Test: fast/dom/shadow/pseudo-attribute-rendering.html
+
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkSelector): Added ShadowRoot type check.
+
2012-11-06 Chris Evans <[email protected]>
Re-order variables in BidiRun and LayoutState
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (133714 => 133715)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2012-11-07 04:39:00 UTC (rev 133714)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2012-11-07 04:40:33 UTC (rev 133715)
@@ -51,6 +51,7 @@
#include "RenderStyle.h"
#include "ScrollableArea.h"
#include "ScrollbarTheme.h"
+#include "ShadowRoot.h"
#include "SiblingTraversalStrategies.h"
#include "StyledElement.h"
#include "Text.h"
@@ -447,7 +448,13 @@
if (context.selector->m_match == CSSSelector::PseudoElement) {
if (context.selector->isCustomPseudoElement()) {
- if (context.element->shadowPseudoId() != context.selector->value())
+ if (ShadowRoot* root = context.element->shadowRoot()) {
+ if (context.element->shadowPseudoId() != context.selector->value())
+ return SelectorFailsLocally;
+
+ if (context.selector->pseudoType() == CSSSelector::PseudoWebKitCustomElement && root->type() != ShadowRoot::UserAgentShadowRoot)
+ return SelectorFailsLocally;
+ } else
return SelectorFailsLocally;
} else {
if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode == QueryingRules)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes