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..d293d64e417f1b4ed5b3d000f902a7277f241575 |
| --- /dev/null |
| +++ b/PerformanceTests/CSS/ClassInvalidation.html |
| @@ -0,0 +1,32 @@ |
| +<!DOCTYPE html> |
| +<script src="../resources/runner.js"></script> |
| +<style> |
| +.a .b { background-color: green } |
| +</style> |
| +<div id="root"></div> |
|
rune
2014/06/04 22:42:40
This is not in use. I must go to sleep now.
rune
2014/06/04 22:44:52
Fixed.
|
| +<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() { |
| + root.className = "a"; |
| + root.offsetTop; // force recalc. |
| + root.className = ""; |
| + root.offsetTop; // force recalc. |
| + }}); |
| +</script> |