mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
When rounding a CSSPixelRect to a DevicePixelRect, we simply pulled its
width and height through round() and called it a day. Unfortunately this
could negatively affect the rect's perceived positioning.
A rect at { 0.5, 0.0 } with size { 19.5 x 20.0 } should have its right
edge at position 20, but after rounding it would end up at { 1, 0 } with
size { 20 x 20 }, causing its right edge to be at position 21 instead.
Fix this by first rounding the right and bottom edges of the input rect,
and then determining the dimensions by subtracting its rounded position.
Fixes #245.
27 lines
509 B
HTML
27 lines
509 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
.a {
|
|
display: grid;
|
|
grid-template-columns: repeat(5, 1fr);
|
|
gap: 1px;
|
|
width: 147px;
|
|
}
|
|
.b {
|
|
background-color: black;
|
|
height: 30px;
|
|
}
|
|
</style>
|
|
<div class="a">
|
|
<div class="b"></div>
|
|
<div class="b"></div>
|
|
<div class="b"></div>
|
|
<div class="b"></div>
|
|
<div class="b"></div>
|
|
</div>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
println(internals.dumpDisplayList());
|
|
});
|
|
</script>
|