lloydw/libRocket — pull request #24 by robn (2011-10-12 22:23:48+00:00)
Title: Preserve ratio of replaced elements when resizing

This arranges for replaced elements to retain their aspect ratio when being scaled if they have one and only one of "width: auto" or "height: auto". This is good where the context dimensions/ratio is variable, as is the case with a typical PC game.

[CSS2 10.3.2](http://www.w3.org/TR/CSS2/visudet.html#inline-replaced-width) is the relevant part of the CSS spec:

> If 'height' and 'width' both have computed values of 'auto' and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio; or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value of 'width' is:
>
> (used height) * (intrinsic ratio)