Skip to content

Commit 8fe6ed4

Browse files
[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 <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Cr-Commit-Position: refs/heads/master@{#832193}
1 parent 5c5e2f0 commit 8fe6ed4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<link rel="author" title="David Grogan" href="mailto:[email protected]">
3+
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto">
4+
<link rel="help" href="https://crbug.com/1151608">
5+
<meta name="assert" content="automatic minimum size computation doesn't overflow when multiplying by the aspect ratio" />
6+
7+
<script src="/resources/testharness.js"></script>
8+
<script src="/resources/testharnessreport.js"></script>
9+
<script src="/resources/check-layout-th.js"></script>
10+
11+
<body onload="checkLayout('img')">
12+
13+
<div id=log></div>
14+
15+
<div style="display: flex; width: 300px;">
16+
<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;">
17+
</div>
18+
19+
<div style="display: flex; flex-direction: column; height: 300px;">
20+
<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;">
21+
</div>
22+
23+
</body>

0 commit comments

Comments
 (0)