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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html

Issue 2117143003: Add a fast-path for independent inherited properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@computedstyle_cleanup_rename_final_member_fields
Patch Set: Review feedback Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-multiple-properties.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html
new file mode 100644
index 0000000000000000000000000000000000000000..7562b19629c9e43d71789c7da2237609947b8cc3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<div id="testContainer">
+ <div id="outer">
+ <div id="inner">
+ <div id="innermost"></div>
+ </div>
+ </div>
+</div>
+<script>
+
+var independent_properties = [
+ // Property name, Value 1, Value 2
+ ["pointerEvents", "auto", "all"],
+ ["visibility", "visible", "hidden"],
+];
+
+independent_properties.forEach(function(test_data)
+{
+ var propertyName = test_data[0];
+ var value1 = test_data[1];
+ var value2 = test_data[2];
+
+ test(function(t)
+ {
+ if (!window.internals)
+ assert_unreached('This test requires window.internals.');
+
+ // Create a nested div structure for the test.
+ var outer = document.createElement("div");
+ var inner = document.createElement("div");
+ var innermost = document.createElement("div");
+ testContainer.appendChild(outer);
+ outer.appendChild(inner);
+ inner.appendChild(innermost);
+
+ outer.offsetTop; // Force recalc.
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0);
+
+ // Set the whole container to the first value.
+ testContainer.style[propertyName] = value1;
+
+ // All elements start as the first value.
+ assert_equals(getComputedStyle(outer)[propertyName], value1);
+ assert_equals(getComputedStyle(inner)[propertyName], value1);
+ assert_equals(getComputedStyle(innermost)[propertyName], value1);
+ outer.offsetTop; // Force recalc.
+
+ // Changing outer also changes inner and innermost.
+ outer.style[propertyName] = value2;
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Only outer should be recalced (3 without fast path)");
+
+ assert_equals(getComputedStyle(outer)[propertyName], value2);
+ assert_equals(getComputedStyle(inner)[propertyName], value2);
+ assert_equals(getComputedStyle(innermost)[propertyName], value2);
+ outer.offsetTop; // Force recalc.
+
+ // Changing inner to value1 changes all its children to that value.
+ inner.style[propertyName] = value1;
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Only inner should be recalced (2 without fast path)");
+
+ assert_equals(getComputedStyle(outer)[propertyName], value2);
+ assert_equals(getComputedStyle(inner)[propertyName], value1);
+ assert_equals(getComputedStyle(innermost)[propertyName], value1);
+ outer.offsetTop; // Force recalc.
+
+ // Clear for next test.
+ outer.remove();
+ }, "Changing " + propertyName + ", an independent inherited property, propagates correctly with a single style recalc.");
+})
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-multiple-properties.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698