dillo-browser / dillo

Dillo, a multi-platform graphical web browser
https://dillo-browser.github.io/
GNU General Public License v3.0
575 stars 30 forks source link

Preserve aspect ratio of images #242

Closed rodarima closed 1 month ago

rodarima commented 3 months ago

A common problem for images is that only one dimension is given {height,width} or that a range is set by {min,max}-{height,width}. Previously, the original size of the image was used to compute the aspect ratio and then fill the missing dimension.

But the procedure requires more steps to fulfill all constraints. This PR tries to cover all posible cases of constrained images while preserving the aspect ratio. When is not posible, the aspect ratio is distorted to fit the size constraints.

TODO


How it looks Before: ![image](https://github.com/user-attachments/assets/67426e04-b312-4184-bf9a-b6537c2389e7) After: ![image](https://github.com/user-attachments/assets/6d0b172a-3391-4a6d-b078-05e1b9ae4584)
rodarima commented 1 month ago

Testing with float images improves when compared with the previous behavior, but continues to show problems when computing the parent requisition. I think we can leave this for a future PR, to avoid stalling this one forever.