Commit e8dff94a authored by David Grogan's avatar David Grogan Committed by Commit Bot

[FlexNG] Perf test for stretching in a row flexbox

An item that stretches to a flexbox's previously-indefinite height
should use cached results when its sibling item changes the flexbox's
height.

NG is slower than legacy but there's a fix at
https://chromium-review.googlesource.com/c/chromium/src/+/2154489

Bug: 845235
Change-Id: I4687742c20cae6aaa97bf34933c458f4308b8837
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2158490Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: David Grogan <dgrogan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761121}
parent 51a605c5
<!DOCTYPE html>
<html>
<head>
<script src="../resources/runner.js"></script>
<style>
* {
/* Make the text the same size in chrome and firefox. */
font-family: "Times New Roman";
font-size: 16px;
}
</style>
</head>
<body>
<div style="display: flex; width: 800px; background: orange;">
<div id="neighbor" style="width: 50px;"></div>
<!-- 750px lets the text not wrap. -->
<div id="test" style="width: 750px;"></div>
</div>
</body>
<script>
const test = document.querySelector('#test');
for (let i = 0; i < 60; i++) {
test.innerHTML += '<div style="height: 1%">some stuff here blah blah blah blah blah blah blah blah blah blah blah blah blah</div>';
}
const neighbor = document.querySelector("#neighbor");
function runTest()
{
// When #neighbor changes height, #test shouldn't have to relayout.
// 1200px is higher than #test's intrinsic block size and its pre-stretched
// layout size. Performance characteristics change if that's not the case.
neighbor.style.height = "1200px";
PerfTestRunner.forceLayout();
neighbor.style.height = "1300px";
PerfTestRunner.forceLayout();
}
PerfTestRunner.measureRunsPerSecond({
description: "Ensures cache hits for stretched flex items in a row flexbox with indefinite height, when the flexbox changes heights.",
run: runTest,
});
</script>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment