aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/flex.rs
diff options
context:
space:
mode:
authorNick Price <nick@spun.io>2017-08-25 15:50:08 -0400
committerNick Price <nick@spun.io>2017-08-26 12:48:07 -0400
commit684816bfb32b99dff293deb698f3f66b2fe7f6c3 (patch)
treebab1e7801f6fd24a25a758c99378bc479d6c5fb1 /components/layout/flex.rs
parent1e0ebf1c1ac6b00a7503dacecfa395df7daed229 (diff)
downloadservo-684816bfb32b99dff293deb698f3f66b2fe7f6c3.tar.gz
servo-684816bfb32b99dff293deb698f3f66b2fe7f6c3.zip
Check if line_count is zero to calculate space around line
Diffstat (limited to 'components/layout/flex.rs')
-rw-r--r--components/layout/flex.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index 24a377483d1..cd727c07e9c 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -713,14 +713,18 @@ impl FlexFlow {
line_interval = match line_align {
align_content::T::space_between => {
- if line_count == 1 {
+ if line_count <= 1 {
Au(0)
} else {
free_space / (line_count - 1)
}
}
align_content::T::space_around => {
- free_space / line_count
+ if line_count == 0 {
+ Au(0)
+ } else {
+ free_space / line_count
+ }
}
_ => Au(0),
};