[layout] Perform replaced aspect-ratio calculation with doubles. #22447
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See bug for more detailed information.
Basically the site in the bug had images all with an aspect ratio of 1/1.
With browser zoom, we hit a situation where the width != height due to
a loss of precision in the conversion from:
LayoutUnit -> float -> LayoutUnit.
Resulting in a LayoutUnit(1) difference in the width and height.
This patch changes the aspect-ratio calculation to use doubles meaning
we retain some precision in the:
LayoutUnit -> double -> LayoutUnit conversion.
Bug: 1052370
Change-Id: Ic242c224fec17eeec8f1469c0a6c1fe2ed85c4d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2117464
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754238}