Bug 1374233 - Part 4: Add NonNegativeLengthOr{Auto|Normal|Number}.

Add NonNegativeLength, which could be computed to NonNegativeAu. So we
can declare Either<NonNegativeLength, X>, X=Auto, Normal, or Number.

NonNegativeLengthOrAuto is for column-width.
NonNegativeLengthOrNormal is for column-gap.
NonNegativeLengthOrNumber is for -moz-tab-size.

MozReview-Commit-ID: AfU8XpA1um0
This commit is contained in:
Boris Chiou 2017-07-20 16:27:35 +08:00
parent 234d2c1b32
commit 2ef38ce67a
8 changed files with 68 additions and 20 deletions

View file

@ -98,14 +98,14 @@ impl Flow for MulticolFlow {
let column_style = self.block_flow.fragment.style.get_column();
let column_gap = match column_style.column_gap {
Either::First(len) => len,
Either::First(len) => len.0,
Either::Second(_normal) => self.block_flow.fragment.style.get_font().font_size.0,
};
let mut column_count;
if let Either::First(column_width) = column_style.column_width {
column_count =
max(1, (content_inline_size + column_gap).0 / (column_width + column_gap).0);
max(1, (content_inline_size + column_gap).0 / (column_width.0 + column_gap).0);
if let Either::First(specified_column_count) = column_style.column_count {
column_count = min(column_count, specified_column_count as i32);
}