Commit graph

5 commits

Author SHA1 Message Date
aplefull
a0a3bfbee7 LibWeb: Use single-step division for aspect-ratio in default sizing
When background-size specifies only a width, the missing height was
computed as `(CSSPixels(1) / ratio) * width`. The intermediate
`CSSPixels(1) / ratio` step truncates the inverse ratio and loses
enough precision to produce a visible error in the final height for some
ratios.

Now we do the division in one step, so the full precision is preserved.
2026-06-01 00:04:21 +02:00
Tim Ledbetter
80977b5fea LibWeb: Apply contain constraint in default image sizing algorithm
When an image has no intrinsic dimensions but has an intrinsic aspect
ratio, the CSS default sizing algorithm should resolve its size as a
contain constraint against the default object size. Previously, we
returned the default size directly, which caused such images to stretch
to fill the entire background positioning area. The SVG's default
`preserveAspectRatio` would then center the content within that
oversized viewport, making the image appear horizontally mispositioned.
2026-03-03 17:14:19 +01:00
Timothy Flynn
ea32502947 Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-21 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")
2026-02-18 08:02:45 -05:00
Jonathan Gamble
b8ee6ec476 LibWeb: Use SizeWithAspectRatio struct 2026-02-02 14:36:49 +00:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibWeb/CSS/Sizing.cpp (Browse further)