gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 10TOML 3CSS 1350 Definitions

if let

94229aba20d23fb3a42728bceee485ee0205ab2f · by Emil Sjölander · (7 years ago) · parent 010e75b80 · browse the tree at this commit

Semantic delta · 1

src/algo.rs

1 files · +5 −3

diff --git a/src/algo.rs b/src/algo.rs
index e7c303fca..2d504b0de 100644
--- a/src/algo.rs
+++ b/src/algo.rs
@@ -335,9 +335,11 @@ fn compute_internal(
         //    cross size and the flex item’s intrinsic aspect ratio.
 
         if let Defined(ratio) = child.node.aspect_ratio {
-            if node_size.cross(node.flex_direction).is_defined() && child.node.flex_basis == style::Dimension::Auto {
-                child.flex_basis = (node_size.cross(node.flex_direction) * ratio).or_else(0.0);
-                return;
+            if let Defined(cross) = node_size.cross(node.flex_direction) {
+                if child.node.flex_basis == style::Dimension::Auto {
+                    child.flex_basis = cross * ratio;
+                    return;
+                }
             }
         }