mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
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:
parent
2ef38ce67a
commit
190cd5b952
8 changed files with 67 additions and 33 deletions
|
@ -27,7 +27,7 @@ use style::logical_geometry::LogicalSize;
|
|||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use style::values::CSSFloat;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use style::values::computed::{LengthOrPercentageOrAuto, NonNegativeAu};
|
||||
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
|
||||
use table_row::TableRowFlow;
|
||||
use table_wrapper::TableLayout;
|
||||
|
@ -190,8 +190,8 @@ impl TableFlow {
|
|||
border_collapse::T::separate => style.get_inheritedtable().border_spacing,
|
||||
border_collapse::T::collapse => {
|
||||
border_spacing::T {
|
||||
horizontal: Au(0),
|
||||
vertical: Au(0),
|
||||
horizontal: NonNegativeAu::zero(),
|
||||
vertical: NonNegativeAu::zero(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ impl TableFlow {
|
|||
if num_columns == 0 {
|
||||
return Au(0);
|
||||
}
|
||||
self.spacing().horizontal * (num_columns as i32 + 1)
|
||||
self.spacing().horizontal.0 * (num_columns as i32 + 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ impl Flow for TableFlow {
|
|||
|
||||
fn assign_block_size(&mut self, _: &LayoutContext) {
|
||||
debug!("assign_block_size: assigning block_size for table");
|
||||
let vertical_spacing = self.spacing().vertical;
|
||||
let vertical_spacing = self.spacing().vertical.0;
|
||||
self.block_flow.assign_block_size_for_table_like_flow(vertical_spacing)
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use std::iter::{IntoIterator, Iterator, Peekable};
|
|||
use style::computed_values::{border_collapse, border_spacing};
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::NonNegativeAu;
|
||||
use table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||
|
||||
/// A table formatting context.
|
||||
|
@ -55,8 +56,8 @@ impl TableRowGroupFlow {
|
|||
block_flow: BlockFlow::from_fragment(fragment),
|
||||
column_intrinsic_inline_sizes: Vec::new(),
|
||||
spacing: border_spacing::T {
|
||||
horizontal: Au(0),
|
||||
vertical: Au(0),
|
||||
horizontal: NonNegativeAu::zero(),
|
||||
vertical: NonNegativeAu::zero(),
|
||||
},
|
||||
collapsed_inline_direction_border_widths_for_table: Vec::new(),
|
||||
collapsed_block_direction_border_widths_for_table: Vec::new(),
|
||||
|
@ -161,7 +162,7 @@ impl Flow for TableRowGroupFlow {
|
|||
|
||||
fn assign_block_size(&mut self, _: &LayoutContext) {
|
||||
debug!("assign_block_size: assigning block_size for table_rowgroup");
|
||||
self.block_flow.assign_block_size_for_table_like_flow(self.spacing.vertical)
|
||||
self.block_flow.assign_block_size_for_table_like_flow(self.spacing.vertical.0)
|
||||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue