LibWeb: Respect box-sizing value when getting width/height used value

This commit is contained in:
Tim Ledbetter
2026-03-10 23:38:42 +00:00
committed by Jelle Raaijmakers
parent 9d2ebe90ed
commit 8179efb38e
Notes: github-actions[bot] 2026-03-11 10:34:35 +00:00
3 changed files with 49 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<style>
#border-box {
box-sizing: border-box;
width: 120px;
height: 80px;
border: 10px solid black;
}
#content-box {
width: 120px;
height: 80px;
border: 10px solid black;
}
</style>
<script src="../include.js"></script>
<div id="border-box"></div>
<div id="content-box"><div style="height: 90px;"></div></div>
<script>
function dump_used_values(label, style, properties) {
for (let property of properties)
println(`${label} ${property}: ${style.getPropertyValue(property)}`);
}
test(() => {
const borderBox = document.getElementById("border-box");
const contentBox = document.getElementById("content-box");
dump_used_values("border-box", getComputedStyle(borderBox), ["width", "height"]);
dump_used_values("content-box", getComputedStyle(contentBox), ["width", "height"]);
});
</script>