Skip to content

Commit

Permalink
Bug 1679672 [wpt PR 26668] - [css-flex] Fix LayoutUnit overflow in au…
Browse files Browse the repository at this point in the history
…tomatic minimum size calculation, a=testonly

Automatic update from web-platform-tests
[css-flex] Fix LayoutUnit overflow in automatic minimum size calculation

When using the aspect ratio, we were doing
size = large1 * large2 / large3.
large1 * large2 was overflowing LayoutUnit.

Now we do those calculations with the operands as doubles. We still
multiply first because *most* of the time these values will all be
integers, and all the integers up to LayoutUnit::Max()*LayoutUnit::Max()
can be exactly represented with double precision.

Change-Id: Id714f38493554c5f1b7e4dfe56bdaa6742f3d8a5
Fixed: 1151608
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2564199
Commit-Queue: David Grogan <dgrogan@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832193}

--

wpt-commits: 8fe6ed48ed74a30c5f7e159d3108dbb85919e4cf
wpt-pr: 26668
  • Loading branch information
davidsgrogan authored and moz-wptsync-bot committed Dec 7, 2020
1 parent 8a0df0c commit 369b67b
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto">
<link rel="help" href="https://crbug.com/1151608">
<meta name="assert" content="automatic minimum size computation doesn't overflow when multiplying by the aspect ratio" />

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>

<body onload="checkLayout('img')">

<div id=log></div>

<div style="display: flex; width: 300px;">
<img src="data:image/svg+xml,%3Csvg viewBox='0 0 1 1' width='8000' height='8000' xmlns='http://www.w3.org/2000/svg' %3E%3C/svg%3E" data-expected-width=8000 style="height: 8000px;">
</div>

<div style="display: flex; flex-direction: column; height: 300px;">
<img src="data:image/svg+xml,%3Csvg viewBox='0 0 1 1' width='8000' height='8000' xmlns='http://www.w3.org/2000/svg' %3E%3C/svg%3E" data-expected-height=8000 style="width: 8000px;">
</div>

</body>

0 comments on commit 369b67b

Please sign in to comment.