Reviewers: dstockwell (away until aug 4), Timothy Loh,
Description:
Need to check for positional rules on parent with style change.
A local style change on the parent inhibited checks for positional rule
changes on children with an early return. Removed that early return.
R=
dstoc...@chromium.org
BUG=510732
Please review this at
https://codereview.chromium.org/1264573004/
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Affected files (+34, -3 lines):
A LayoutTests/fast/css/nth-child-dynamic-002.html
A LayoutTests/fast/css/nth-child-dynamic-002-expected.txt
M Source/core/dom/ContainerNode.cpp
Index: LayoutTests/fast/css/nth-child-dynamic-002-expected.txt
diff --git a/LayoutTests/fast/css/nth-child-dynamic-002-expected.txt
b/LayoutTests/fast/css/nth-child-dynamic-002-expected.txt
new file mode 100644
index
0000000000000000000000000000000000000000..136e78ee7b750a002dd714c28b022ba18f0b5887
--- /dev/null
+++ b/LayoutTests/fast/css/nth-child-dynamic-002-expected.txt
@@ -0,0 +1,13 @@
+An existing LocalStyleChange on parent should not inhibit forward/backward
rule update on children.
+
+On success, you will see a series of "PASS" messages, followed by "TEST
COMPLETE".
+
+
+PASS getComputedStyle(inner).color is "rgb(255, 255, 255)"
+PASS getComputedStyle(inner).color is "rgb(0, 128, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+You should see a green square below, and no FAIL.
+
+FAIL
Index: LayoutTests/fast/css/nth-child-dynamic-002.html
diff --git a/LayoutTests/fast/css/nth-child-dynamic-002.html
b/LayoutTests/fast/css/nth-child-dynamic-002.html
new file mode 100644
index
0000000000000000000000000000000000000000..8cb126ee28f535e4d398095ce9f8280f5405ca30
--- /dev/null
+++ b/LayoutTests/fast/css/nth-child-dynamic-002.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<style>
+ #outer { width: 100px; height: 100px }
+ span { color: white }
+ span:nth-child(2) { color: green }
+</style>
+<p>You should see a green square below, and no FAIL.</p>
+<div id="outer">
+ <span id="inner">FAIL</span>
+</div>
+<script>
+ description("An existing LocalStyleChange on parent should not inhibit
forward/backward rule update on children.");
+
+ shouldBeEqualToString("getComputedStyle(inner).color", "rgb(255, 255,
255)");
+
+ outer.style.backgroundColor = "green";
+ outer.insertBefore(document.createElement("span"), inner);
+
+ shouldBeEqualToString("getComputedStyle(inner).color", "rgb(0, 128,
0)");
+</script>
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp
b/Source/core/dom/ContainerNode.cpp
index
8a7ec24084f12d225604a4b47866be539df3f0d4..ef20bb6ea9237c822c4032474b4d2f068026a3a3
100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -1345,9 +1345,6 @@ void
ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, Nod
if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() ||
styleChangeType() >= SubtreeStyleChange)
return;
- if (needsStyleRecalc() && childrenAffectedByPositionalRules())
- return;
-
// Forward positional selectors include nth-child, nth-of-type,
first-of-type and only-of-type.
// The indirect adjacent selector is the ~ selector.
// Backward positional selectors include nth-last-child,
nth-last-of-type, last-of-type and only-of-type.