Bug 1374233 - Part 5: Use NonNegativeLength and NonNegativeAu for border-spacing.

We already have NonNegativeLength and NonNegativeAu, so we can re-use it
to define the specified value and the computed value of border-spacing.
And then implement ToAnimatedValue for it.

MozReview-Commit-ID: CLckpKMYVXU
This commit is contained in:
Boris Chiou 2017-07-21 13:35:06 +08:00
parent 2ef38ce67a
commit 190cd5b952
8 changed files with 67 additions and 33 deletions

View file

@ -25,7 +25,7 @@ use style::computed_values::{border_collapse, border_spacing, border_top_style};
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
use style::properties::ComputedValues;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use style::values::computed::{Color, LengthOrPercentageOrAuto};
use style::values::computed::{Color, LengthOrPercentageOrAuto, NonNegativeAu};
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
use table_cell::{CollapsedBordersForCell, TableCellFlow};
@ -93,8 +93,8 @@ impl TableRowFlow {
column_computed_inline_sizes: Vec::new(),
incoming_rowspan: Vec::new(),
spacing: border_spacing::T {
horizontal: Au(0),
vertical: Au(0),
horizontal: NonNegativeAu::zero(),
vertical: NonNegativeAu::zero(),
},
table_writing_mode: writing_mode,
preliminary_collapsed_borders: CollapsedBordersForRow::new(),
@ -395,7 +395,7 @@ impl Flow for TableRowFlow {
None => break,
};
column_computed_inline_size.size = column_computed_inline_size.size +
extra_column_computed_inline_size.size + self.spacing.horizontal;
extra_column_computed_inline_size.size + self.spacing.horizontal.0;
col += 1;
}
@ -818,7 +818,7 @@ fn set_inline_position_of_child_flow(
let column_inline_size = column_computed_inline_sizes[*column_index].size;
let border_inline_size = match *border_collapse_info {
Some(_) => Au(0), // FIXME: Make collapsed borders account for colspan/rowspan.
None => border_spacing.horizontal,
None => border_spacing.horizontal.0,
};
if reverse_column_order {
*inline_end_margin_edge += column_inline_size + border_inline_size;
@ -873,9 +873,9 @@ fn set_inline_position_of_child_flow(
None => {
// Take spacing into account.
if reverse_column_order {
*inline_end_margin_edge += border_spacing.horizontal;
*inline_end_margin_edge += border_spacing.horizontal.0;
} else {
*inline_start_margin_edge += border_spacing.horizontal;
*inline_start_margin_edge += border_spacing.horizontal.0;
}
}
}