summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last-expected.txt10
-rw-r--r--third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last.html13
-rw-r--r--third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp2
-rw-r--r--third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp8
4 files changed, 29 insertions, 4 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last-expected.txt
new file mode 100644
index 0000000..69b030a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last-expected.txt
@@ -0,0 +1,10 @@
+Accept simple selectors after ::content For Polymer 0.5 compat
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(distributed).color is "rgb(0, 128, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This text should be green
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last.html
new file mode 100644
index 0000000..39e13ed
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/content-pseudo-element-not-last.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<div id="host">
+ <span id="distributed">This text should be green</span>
+</div>
+<script>
+ description("Accept simple selectors after ::content For Polymer 0.5 compat");
+
+ var root = host.createShadowRoot();
+ root.innerHTML = '<style>[select]::content.x span { color: green }</style><content class="x" select="span"></content>';
+
+ shouldBeEqualToString("getComputedStyle(distributed).color", "rgb(0, 128, 0)");
+</script>
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
index 61024f5..5ce5f53 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
@@ -225,6 +225,8 @@ bool isSimpleSelectorValidAfterPseudoElement(const CSSParserSelector& simpleSele
{
if (compoundPseudoElement == CSSSelector::PseudoUnknown)
return true;
+ if (compoundPseudoElement == CSSSelector::PseudoContent)
+ return simpleSelector.match() != CSSSelector::PseudoElement;
if (simpleSelector.match() != CSSSelector::PseudoClass)
return false;
CSSSelector::PseudoType pseudo = simpleSelector.pseudoType();
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp
index 9391da4..6a4d51c 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp
@@ -119,6 +119,10 @@ TEST(CSSSelectorParserTest, ShadowDomPseudoInCompound)
{ ".a::shadow", ".a::shadow" },
{ "::content", "::content" },
{ ".a::content", ".a::content" },
+ { "::content.a", "::content.a" },
+ { "::content.a.b", "::content.a.b" },
+ { ".a::content.b", ".a::content.b" },
+ { "::content:not(#id)", "::content:not(#id)" }
};
for (auto testCase : testCases) {
@@ -182,12 +186,8 @@ TEST(CSSSelectorParserTest, InvalidSimpleAfterPseudoElementInCompound)
"::shadow.class",
"::selection:window-inactive::before",
"::-webkit-volume-slider.class",
- "::content.a",
- "::content.a.b",
- ".a::content.b",
"::before:not(.a)",
"::shadow:not(::after)",
- "::content:not(#id)",
"::-webkit-scrollbar:vertical:not(:first-child)",
"video::-webkit-media-text-track-region-container.scrolling",
"div ::before.a"