Diff
Modified: trunk/LayoutTests/ChangeLog (122301 => 122302)
--- trunk/LayoutTests/ChangeLog 2012-07-11 06:19:09 UTC (rev 122301)
+++ trunk/LayoutTests/ChangeLog 2012-07-11 06:23:02 UTC (rev 122302)
@@ -1,3 +1,19 @@
+2012-07-10 Douglas Stockwell <[email protected]>
+
+ Style not updated for element with display:none becoming first/last-child
+ https://bugs.webkit.org/show_bug.cgi?id=90356
+
+ Reviewed by Kent Tamura.
+
+ * fast/css/first-child-display-change-expected.txt: Added.
+ * fast/css/first-child-display-change-inverse-expected.txt: Added.
+ * fast/css/first-child-display-change-inverse.html: Added.
+ * fast/css/first-child-display-change.html: Added.
+ * fast/css/last-child-display-change-expected.txt: Added.
+ * fast/css/last-child-display-change-inverse-expected.txt: Added.
+ * fast/css/last-child-display-change-inverse.html: Added.
+ * fast/css/last-child-display-change.html: Added.
+
2012-07-10 Hayato Ito <[email protected]>
Unreviewed gardening.
Added: trunk/LayoutTests/fast/css/first-child-display-change-expected.txt (0 => 122302)
--- trunk/LayoutTests/fast/css/first-child-display-change-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/first-child-display-change-expected.txt 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/fast/css/first-child-display-change-inverse-expected.txt (0 => 122302)
--- trunk/LayoutTests/fast/css/first-child-display-change-inverse-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/first-child-display-change-inverse-expected.txt 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/fast/css/first-child-display-change-inverse.html (0 => 122302)
--- trunk/LayoutTests/fast/css/first-child-display-change-inverse.html (rev 0)
+++ trunk/LayoutTests/fast/css/first-child-display-change-inverse.html 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1,13 @@
+<style>
+.display-when-first-child { display: none; }
+.display-when-first-child:first-child { display: block; }
+</style>
+<div class="display-when-first-child">FAIL</div>
+<script>
+var test = document.createElement('div');
+document.body.insertBefore(test, document.body.firstChild);
+if (document.body.innerText.indexOf('FAIL') < 0)
+ test.innerText = 'PASS';
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
Added: trunk/LayoutTests/fast/css/first-child-display-change.html (0 => 122302)
--- trunk/LayoutTests/fast/css/first-child-display-change.html (rev 0)
+++ trunk/LayoutTests/fast/css/first-child-display-change.html 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1,11 @@
+<style>
+.display-when-first-child { display: none; }
+.display-when-first-child:first-child { display: block; }
+</style>
+<div id="test"></div>
+<div class="display-when-first-child">PASS</div>
+<script>
+document.body.removeChild(test);
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
Added: trunk/LayoutTests/fast/css/last-child-display-change-expected.txt (0 => 122302)
--- trunk/LayoutTests/fast/css/last-child-display-change-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/last-child-display-change-expected.txt 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/fast/css/last-child-display-change-inverse-expected.txt (0 => 122302)
--- trunk/LayoutTests/fast/css/last-child-display-change-inverse-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/last-child-display-change-inverse-expected.txt 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/fast/css/last-child-display-change-inverse.html (0 => 122302)
--- trunk/LayoutTests/fast/css/last-child-display-change-inverse.html (rev 0)
+++ trunk/LayoutTests/fast/css/last-child-display-change-inverse.html 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1,15 @@
+<style>
+.display-when-last-child { display: none; }
+.display-when-last-child:last-child { display: block; }
+</style>
+<div id="container">
+ <div class="display-when-last-child">FAIL</div>
+</div>
+<script>
+var test = document.createElement('div');
+container.appendChild(test);
+if (container.innerText.indexOf('FAIL') < 0)
+ test.innerText = 'PASS';
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
Added: trunk/LayoutTests/fast/css/last-child-display-change.html (0 => 122302)
--- trunk/LayoutTests/fast/css/last-child-display-change.html (rev 0)
+++ trunk/LayoutTests/fast/css/last-child-display-change.html 2012-07-11 06:23:02 UTC (rev 122302)
@@ -0,0 +1,14 @@
+<style>
+.display-when-last-child { display: none; }
+.display-when-last-child:last-child { display: block; }
+</style>
+<div>
+ <div class="display-when-last-child">PASS</div>
+ <div id="test"></div>
+</div>
+<script>
+var test = document.getElementById('test');
+test.parentElement.removeChild(test);
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
Modified: trunk/Source/WebCore/ChangeLog (122301 => 122302)
--- trunk/Source/WebCore/ChangeLog 2012-07-11 06:19:09 UTC (rev 122301)
+++ trunk/Source/WebCore/ChangeLog 2012-07-11 06:23:02 UTC (rev 122302)
@@ -1,3 +1,18 @@
+2012-07-10 Douglas Stockwell <[email protected]>
+
+ Style not updated for element with display:none becoming first/last-child
+ https://bugs.webkit.org/show_bug.cgi?id=90356
+
+ Reviewed by Kent Tamura.
+
+ Always trigger style recalc when an element without a renderer becomes the first/last-child.
+
+ Tests: fast/css/first-child-display-change.html
+ fast/css/last-child-display-change.html
+
+ * dom/Element.cpp:
+ (WebCore::checkForSiblingStyleChanges):
+
2012-07-10 Shinya Kawanaka <[email protected]>
ShadowRoot should know its type in debug build.
Modified: trunk/Source/WebCore/dom/Element.cpp (122301 => 122302)
--- trunk/Source/WebCore/dom/Element.cpp 2012-07-11 06:19:09 UTC (rev 122301)
+++ trunk/Source/WebCore/dom/Element.cpp 2012-07-11 06:23:02 UTC (rev 122302)
@@ -1256,7 +1256,7 @@
firstElementAfterInsertion->setNeedsStyleRecalc();
// We also have to handle node removal.
- if (childCountDelta < 0 && newFirstChild == firstElementAfterInsertion && newFirstChild && newFirstChild->renderStyle() && !newFirstChild->renderStyle()->firstChildState())
+ if (childCountDelta < 0 && newFirstChild == firstElementAfterInsertion && newFirstChild && (!newFirstChild->renderStyle() || !newFirstChild->renderStyle()->firstChildState()))
newFirstChild->setNeedsStyleRecalc();
}
@@ -1279,7 +1279,7 @@
// We also have to handle node removal. The parser callback case is similar to node removal as well in that we need to change the last child
// to match now.
- if ((childCountDelta < 0 || finishedParsingCallback) && newLastChild == lastElementBeforeInsertion && newLastChild && newLastChild->renderStyle() && !newLastChild->renderStyle()->lastChildState())
+ if ((childCountDelta < 0 || finishedParsingCallback) && newLastChild == lastElementBeforeInsertion && newLastChild && (!newLastChild->renderStyle() || !newLastChild->renderStyle()->lastChildState()))
newLastChild->setNeedsStyleRecalc();
}