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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/invalidation/non-independent-inheritance-identical-computed-styles.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
Index: third_party/WebKit/LayoutTests/fast/css/invalidation/non-independent-inheritance-identical-computed-styles.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/non-independent-inheritance-identical-computed-styles.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/non-independent-inheritance-identical-computed-styles.html
new file mode 100644
index 0000000000000000000000000000000000000000..711924e169d36b9233c6618765e08bc9f2f75fa0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/non-independent-inheritance-identical-computed-styles.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<div id="outer">
+ <div id="inner">
+ <div id="innermost">
+ </div>
+ </div>
+</div>
+<script>
+test(function(t)
+{
+ if (!window.internals)
+ assert_unreached('This test requires window.internals.');
+
+ outer.style.fontSize = "16px";
+ innermost.style.fontSize = "1em";
+
+ inner.offsetTop; // Force recalc.
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0);
+
+ assert_equals(getComputedStyle(outer).fontSize, "16px");
+ assert_equals(getComputedStyle(inner).fontSize, "16px");
+ assert_equals(getComputedStyle(innermost).fontSize, "16px");
+
+ inner.offsetTop; // Force recalc.
+ outer.style.fontSize = '10px';
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3);
+
+ assert_equals(getComputedStyle(outer).fontSize, "10px");
+ assert_equals(getComputedStyle(inner).fontSize, "10px");
+ assert_equals(getComputedStyle(innermost).fontSize, "10px");
+
+ inner.offsetTop; // Force recalc.
+ inner.style.fontSize = '16px';
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2);
+
+ assert_equals(getComputedStyle(outer).fontSize, "10px");
+ assert_equals(getComputedStyle(inner).fontSize, "16px");
+ assert_equals(getComputedStyle(innermost).fontSize, "16px");
+}, "Changing font-size (a non-independent inherited property) in a way that results in an identical ComputedStyle still triggers a style recalc for its children.");
+
+test(function(t)
+{
+ if (!window.internals)
+ assert_unreached('This test requires window.internals.');
+
+ outer.style.fontWeight = "normal";
+ innermost.style.fontWeight = "lighter";
+
+ inner.offsetTop; // Force recalc.
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 0);
+
+ assert_equals(getComputedStyle(outer).fontWeight, "normal");
+ assert_equals(getComputedStyle(inner).fontWeight, "normal");
+ assert_equals(getComputedStyle(innermost).fontWeight, "100");
+
+ inner.offsetTop; // Force recalc.
+ inner.style.fontWeight = 'bolder';
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2);
+
+ assert_equals(getComputedStyle(outer).fontWeight, "normal");
+ assert_equals(getComputedStyle(inner).fontWeight, "bold");
+ assert_equals(getComputedStyle(innermost).fontWeight, "normal");
+
+ inner.offsetTop; // Force recalc.
+ outer.style.fontWeight = 'bold';
+ assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3);
+
+ assert_equals(getComputedStyle(outer).fontWeight, "bold");
+ assert_equals(getComputedStyle(inner).fontWeight, "900");
+ assert_equals(getComputedStyle(innermost).fontWeight, "bold");
+}, "Changing font-weight (a non-independent inherited property) in a way that results in an identical ComputedStyle still triggers a style recalc for its children.");
+</script>

Powered by Google App Engine
This is Rietveld 408576698