mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Avoid division by zero with small aspect ratios
This commit is contained in:
committed by
Alexander Kalenik
parent
cd0074528e
commit
5478361ba0
Notes:
github-actions[bot]
2025-07-13 03:42:58 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/5478361ba06 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5421 Reviewed-by: https://github.com/kalenikaliaksandr
@@ -2,11 +2,18 @@
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const element = document.createElement("div");
|
||||
element.style.width = "100px";
|
||||
element.style.aspectRatio = ".0000000000001 / .00000000000001";
|
||||
document.body.appendChild(element);
|
||||
println(`element height: ${element.clientHeight}px`);
|
||||
element.remove();
|
||||
const smallAspectRatios = [
|
||||
".0000000000001 / .00000000000001",
|
||||
"1/0.00000000000001",
|
||||
"0.00000000000001/1",
|
||||
];
|
||||
for (const ratio of smallAspectRatios) {
|
||||
const element = document.createElement("div");
|
||||
element.style.width = "100px";
|
||||
element.style.aspectRatio = ratio;
|
||||
document.body.appendChild(element);
|
||||
println(`element height: ${element.clientHeight}px`);
|
||||
element.remove();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user