From 81676ea9d268aab88abab7a52ff88bff91298f54 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 27 Sep 2016 16:39:05 -0700 Subject: [PATCH] Add assertion that this is not a flex item --- components/layout/block.rs | 4 +++- components/util/lib.rs | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index afc1f9e7180a..e8eb66cb9ac6 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1485,11 +1485,13 @@ impl BlockFlow { // * Flex items cannot also be floats. // Therefore, a flex item cannot be impacted by a float. // See also: https://www.w3.org/TR/css-flexbox-1/#flex-containers - // This line is not just an optimization. It's also needed for correctness. if !self.base.might_have_floats_in() { return } + // If you remove the might_have_floats_in conditional, this will go off. + debug_assert!(!self.is_flex()); + // Compute the available space for us, based on the actual floats. let rect = self.base.floats.available_rect( self.base.position.start.b, diff --git a/components/util/lib.rs b/components/util/lib.rs index edc4a27da421..11b6afbbc8e7 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -46,11 +46,11 @@ pub fn servo_version() -> String { } pub fn clamp(lo: T, mid: T, hi: T) -> T { - if mid < lo { - lo - } else if mid > hi { - hi - } else { - mid - } -} \ No newline at end of file + if mid < lo { + lo + } else if mid > hi { + hi + } else { + mid + } +}