Auto merge of #18525 - emilio:border-spacing, r=nox

style: various serialization fixes

This should close https://github.com/servo/servo/pull/18458, and fix https://bugzilla.mozilla.org/show_bug.cgi?id=1397619.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18525)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-17 15:12:46 -05:00 committed by GitHub
commit f95da332a3
31 changed files with 346 additions and 289 deletions

View file

@ -474,8 +474,8 @@ pub fn specified_border_radius(
containing_size: Size2D<Au>)
-> Size2D<Au>
{
let w = radius.0.width.to_used_value(containing_size.width);
let h = radius.0.height.to_used_value(containing_size.height);
let w = radius.0.width().to_used_value(containing_size.width);
let h = radius.0.height().to_used_value(containing_size.height);
Size2D::new(w, h)
}

View file

@ -29,7 +29,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, NonNegativeLength};
use style::values::computed::LengthOrPercentageOrAuto;
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
use table_row::TableRowFlow;
use table_wrapper::TableLayout;
@ -190,12 +190,7 @@ impl TableFlow {
let style = self.block_flow.fragment.style();
match style.get_inheritedtable().border_collapse {
border_collapse::T::separate => style.get_inheritedtable().border_spacing,
border_collapse::T::collapse => {
border_spacing::T {
horizontal: NonNegativeLength::zero(),
vertical: NonNegativeLength::zero(),
}
}
border_collapse::T::collapse => border_spacing::T::zero(),
}
}
@ -204,7 +199,7 @@ impl TableFlow {
if num_columns == 0 {
return Au(0);
}
Au::from(self.spacing().horizontal) * (num_columns as i32 + 1)
self.spacing().horizontal() * (num_columns as i32 + 1)
}
}
@ -471,8 +466,8 @@ 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.0;
self.block_flow.assign_block_size_for_table_like_flow(Au::from(vertical_spacing))
let vertical_spacing = self.spacing().vertical();
self.block_flow.assign_block_size_for_table_like_flow(vertical_spacing)
}
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {

View file

@ -27,7 +27,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, NonNegativeLength};
use style::values::computed::{Color, LengthOrPercentageOrAuto};
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
use table_cell::{CollapsedBordersForCell, TableCellFlow};
@ -94,10 +94,7 @@ impl TableRowFlow {
cell_intrinsic_inline_sizes: Vec::new(),
column_computed_inline_sizes: Vec::new(),
incoming_rowspan: Vec::new(),
spacing: border_spacing::T {
horizontal: NonNegativeLength::zero(),
vertical: NonNegativeLength::zero(),
},
spacing: border_spacing::T::zero(),
table_writing_mode: writing_mode,
preliminary_collapsed_borders: CollapsedBordersForRow::new(),
final_collapsed_borders: CollapsedBordersForRow::new(),
@ -397,7 +394,7 @@ impl Flow for TableRowFlow {
None => break,
};
column_computed_inline_size.size = column_computed_inline_size.size +
extra_column_computed_inline_size.size + Au::from(self.spacing.horizontal);
extra_column_computed_inline_size.size + self.spacing.horizontal();
col += 1;
}
@ -828,7 +825,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 => Au::from(border_spacing.horizontal),
None => border_spacing.horizontal(),
};
if reverse_column_order {
*inline_end_margin_edge += column_inline_size + border_inline_size;
@ -883,9 +880,9 @@ fn set_inline_position_of_child_flow(
None => {
// Take spacing into account.
if reverse_column_order {
*inline_end_margin_edge += Au::from(border_spacing.horizontal);
*inline_end_margin_edge += border_spacing.horizontal();
} else {
*inline_start_margin_edge += Au::from(border_spacing.horizontal);
*inline_start_margin_edge += border_spacing.horizontal();
}
}
}

View file

@ -22,7 +22,6 @@ 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::NonNegativeLength;
use table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
/// A table formatting context.
@ -56,10 +55,7 @@ impl TableRowGroupFlow {
TableRowGroupFlow {
block_flow: BlockFlow::from_fragment(fragment),
column_intrinsic_inline_sizes: Vec::new(),
spacing: border_spacing::T {
horizontal: NonNegativeLength::zero(),
vertical: NonNegativeLength::zero(),
},
spacing: border_spacing::T::zero(),
collapsed_inline_direction_border_widths_for_table: Vec::new(),
collapsed_block_direction_border_widths_for_table: Vec::new(),
}
@ -163,7 +159,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(Au::from(self.spacing.vertical))
self.block_flow.assign_block_size_for_table_like_flow(self.spacing.vertical());
}
fn compute_stacking_relative_position(&mut self, layout_context: &LayoutContext) {