haikuwebkit/PerformanceTests/Layout/nested-flexboxes-percentage...

47 lines
1.2 KiB
HTML
Raw Permalink Normal View History

[css-flexbox] CDC COVID Vaccine Tracker: Safari garbles data table https://bugs.webkit.org/show_bug.cgi?id=222581 Reviewed by Zalan Bujtas. PerformanceTests: * Layout/nested-flexboxes-percentage-flex-basis.html: Added. Source/WebCore: With nested flexboxes in which the flex-basis is a percentage the current code that stretches the item forces a relayout of the children because it thinks it has percentage height descendants. That happens because we call computePercentageLogicalHeights() with a mock percentage length to check whether a size is definite and that call performs the addPercentageHeightDescendants() call. We should avoid calling the latter in those cases as we're just trying to figure out whether we can compute the flex-basis used value or not. Adding a new parameter to the aforementioned method so that the percentage height descendants map could be left untouched in those cases where we just want to test size definiteness. Apart from making the implementation more correct this brings some performance improvements for the cases described in the first paragraph as it can be seen in the provided performance test (24.5% of improvement). * rendering/RenderBox.cpp: (WebCore::RenderBox::computePercentageLogicalHeight const): * rendering/RenderBox.h: * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::canComputePercentageFlexBasis const): (WebCore::RenderFlexibleBox::childMainSizeIsDefinite const): (WebCore::RenderFlexibleBox::useChildOverridingMainSizeForPercentageResolution): * rendering/RenderFlexibleBox.h: LayoutTests: * TestExpectations: Unskipped a WPT test which is now passing. Canonical link: https://commits.webkit.org/236438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275873 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-13 09:14:23 +00:00
<!DOCTYPE html>
<head>
<style>
.flex {
display: flex;
flex: 1 0 100%;
}
.col { flex-direction: column; }
.row { flex-direction: row; }
</style>
<script src="../resources/runner.js"></script>
<script>
function startTest() {
document.body.offsetHeight;
var index = 0;
PerfTestRunner.measureRunsPerSecond({run: function() {
document.body.style.width = ++index % 2 ? "99%" : "98%";
document.body.offsetHeight;
}});
}
</script>
</head>
<body onload="startTest()">
<div class="flex row" style="flex: none;">
<div class="flex col">
<div class="flex row">
<div class="flex col">
<div class="flex row">
<div class="flex col">
<div class="flex row">
<div class="flex col">
<div class="flex row">
<div class="flex col">
<div class="flex row"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>