Chromium Code Reviews| Index: PerformanceTests/CSS/ClassInvalidation.html |
| diff --git a/PerformanceTests/CSS/ClassInvalidation.html b/PerformanceTests/CSS/ClassInvalidation.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1df6f4ce37f498d8727928d9aee9a02816d467a1 |
| --- /dev/null |
| +++ b/PerformanceTests/CSS/ClassInvalidation.html |
| @@ -0,0 +1,34 @@ |
| +<!DOCTYPE html> |
| +<script src="../resources/runner.js"></script> |
| +<style> |
| +.a .b { background-color: green } |
| +</style> |
| +<div id="root"></div> |
| +<script> |
| +function appendDivChildren(root, childCount, levels) { |
| + if (levels <= 0) |
| + return; |
| + for (var i = 0; i < childCount; i++) { |
| + var div = document.createElement("div"); |
| + appendDivChildren(div, childCount, levels - 1) |
| + root.appendChild(div); |
| + } |
| +} |
| + |
| +var root = document.createElement("div"); |
| +appendDivChildren(root, 5, 5); |
| +root.firstChild.className = "b"; |
| +document.body.appendChild(root); |
| +document.body.offsetTop; // force style recalc. |
| + |
| +PerfTestRunner.measureRunsPerSecond({ |
| + description: "Measure the style recalc performance when changing a class affecting the style of a single descendant.", |
| + run: function() { |
| + // Modifying top on a static positioned, which should not cause a layout, in order |
|
rune
2014/06/04 21:23:15
Ouch. Copy-past issue.
rune
2014/06/04 21:26:57
Done.
|
| + // to measure style recalc only. |
| + root.className = "a"; |
| + root.offsetLeft; // force recalc. |
| + root.className = ""; |
| + root.offsetLeft; // force recalc. |
| + }}); |
| +</script> |