Add assertion that this is not a flex item

This commit is contained in:
Michael Howell 2016-09-27 16:39:05 -07:00
parent abe8c0d457
commit 81676ea9d2
2 changed files with 11 additions and 9 deletions

View file

@ -1485,11 +1485,13 @@ impl BlockFlow {
// * Flex items cannot also be floats. // * Flex items cannot also be floats.
// Therefore, a flex item cannot be impacted by a float. // Therefore, a flex item cannot be impacted by a float.
// See also: https://www.w3.org/TR/css-flexbox-1/#flex-containers // 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() { if !self.base.might_have_floats_in() {
return 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. // Compute the available space for us, based on the actual floats.
let rect = self.base.floats.available_rect( let rect = self.base.floats.available_rect(
self.base.position.start.b, self.base.position.start.b,

View file

@ -46,11 +46,11 @@ pub fn servo_version() -> String {
} }
pub fn clamp<T: Ord>(lo: T, mid: T, hi: T) -> T { pub fn clamp<T: Ord>(lo: T, mid: T, hi: T) -> T {
if mid < lo { if mid < lo {
lo lo
} else if mid > hi { } else if mid > hi {
hi hi
} else { } else {
mid mid
} }
} }