Skip to content

Commit

Permalink
Add assertion that this is not a flex item
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Sep 29, 2016
1 parent abe8c0d commit 81676ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion components/layout/block.rs
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions components/util/lib.rs
Expand Up @@ -46,11 +46,11 @@ pub fn servo_version() -> String {
}

pub fn clamp<T: Ord>(lo: T, mid: T, hi: T) -> T {
if mid < lo {
lo
} else if mid > hi {
hi
} else {
mid
}
}
if mid < lo {
lo
} else if mid > hi {
hi
} else {
mid
}
}

0 comments on commit 81676ea

Please sign in to comment.