Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[layout] Perform replaced aspect-ratio calculation with doubles. #22447

Merged
merged 1 commit into from Mar 28, 2020

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Mar 25, 2020

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}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot changed the title [layout] Perform replaced aspect-ratio calculation in LayoutUnits. [layout] Perform replaced aspect-ratio calculation with doubles. Mar 26, 2020
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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants