mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-31 23:42:52 +00:00
That's awkward, but getComputedStyle needs to return used track values for gridTemplateColumns and gridTemplateRows properties. This change implements it by saving style values with used values into layout state, so it could be assigned to paintables during LayoutState::commit() and later accessed by style_value_for_property(). I haven't seen it used in the wild, but WPT grid tests extensively use it. For example this change helps to go from 0/10 to 8/10 on this test: https://wpt.live/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
21 lines
666 B
HTML
21 lines
666 B
HTML
<script src="include.js"></script>
|
|
<style>
|
|
.grid-container {
|
|
width: 200px;
|
|
display: grid;
|
|
background-color: lightsalmon;
|
|
}
|
|
|
|
.grid-item {
|
|
height: 50px;
|
|
background-color: lightblue;
|
|
}
|
|
</style>
|
|
<div class="grid-container" style="grid-template-columns: auto auto"><div class="grid-item"></div><div class="grid-item"></div><div class="grid-item"></div><div class="grid-item"></div></div>
|
|
<script>
|
|
test(() => {
|
|
const grid = document.querySelector(".grid-container");
|
|
println(getComputedStyle(grid).gridTemplateColumns);
|
|
println(getComputedStyle(grid).gridTemplateRows);
|
|
});
|
|
</script>
|