Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: LayoutTests/fast/css/invalidation/style-invalidation-before-attach.html

Issue 273783003: Don't schedule invalidations when attributes changed if not needed or incorrect. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add some styleChangeType() < SubtreeStyleChange checks in ContainerNode. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/invalidation/style-invalidation-before-attach.html
diff --git a/LayoutTests/fast/css/invalidation/style-invalidation-before-attach.html b/LayoutTests/fast/css/invalidation/style-invalidation-before-attach.html
new file mode 100644
index 0000000000000000000000000000000000000000..7a0a814751667b3073c7f324c18b35f2970bdc11
--- /dev/null
+++ b/LayoutTests/fast/css/invalidation/style-invalidation-before-attach.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<style>
+[attr] div {
+ color: red;
+}
+[attr] .baz {
+ color: blue;
+}
+</style>
+
+<div id="a"></div>
+
+<script>
+onload = function() {
+ document.body.offsetTop;
+
+ var foo = document.createElement("div");
+ foo.id = "foo";
+ foo.innerHTML = "<div id=bar><div id=baz>This should be blue.</div></div>";
+
+ // Append foo but not attach it.
+ a.appendChild(foo);
+
+ // Schedule invalidation on bar which sets childNeedsStyleInvalidation on foo.
+ bar.setAttribute("attr", "attr");
+
+ // Remove from the tree and clear all invalidation bits, but foo still has them
+ // since it's not in the tree.
+ foo.remove();
+ document.body.offsetTop;
+
+ // Add foo back and attach it.
+ a.appendChild(foo);
+ document.body.offsetTop;
+
+ // Schedule invalidation, but it won't get above foo since the bits are
+ // incorrectly set.
+ baz.className = "baz";
+};
+</script>

Powered by Google App Engine
This is Rietveld 408576698