servo/tests/blink_perf_tests/perf_tests/paint/contain-update-layer-tree.html
Jonathan Schwender ee781b71b4
tests: Vendor blink perf tests (#38654)
Vendors the [blink perf
tests](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/perf_tests/).
These perf tests are useful to evaluate the performance of servo. 
The license that governs the perf tests is included in the folder. 
Running benchmark cases automatically is left to future work.

The update.py script is taken from mozjs and slightly adapted, so we can
easily filter
(and patch if this should be necessary in the future.

Testing: This PR just adds the perf_tests, but does not use or modify
them in any way.

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-08-17 09:54:04 +00:00

72 lines
1.8 KiB
HTML
Vendored

<!DOCTYPE html>
<title>Contain update layer tree performance</title>
<style>
#wrapper {
position: relative;
}
.cell {
position: absolute;
box-sizing: border-box;
border: solid;
contain: strict;
}
.progressbar {
position: absolute;
left: 0px;
top: 5px;
height: 10px;
}
</style>
<script src="../resources/runner.js"></script>
<script src="resources/paint.js"></script>
<pre id="log"></pre>
<div id="wrapper"></div>
<script>
const CELL_WIDTH = "50";
const CELL_HEIGHT = "25";
const NUM_ROWS = 120;
const NUM_COLUMNS = 120;
const DOM_DEPTH = 10;
function createContent(depth) {
let content = document.createElement("div");
content.appendChild(document.createElement("h1"));
content.appendChild(document.createElement("paragraph"));
if (depth > 0)
content.appendChild(createContent(depth - 1));
return content;
}
function setupTest() {
let wrapper = document.getElementById("wrapper");
for (let i = 0; i < NUM_ROWS; i++) {
for (let j = 0; j < NUM_COLUMNS; j++) {
let cell = document.createElement("div");
if (i == 0 && j == 0)
cell.id = "target";
cell.classList.add("cell");
cell.style.width = CELL_WIDTH + "px";
cell.style.height = CELL_HEIGHT + "px";
cell.style.left = (j * CELL_WIDTH) + "px";
cell.style.top = (i * CELL_HEIGHT) + "px";
cell.style.overflow = "visible";
cell.appendChild(createContent(DOM_DEPTH));
wrapper.appendChild(cell);
}
}
}
function runTest() {
let cell = document.getElementById("target");
// This causes a call to PaintLayer::SetNeedsCompositingInputsUpdate().
cell.style.overflow = cell.style.overflow == "hidden" ? "visible" : "hidden";
}
setupTest();
measurePaint({
run: runTest
});
</script>