blob: 48945d62c9d4d2f4a7b372d3bf358f52670eaba0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/runner.js"></script>
<script src="resources/utils.js"></script>
<style>
</style>
</head>
<body>
<script>
for (let i = 0; i < 5000; i++) {
let div = document.createElement('div');
div.style = 'color: red'; // Avoid matched properties cache.
document.body.appendChild(div);
}
let props = [];
let value = 2**32;
for (let i = 0; i < 1000; i++) {
props.push(`--property-with-long-name-and-value-${i}: ${value.toString(2)};`);
// Use a unique value every time to avoid optimization that might
// utilize identical values.
value--;
}
applyCSSRule(`:root { ${props.join('\n')} }`);
applyCSSRule(':root { --x: 0; --y: var(--x); }');
PerfTestRunner.measureTime({
description: 'Measure impact of unused custom properties at :root.',
run: function() {
document.body.style = 'display: none';
forceStyleRecalc(document.body);
document.body.style = '';
forceStyleRecalc(document.body);
}
});
</script>
</body>
</html>